1

I have a project that requires me to send traffic out a specific Port on a Server the server has 7 Ethernet Ports . I have created the IP rules to send data from a certain host to a certain port. I can happily view my rules via "ip rule show"

However when I create a route to say "Use this Gateway for this Host" I do not see a HOST SPECIFIC ROUTE with Netstat.

ip route add 172.16.2.65 via 172.16.1.1 dev eth3 table eth3

I expect to a route specific for this host when I do netstat -rn. Is this correct? I do not see this Host Specific Route. Is Netstat -rn the proper command. Any thoughts. Thanks.

[18:29:20] shock:/home/debug # netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth0

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth1

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth2

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth3

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth4

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth5

172.16.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth6

0.0.0.0         172.16.1.1      0.0.0.0         UG        0 0          0 eth0
fuero
  • 9,591
  • 1
  • 35
  • 40
Joe
  • 23
  • 5

1 Answers1

1

I expect to a route specific for this host when I do netstat -rn.

netstat uses outdated code for accessing the route table. It has never been updated to handle multiple route tables. You should not be using netstat, or ifconfig. They are not being maintained, and they will lie to you about the state of your system.

The route you added is added to an alternate table named confusingly eth3 ip route add 172.16.2.65 via 172.16.1.1 dev eth3 table eth3. netstat only will see the main table, so this route is not visible.

If you want to see the routes for the eth3 table use ip route show table eth3, or ip route show table all.

Zoredache
  • 130,897
  • 41
  • 276
  • 420