|  | 
 
| # Keep state. iptables -A FORWARD -m state --state NEW -i ${INSIDE_DEVICE} -j ACCEPT
 iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
 iptables -A FORWARD -m state --state NEW,INVALID -i ${OUTSIDE_DEVICE} -j DROP
 
 # This is mainly for PPPoE usage but it won't hurt anyway so we'll just
 # keep it here.
 iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
 
 # We don't like the NetBIOS and Samba leaking..
 iptables -t nat -A PREROUTING -p TCP -i ${INSIDE_DEVICE} --dport 135:139 -j DROP
 iptables -t nat -A PREROUTING -p UDP -i ${INSIDE_DEVICE} --dport 137:139 -j DROP
 
 # We would like to ask for names from our floppyfw box
 iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
 
 # Ping and friends.
 iptables -A OUTPUT -p icmp -j ACCEPT # to both sides.
 iptables -A INPUT -p icmp -j ACCEPT
 
 # And also, DHCP, but we can basically accept anything from the inside.
 iptables -A INPUT -i ${INSIDE_DEVICE} -j ACCEPT
 iptables -A OUTPUT -o ${INSIDE_DEVICE} -j ACCEPT
 
 # Finally, list what we have
 #iptables -L
 
 # If broken DNS:
 iptables -L -n
 
 # This enables dynamic IP address following
 echo 7 > /proc/sys/net/ipv4/ip_dynaddr
 
 # Rules set, we can enable forwarding in the kernel.
 echo "Enabling IP forwarding."
 echo "1" > /proc/sys/net/ipv4/ip_forward
 # Policy for chains DROP everything
 iptables -P INPUT DROP
 iptables -P OUTPUT DROP
 iptables -P FORWARD DROP
 
 # Good old masquerading.
 iptables -t nat -A POSTROUTING -o ${OUTSIDE_DEVICE} -j MASQUERADE
 
 # DNS Forward to ISP Dns Server
 iptables -t nat -A PREROUTING -p udp -d 0.0.0.0/0 --dport 53 -j DNAT --to 61.134.1.9:53
 #iptables -t nat -A PREROUTING -p udp -d 0.0.0.0/0 --dport 53 -j DNAT --to 61.134.1.4:53
 #iptables -t nat -A PREROUTING -p udp -d 0.0.0.0/0 --dport 53 -j DNAT --to 202.100.4.15:53
 
 # Forwarding outside ports to an internal server.
 # This used to be the ipchains / ipmasqadm portfw commad.
 | 
 |