I need to know how to list the IDs of all route tables. For example, I can run:
ip rule add fwmark 2 table 104
ip route add dev eth0 default via 192.168.3.7 table 104
A call to ip rule list
shows:
0: from all lookup local
32765: from all fwmark 0x2 lookup 104
32766: from all lookup main
32767: from all lookup default
And a call to ip route show table 104
shows:
default via 192.168.3.7 dev eth0
If I then call ip rule del table 104
, a subsequent call to ip rule list
shows:
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
However, a call to ip route show table 104
still shows:
default via 192.168.3.7 dev eth0
I know that I can flush the table using ip route flush table 104
. I'd like to be able to flush all tables that are not local
, main
, and default
. Thus I want to be able to list the existing tables.
I've seen people use cat /etc/iproute2/rt_tables
, but that only produces:
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
What can I do to get all the table names that currently exist? Thanks in advance!