[<<][pool][>>][..]
Sat Feb 19 08:04:38 EST 2011

Full NAT

# fullnat <public IP> <private IP>
#  rule 1. internal IP to external IP after routing.
#  rule 2. external IP to internal IP before routing.
#  rule 3. rewrites outgoing packaets originating on FW to internal addresses

fullnat () {
        $IPTABLES -t nat -A POSTROUTING -o eth+ -s $2 -j SNAT --to-source $1
        $IPTABLES -t nat -A PREROUTING  -d $1 -j DNAT --to-destination $2

        # necessary for connections from internal IPs to exernal IPs
        $IPTABLES -t nat -A OUTPUT      -d $1 -j DNAT --to-destination $2
}





For openwrt this becomes:


fullnat () {
        $IPTABLES -t nat -A POSTROUTING -o eth+ -s $2 -j SNAT --to-source $1
        $IPTABLES -t nat -A PREROUTING  -d $1 -j DNAT --to-destination $2

        # necessary for connections from internal IPs to exernal IPs
        $IPTABLES -t nat -A OUTPUT      -d $1 -j DNAT --to-destination $2
}

Doesn't work on openwrt...



[Reply][About]
[<<][pool][>>][..]