Re: quota and mac addresses
Posted: Sat Jan 23, 2016 5:37 pm
A forum to discuss the Gargoyle web interface for Openwrt
https://www.gargoyle-router.com/phpbb/
Thank you for testingTareq wrote:(gargoyle-ispy 2016-January-24 01:04) enforce_dhcp_assignments still not working
/www$ uci show firewall.@defaults[0]
firewall.cfg02e63d=defaults
firewall.cfg02e63d.syn_flood='1'
firewall.cfg02e63d.input='ACCEPT'
firewall.cfg02e63d.output='ACCEPT'
firewall.cfg02e63d.forward='REJECT'
firewall.cfg02e63d.block_static_ip_mismatches='1'
firewall.cfg02e63d.enforce_dhcp_assignments='1'
Code: Select all
uci del firewall.@defaults[0].block_static_ip_mismatches
Code: Select all
iptables -t filter -L lease_mismatch_check
iptables -t filter -L lease_mismatch_check
Code: Select all
/etc$ iptables -t filter -L lease_mismatch_check
Chain lease_mismatch_check (1 references)
target prot opt source destination
REJECT all -- !Bab_Lab anywhere MAC 00:~:31 reject-with icmp-port-unreachable
REJECT all -- !Rep_2taha anywhere MAC 00:~:11 reject-with icmp-port-unreachable
REJECT all -- !taha_mob2 anywhere MAC 04:~:03 reject-with icmp-port-unreachable
REJECT all -- !Taha_rep anywhere MAC 06:~:11 reject-with icmp-port-unreachable
REJECT all -- !talal_Ext anywhere MAC 10:~:FD reject-with icmp-port-unreachable
REJECT all -- !Trq_Ext anywhere MAC 10:~:D1 reject-with icmp-port-unreachable
REJECT all -- !Sl_pc anywhere MAC 1C:~:75 reject-with icmp-port-unreachable
REJECT all -- !Dllf anywhere MAC 2C:~:84:CF reject-with icmp-port-unreachable
REJECT all -- !GML anywhere MAC 38:~:B2 reject-with icmp-port-unreachable
REJECT all -- !Moh anywhere MAC 48:~:DB reject-with icmp-port-unreachable
REJECT all -- !Slw_taha anywhere MAC 50:~:34 reject-with icmp-port-unreachable
REJECT all -- !Talal anywhere MAC 60:~:CF reject-with icmp-port-unreachable
REJECT all -- !TRQ anywhere MAC 68:~:37 reject-with icmp-port-unreachable
REJECT all -- !Sadam anywhere MAC 6C:~:A2 reject-with icmp-port-unreachable
REJECT all -- !Taha_pc anywhere MAC 70:~:5F reject-with icmp-port-unreachable
REJECT all -- !Taha_mob anywhere MAC 80:~:AA reject-with icmp-port-unreachable
REJECT all -- !FTN anywhere MAC 90:~:B1 reject-with icmp-port-unreachable
REJECT all -- !Ebrahim anywhere MAC 94:~:05 reject-with icmp-port-unreachable
REJECT all -- !shop_modem anywhere MAC B0:~:D9 reject-with icmp-port-unreachable
REJECT all -- !Mm_Mob anywhere MAC B0:~:59 reject-with icmp-port-unreachable
REJECT all -- !Bb_Mob anywhere MAC B4:~:3E reject-with icmp-port-unreachable
REJECT all -- !Mm_Lab anywhere MAC CC:~:A9 reject-with icmp-port-unreachable
REJECT all -- !Dn anywhere MAC F0:~:F0 reject-with icmp-port-unreachable
nworbnhoj wrote:Yep @tarac - thank you - I think that I understand what is going on with this now.
The current iptable rules block a known MAC address who is using a different IP address. We need to add the compliment that blocks an assigned IP address from a different (unknown) MAC address. easy fix.
Yes - I got it half backwards. I thought that the original code was only doing half the job - turns out is was only doing a quarter of the jobTareq wrote:yes, That's what I talked about from the beginning![]()
![]()
Code: Select all
for p in $pairs ; do
local mac
local ip
mac=$(echo $p | sed 's/\^.*$//g')
ip=$(echo $p | sed 's/^.*\^//g')
if [ -n "$ip" ] && [ -n "$mac" ] ; then
iptables -t filter -A lease_mismatch_check ! -s "$ip" -m mac --mac-source "$mac" -j REJECT
iptables -t filter -A lease_mismatch_check -s "$ip" -m mac --mac-source ! "$mac" -j REJECT
fi
done