0

I have this server used for testing some network parameters. It has 3 separate network cards, each with the below IP configuration:

  • 192.168.10.150/30 gw 10.149
  • 192.168.152.146/30 gw 152.145
  • 192.168.32.10/30 gw 32.9

I want to ping each network card separately, and I want the server to answer each ICMP packet from the exact NIC that it has arrived. But when doing this, ping gives TTL exceeded message, and trace route displays a loop in the route.

Mark Riddell
  • 1,103
  • 1
  • 6
  • 10
PyGuy
  • 101
  • 2
  • I have solved the problem for IP services by direct assignment of service to the network card, so no default gateway is required. But this is not possible for ping. – PyGuy Feb 04 '17 at 18:44
  • Just an FYI, you will want to have just a single default gateway. You can use all 3 NIC just fine, and linux will know to respond to requests coming from their local network back the way they came. If you really need multiple 'gateways', you still define only one, and use multiple routing tables. – KHobbits Feb 04 '17 at 19:21
  • From what IP address are you pinging? – wurtel Feb 07 '17 at 11:58

1 Answers1

0

Yes, for services I can bind the ports to network cards. But for ping this is not possible. I used source-routing to solve this issue - using IP rule I defined different routing tables for each ping response packet.

ip rule add from 192.168.10.150 table tbl3
ip route add default via 192.168.10.149 table tbl3

ip rule add from 192.168.152.146 table tbl2
ip route add default via 192.168.152.145 table tbl2

ip rule add from 192.168.32.10 table tbl1
ip route add default via 192.168.32.9 table tbl1
PyGuy
  • 101
  • 2