Reputation: 61
Why does "ip route get" not provide a TABLE_ID SELECTOR?
I am actually using netlink to get routes from a routing table (table ID 2) and I want to get a specific route and not dump the entire routing table and filter in user land.
I was looking at "ip route" code as an example and it seems it does not have the ability to do it using "ip route get" command. The only option it seems is to dump the entire routing table.
Any ideas/pointers?
Upvotes: 1
Views: 6664
Reputation: 3558
You can 'mark' the packets in that command.
As in, assuming table id 2 has fwmark 2 in ip rule
, ip route get IP/cidr mark 2
.
Upvotes: 3
Reputation: 11
You can use --> ip route list table <'tablename>
or
ip route list table <'tableId>
to list the routes in a particular table.
Inorder to find a specific route from a specific table, use
ip route list exact <'addressinfo> table <'tableid>
Hope this helps :)
Upvotes: 0