I have two interface eth0 and eth1

My application runs on eth1

The incoming packets on eth0( are being prerouted to eth1( using

iptables -t nat -p udp -A PREROUTING -d -j DNAT --to-destination

incoming packet

10:34:06.373083 IP > BOOTP/DHCP, Request from 00:a0:bc:00:00:02, length 259

Strangely my application's responses are seen to be going out with sourceIP of eth0(, so the response packets are not able to reach the client IP( as there is no route to the client via eth0.

Outgoing packet

10:34:06.375043 IP > BOOTP/DHCP, Reply, length 300

Is there a way I can route these eth0 packets via eth1.

route table

# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         gateway         UG        0 0          0 eth0 U         0 0          0 eth0 U         0 0          0 eth1

I've tried POSTROUTING SNAT but guess that doesn't work as POSTROUTING happens after the routing rules are looked at(no route from eth0).

(eth1) requests are able to land on eth0 of the server as there is a Keepalived NAT Load Balancer in-between which is taking care of it.

  • It looks like your clients on the eth1 subnet are sending their requests to the IP of eth0, is there any reason they don't directly send a request to eth1? – Bob Dole Apr 12 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.