Thursday, December 22, 2011

Memory aid on redirecting ports

sysctl -w net.ipv4.ip_forward=1

iptables -t nat -A PREROUTING -d < DEST > -p tcp -m tcp --dport <original destport> -j DNAT --to-destination <new machine>:<new port>

iptables -t nat -A POSTROUTING -d <new machine> -p tcp -m tcp -j SNAT --to-source <this box ip>

iptables -A FORWARD -d <new machine> -j ACCEPT

0 Comments:

Post a Comment

<< Home