Question

I have an OVH debian server with 2 IP addresses :

  • eth0 inet adr:5.39.78.122 (physical)

  • eth0:0 inet adr:188.142.57.137 (failover)

I need to configure 2 different services on the same port 32 :

  • One that will reply on 188.142.57.137:32

  • The second one that will route 5.39.78.122:32 => 188.142.57.137:3232

I think that I can do it with iptables nat table but I don't know how to ?

Someone can explain me ?

Thanks

Was it helpful?

Solution 2

Thanks great !!! It works fine !!!

I used this tuto for first step setting Iptables :

https://wiki.debian.org/iptables

And add theses lines at the end :

*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING --dst 5.39.78.122 -p tcp --dport 32 -j DNAT --to-destination 188.142.57.137:3232
COMMIT

OTHER TIPS

You could try this (assuming you mean TCP port 32):

iptables -t nat -A PREROUTING --dst 5.39.78.122 -p tcp --dport 32 -j DNAT --to-destination 188.142.57.137:3232

If possible, I would try to bind the services to the specific adresses instead of using NAT. But this depends on your services.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top