Networking Forums

Networking Forums > Computer Networking > Linux Networking > script for filtering mac addresses in dnsmasq.conf with iptables

Reply
Thread Tools Display Modes

script for filtering mac addresses in dnsmasq.conf with iptables

 
 
bl8n8r
Guest
Posts: n/a

 
      07-04-2007, 06:37 PM
for f in `cat /etc/dnsmasq.conf \
| grep ^dhcp-host \
| grep [0-9a-fA-F]:[0-9a-fA-F] \
| sed 's#=# #g' | sed 's#,# #g' \
| awk '{print $2};'`; do
echo $f
iptables -A INPUT -p UDP --source-port bootpc \
-m mac --mac-source "$f" -j ACCEPT
done


$ iptables -A INPUT -p udp \
--source-port bootpc -j REJECT --reject-with icmp-host-prohibited

$ iptables -nvL
....
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:F0:4D:BCE:B0
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:F1:2D:EC:F1:63
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:FC:2D:1C:91:70
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:FC:2E:BC:E5:49
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:F4:8E:8C:A9:39
0 0 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 MAC 00:FC:2E:BC:58:6D
0 0 REJECT udp -- * * 0.0.0.0/0
0.0.0.0/0 udp spt:68 reject-with icmp-host-prohibited

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy way of changing IP addresses using a script stuart.robert.watson@googlemail.com Windows Networking 1 01-24-2008 12:17 PM
Iptables filtering question George Linux Networking 6 05-20-2005 04:04 PM
web iptables firewall conf tool recommendations /dev/null Linux Networking 1 12-18-2004 09:52 AM
iptables script Hannu Linux Networking 5 10-08-2004 10:04 AM
iptables mac based filtering RJ41 Linux Networking 3 09-04-2003 07:18 PM



1 2 3 4 5 6 7 8 9 10 11