Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
  • 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

share|improve this question
    
Can we get the output of service iptables status (or iptables -n -L if you are not on Red Hat / Centos). –  Rilindo Nov 18 '11 at 3:54
    
It's not clear what it is you're trying to do. What do you mean by "redirect all the wan traffic"? –  David Schwartz Nov 18 '11 at 4:16
add comment

1 Answer

If you don't have forwarding allow rule you might have to explicitly allow it using:

-A FORWARD -s 10.10.10.2 -d 192.9.200.2 -j ACCEPT
-A FORWARD -s 10.10.10.3 -d 192.9.200.2 -j ACCEPT
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.