Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to see routes for a specific Host?

0 like 0 dislike

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 via 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     U         0 0          0 eth0     U         0 0          0 eth1     U         0 0          0 eth2     U         0 0          0 eth3     U         0 0          0 eth4     U         0 0          0 eth5     U         0 0          0 eth6         UG        0 0          0 eth0
asked Feb 5, 2015 by Joe And why on earth are you trying to use netstat?

1 Answer

0 like 0 dislike
Best answer
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 via 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.
answered Feb 5, 2015 by Zoredache