Skip to contentSkip to conversation

redirection

DISCUSSION Christian Cernuschi 2 participants 2 messages Apr 8, 2003 – Apr 10, 2003

lore
Share & tools
lore
#0 lore raw

i'd like to do this:

i have 2 pc
x.y.z.1
x.y.z.2

i would like to redirect connection on port 80 of x.y.z.1 to port 80 of x.y.z.2

i tried with DNAT but when someone tries to connect it goes in timeout?

Is there a solution?

Thank you
Chris

#1 lore raw
Quoted 11 lines · Christian Cernuschi

i'd like to do this:

i have 2 pc
x.y.z.1
x.y.z.2

i would like to redirect connection on port 80 of x.y.z.1 to port 80 of x.y.z.2

i tried with DNAT but when someone tries to connect it goes in timeout?

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d x.y.z.1 -j DNAT --to x.y.z.2:80

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to x.y.z.1

We are doing the *exact* thing you want to do everyday with the above 2 lines.

Eric