Thread: iptables for router
hi,
i'm trying setup ubuntu server serve both files , act router between 2 internal networks , 1 external network (a cable modem). i've got working (i can pass packets between internal networks , networks can ip address dnsmasq , outside, right both of internal networks can access services running on server. right service want 2 internal network systems able access ssh.
other requests want iptables block. wondering if guys take @ firewall script posted below , let me know need change in order still let both internal networks outside , eth1 access systems on eth0, not allow either eth0 or eth1 access ports except 22 on server.
thanks,
andy
code:#!/bin/sh path=/usr/sbin:/sbin:/bin:/usr/bin # # delete existing rules. # iptables -f iptables -t nat -f iptables -t mangle -f iptables -x # accept loopback traffic iptables -a input -i lo -j accept # allow established connections, , not coming outside iptables -a input -m state --state established,related -j accept iptables -a forward -i ethwan -o eth0 -m state --state established,related -j accept iptables -a input -m state --state new ! -i ethwan -j accept # allow services iptables -a input -p tcp --dport 22 -j accept iptables -a input -p tcp -s 128.173.14.84 --dport 137 -j accept iptables -a input -p tcp -s 128.173.14.84 --dport 138 -j accept iptables -a input -p tcp -s 128.173.14.84 --dport 139 -j accept iptables -a input -p tcp -s 128.173.14.84 --dport 445 -j accept # allow outgoing connections lan side. iptables -a forward -i eth1 -o ethwan -j accept iptables -a forward -i eth1 -o eth0 -j accept iptables -a forward -i eth0 -o ethwan -j accept # masquerade. iptables -t nat -a postrouting -o ethwan -j masquerade # don't forward outside inside. iptables -a input -j drop iptables -a forward -j drop # save new rules iptables-save > /etc/iptables.rules
does have suggestions?
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Networking & Wireless [SOLVED] iptables for router
Ubuntu
Comments
Post a Comment