Server with 3 public IP and iptables

Posted by Juan on Server Fault See other posts from Server Fault or by Juan
Published on 2011-11-18T01:34:30Z Indexed on 2011/11/18 1:52 UTC
Read the original article Hit count: 516

Filed under:
|

I have a linux box with two NIC cards: eth0 and eth1.

In one card i have 3 public IP: eth0 = 10.10.10.1, eth0:1= 10.10.10.2 and eth0:2= 10.10.10.3 In the other card i have one local IP eth1 = 192.9.200.1

I want to redirect all the wan traffic for 10.10.10.2 to the LAN 192.9.200.2 and the same for 10.10.10.3 to 192.9.200.3

I have tried with this rule but doesn't work

iptables -t nat -A PREROUTING -i eth0 -d 10.10.10.2 -j DNAT --to-destination 192.9.200.2
iptables -t nat -A PREROUTING -i eth0 -d 10.10.10.3 -j DNAT --to-destination 192.9.200.3

IP forward is enabled in /etc/sysctl.conf

Can you help me, please.

© Server Fault or respective owner

Related posts about iptables

Related posts about ip-forwarding