Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iptables and DNAT

Status
Not open for further replies.

sproosy

IS-IT--Management
Oct 31, 2002
94
AU
I want to redirect all POP3 requests from mchineA to machineB. How waould i do that using NAT or DNAT?

Cheeers

ryan

Sproosy MCP

Keep it real!
 
Code:
iptables -t nat -A PREROUTING -p tcp -d <your computer's IP> --dport  110 -j DNAT --to-destination <other computer>:110
should do it.

//Daniel
 
Thanks for that! One last question? Once the redirect happens do the packets know where to go on their way back? i.e. If i have sent them from A to B wil they then go back from B to A?

Cheers

Ryan

Sproosy MCP

Keep it real!
 
Its all good i got it to work using this:

iptables -t nat -A PREROUTING -i eth0 -p tcp --sport 1024:65535 --dport 110 -j DNAT --to 192.168.0.38:110

iptables -t nat -A POSTROUTING -o eth0 -p tcp -d 192.168.0.38 --dport 110 -j SNAT --to 192.168.0.122

Hope that this can help anyone who comes across this problem in the future.

Thanks for your help danielhozac

Sproosy MCP

Keep it real!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top