1

I have two interface eth0 and eth1

My application runs on eth1

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

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

incoming packet

10:34:06.373083 IP 10.43.18.124.67 > 10.43.16.249.67: 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(10.43.16.249), so the response packets are not able to reach the client IP(10.43.18.124) as there is no route to the client via eth0.

Outgoing packet

10:34:06.375043 IP 10.43.16.249.67 > 10.43.18.124.67: 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         0.0.0.0         UG        0 0          0 eth0
10.43.16.128    0.0.0.0         255.255.255.128 U         0 0          0 eth0
10.43.18.64     0.0.0.0         255.255.255.192 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.