#!/bin/sh PATH=/sbin WAN=eth1 LAN=eth0 # # delete all existing rules. # iptables -F iptables -t nat -F iptables -t mangle -F iptables -X #Set Default Policy #iptables -P INPUT DROP # Always accept loopback traffic iptables -A INPUT -i lo -j ACCEPT # Allow established connections, and those not coming from the outside iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -m state --state NEW -i $LAN -j ACCEPT iptables -A FORWARD -i $WAN -o $LAN -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow outgoing connections from the LAN side. iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT # Masquerade. iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE # Don't forward from the outside to the inside. # iptables -A FORWARD -i $WAN -o $LAN -j REJECT # Enable routing. echo 1 > /proc/sys/net/ipv4/ip_forward #Set Default Policy # Due to -P, not really needed now. iptables -A INPUT -j DROP ### uTorrent ## -- These ports are forwarded to DBRF100 iptables -A PREROUTING -t nat -i $WAN -p tcp --dport 50000 -j DNAT --to 192.168.13.40:50000 iptables -A INPUT -p tcp -m state --state NEW --dport 50000 -i $WAN -j ACCEPT