Searching the routing table
You can apply a filter to search the routing table and display certain routes only. For example, you can display one or more static routes, connected routes, routes learned through RIP, OSPF, or BGP, and routes associated with the network or gateway that you specify.
If you want to search the routing table by route type and further limit the display according to network or gateway, all of the values that you specify as search criteria must match corresponding values in the same routing table entry in order for that entry to be displayed — an implicit AND condition is applied to all of the search parameters you specify.
For example, if the FortiGate unit is connected to network 172.16.14.0/24 and you want to display all directly connected routes to network 172.16.14.0/24, you must select Connected from the Type list, type
172.16.14.0/24 in the Network field, and then select Apply Filter to display the associated routing table
entry or entries. Any entry that contains the word “Connected” in its Type field and the specified value in the
Gateway field will be displayed.
In this example, you will apply a filter to search for an entry for static route to 10.10.10.10/24
To search the FortiGate unit routing table in the web-based manager
1. Go to Router > Monitor > Routing Monitor.
2. From the Type list, select the type of route to display. In our example, select Static.
3. If you want to display routes to a specific network, type the IP address and netmask of the network in the Networks field. In our example, enter 10.10.10/24.
4. If you want to display routes to a specific gateway, type the IP address of the gateway in the Gateway field.
5. Select Apply Filter.
All of the values that you specify as search criteria must match corresponding values in the same routing table entry in order for that entry to be displayed.
To search the FortiGate unit routing table in the CLI
FGT # get router info routing-table details 10.10.10.10
Routing entry for 10.10.10.10/24
Known via “static”, distance 10, metric 0, best
If there are multiple routes that match your filter, they will all be listed, with the best match at the top of the list as indicated by the word best.
Hey mate — is it possible to do this via an api call?