#clear the rules table iptables -F iptables -t nat -F iptables -t mangle -F iptables -X #set standard policity (what to do with packets not matching the folloiwng rules) iptables -P INPUT REJECT # Always accept loopback traffic iptables -A INPUT -i lo -j ACCEPT iptables -N block iptables -A block -m state --state ESTABLISHED,RELATED -i ppp0 -d 192.168.0.0/32 -j ACCEPT iptables -A block -m state --state ESTABLISHED,RELATED -o ppp0 -s 192.168.0.0/32 -j ACCEPT iptables -A block -m state --state NEW,INVALID -i ! ppp0 -j ACCEPT iptables -A block -j REJECT iptables -A FORWARD -j block # turn on NAT (IP masquerading for outgoing packets) iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE #Enable routing. echo 1 > /proc/sys/net/ipv4/ip_forward # Disable response to ping. NO DDOS /bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all # Disable response to broadcasts. # You don't want yourself becoming a Smurf amplifier. /bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts # Disable ICMP redirect acceptance. ICMP redirects can be used to alter your routing # tables, possibly to a bad end. /bin/echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -m state --state NEW -i ppp0 -j ACCEPT iptables -A INPUT -d 192.168.0.0/24 -j ACCEPT