Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » Iptables Blocking MAC Address Aray

Iptables Blocking MAC Address Aray

#!/bin/bash
blockSource=(192.168.1.13 192.168.1.21 192.168.1.3)
blockDestination=(175.103.59.118 175.103.59.118)
blockSourceMac=(08:00:27:00:FC:D6)
#bloc mac source
for x in ${blockSourceMac[@]};
do
 iptables -I FORWARD -m mac --mac-source ${x} -j DROP
 iptables -I PREROUTING -t nat --mac-source ${x} -j DROP
done
#block ip source
for y in ${blockSource[@]};
do
 iptables -I FORWARD -s ${y} -j DROP
 iptables -I PREROUTING -s ${y} -j DROP
done
#block ip destionation
for z in ${blockDestination[@]};
do
 iptables -I FORWARD -d ${z} -j DROP
 iptables -I PREROUTING -d ${z} -j DROP
done

Filed under: 7. Operating System

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>