Skip to content

Instantly share code, notes, and snippets.

@mtongnz
Created April 20, 2020 12:32
Show Gist options
  • Save mtongnz/6914bbeee1afd6bc4402e95e1a1ce624 to your computer and use it in GitHub Desktop.
Save mtongnz/6914bbeee1afd6bc4402e95e1a1ce624 to your computer and use it in GitHub Desktop.
#!/bin/sh
PORT_DHCP="67"
PORT_DNS="53"
SHINOBI_IP="192.168.9.10"
STATE_NEW="-m state --state NEW"
REJECT="REJECT --reject-with icmp-host-prohibited"
REJECT_TCP="REJECT --reject-with tcp-reset"
# limit guests to essential router services (icmp echo/reply, dhcp, dns)
iptables -I INPUT -i br1 $STATE_NEW -j $REJECT
iptables -I INPUT -p tcp -i br1 $STATE_NEW -j $REJECT_TCP
iptables -I INPUT -p icmp -i br1 -j ACCEPT
iptables -I INPUT -p tcp -i br1 --dport $PORT_DNS -j ACCEPT
iptables -I INPUT -p udp -i br1 --dport $PORT_DNS -j ACCEPT
iptables -I INPUT -p udp -i br1 --dport $PORT_DHCP -j ACCEPT
# deny access to private network by guests (internet only)
iptables -I FORWARD -i br1 -o br0 $STATE_NEW -j $REJECT
iptables -I FORWARD -p tcp -i br1 -o br0 $STATE_NEW -j $REJECT_TCP
# deny access to guests by private network (optional)
iptables -I FORWARD -i br0 -o br1 $STATE_NEW -j $REJECT
iptables -I FORWARD -p tcp -i br0 -o br1 $STATE_NEW -j $REJECT_TCP
#allow access to Shinobi
iptables -I FORWARD 1 -d $SHINOBI_IP -j ACCEPT
iptables -I FORWARD 1 -s $SHINOBI_IP -j ACCEPT
@mtongnz
Copy link
Author

mtongnz commented Apr 20, 2020

This gist relates to this video: https://youtu.be/Tqedi2Qruds

@alvarow
Copy link

alvarow commented Feb 12, 2021

thank you! great video, it helped me segregate my network using pfSense and a few ac68u as AP!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment