2

How can I see ip routes I've added with ip route add default via x.x.x.55 table test1 for example I added 199 test1 and 198 test2 and 197 test3 to /etc/iproute2/rt_tables

then I run:

ip route add default via x.x.x.55 table test1
ip route add default via x.x.x.55 table test2
ip route add default via x.x.x.55 table test3

then when I check route -n, this is the only thing I see

x.x.x.x   0.0.0.0         255.255.255.224 U     0      0        0 tun0

additional test

ip route flush x.x.x.55
ip route add default via x.x.x.55 table test1
RTNETLINK answers: File exists

Where is the test1, test2 and test3 I've added?

Orlo
  • 231
  • 1
  • 3
  • 11

1 Answers1

6

Stop using the netstat and route commands, they will just confuse you and they don't have the necessary functionality anyway.

To view the basic IPv4 routing table:

ip route

To view a specific table:

ip route list table test1

To view everything:

ip route list table all

And remember that these arguments can be abbreviated as long as they remain uniquely identifiable:

ip r l t all
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • 2
    Confusing but true. Netstat -rn and route are not fully deprecated but neither are they fully functional in light of iproute2. – dmourati Dec 14 '13 at 21:53