OcNOS-SP : System Management Guide : System Management Command Reference : Interface Commands : show ip route A.B.C.D/M longer-prefixes
show ip route A.B.C.D/M longer-prefixes
Use this command to see all subnets of a specified network if they are present in the routing table. Please use this command with mask information.
Command Syntax
show ip route A.B.C.D/M longer-prefixes
Parameters
A.B.C.D/M
 
Command Mode
Exec-mode and Privileged exec-mode
Applicability
This command was introduced in OcNOS version 1.3.6.
Example
#sh ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
 
- candidate default
 
IP Route Table for VRF "default"
C 10.1.1.0/24 is directly connected, eth1, 00:00:23
C 10.12.41.0/24 is directly connected, eth0, 00:00:23
S 55.0.0.0/8 [1/0] is directly connected, eth1, 00:00:23
S 55.0.0.0/12 [1/0] is directly connected, eth1, 00:00:23
S 55.0.0.0/24 [1/0] is directly connected, eth1, 00:00:23
S 55.1.0.0/16 [1/0] is directly connected, eth1, 00:00:23
S 55.1.1.0/24 [1/0] is directly connected, eth1, 00:00:23
C 127.0.0.0/8 is directly connected, lo, 00:00:23
 
Gateway of last resort is 10.30.0.11 to network 0.0.0.0
 
K* 0.0.0.0/0 via 10.30.0.11, eth0
O 9.9.9.9/32 [110/31] via 10.10.31.16, eth2, 00:18:56
K 10.10.0.0/24 via 10.30.0.11, eth0
C 10.10.31.0/24 is directly connected, eth2
S 10.10.34.0/24 [1/0] via 10.10.31.16, eth2
O 10.10.37.0/24 [110/11] via 10.10.31.16, eth2, 00:20:54
C 10.30.0.0/24 is directly connected, eth0
S 11.22.11.0/24 [1/0] via 10.10.31.16, eth2
O E2 14.5.1.0/24 [110/20] via 10.10.31.16, eth2, 00:18:56
S 16.16.16.16/32 [1/0] via 10.10.31.16, eth2
O 17.17.17.17/32 [110/31] via 10.10.31.16, eth2, 00:20:54
C 45.45.45.45/32 is directly connected, lo
O 55.55.55.55/32 [110/21] via 10.10.31.16, eth2, 00:20:54
C 127.0.0.0/8 is directly connected, lo
 
#sh ip route 55.0.0.0/7 longer-prefixes
Routing entry for 55.0.0.0/8
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.0.0.0/12
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.0.0.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.0.0/16
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.0.0.0/8 longer-prefixes
Routing entry for 55.0.0.0/8
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.0.0.0/12
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.0.0.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.0.0/16
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.0.0.0/11 longer-prefixes
Routing entry for 55.0.0.0/12
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.0.0.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.0.0/16
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.0.0.0/16 longer-prefixes
Routing entry for 55.0.0.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.1.0.0/16 longer-prefixes
Routing entry for 55.1.0.0/16
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.1.0.0/20 longer-prefixes
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#sh ip route 55.1.0.0/24 longer-prefixes
% Network not in table
#
#sh ip route 55.1.1.0/24 longer-prefixes
Routing entry for 55.1.1.0/24
Known via "static", distance 1, metric 0, External Route Tag: 0, best
 
directly connected, eth1
 
#
Header
Each entry in this table has a code preceding it, indicating the source of the routing entry. For example, O indicates OSPF as the origin of the route and K indicates that the route has been learned from the kernel. Table 21-66 shows these codes and modifiers.
Table 21-66 explain the fields in the command output.
 
Table 21-66: route codes and modifiers
Code
Meaning
Description
K
kernel
Routes added through means other than by using the CLI; for example by using the operating system route command.
Static routes added using kernel commands and static routes added using OcNOS commands are different. The kernel static routes are not redistributed when you give the redistribute static command in a protocol. However, the kernel static routes can be redistributed using the redistribute kernel command.
C
connected
Routes directly connected to the local device that were not distributed via IGP. The device inherently knows of these networks, so there is no need to learn about these from another device.
Connected routes are preferred over routes for the same network learned from other routing protocols.
Routes for connected networks always exist in the kernel routing table but as an exception are not marked as kernel routes because OcNOS always calculates entries for these routes upon learning interface information from the kernel.
S
static
Routes manually configured via CLI which are not updated dynamically by IGPs.
The codes below are for routes received and dynamically learned via IGP neighbors. These networks are not directly connected to this device and were announced by some other device on the network. IGPs update these routes as the network topology changes.
R
RIP
RIP routing process and enter Router mode.
B
BGP
Route is from an Border Gateway Protocol.
O
OSPF
Modifiers for OSPF:
IA - OSPF inter area
N1 - OSPF NSSA external type 1
N2 - OSPF NSSA external type 2
E1 - OSPF external type 1
E2 - OSPF external type 2
i
IS-IS
Modifiers for IS-IS:
L1 - IS-IS level-1
L2 - IS-IS level-2
ia - IS-IS inter area
Other modifiers:
v
vrf leaked
The device has two or more VRFs configured and each has at least one interface bound to it. While each VRF will have its own routing table, the VRFs can learn each other’s routes.
*
candidate default
Route has been added to the FIB. With equal cost paths to a destination, the router does per-packet or per-destination load sharing. An asterisk ("*") means that the route is being used at that instant for forwarding packets. If you run the same show ip route x.x.x.x command over and over, you might see the * moving between the route entries.
>
selected route
When multiple routes are available for the same prefix, the best route.
When multiple entries are available for the same prefix, OcNOS uses an internal route selection mechanism based on protocol administrative distance and metric values to choose the best route. OcNOS populates the FIB with the best route to each destination
p
stale info
A route information that is marked stale due to graceful restart.
After the codes, the header has default gateway information:
Gateway of last resort is 10.12.4.1 to network 0.0.0.0
The “gateway of last resort”, also called the default gateway, is a static route that routes IP address 0.0.0.0 (all destinations) through a single host (the gateway). The effect of setting a gateway is that if no routing table entry exists for a destination address, packets to that address will be forwarded to the gateway router.
Route Entry Fields
Table 21-67 explains the each route entry fields.
 
Table 21-67: route entry output details
Field
Description
Codes and modifiers
As explained in Table 21-66.
IP address
IP address of the remote network.
Administrative distance and metric
The administrative distance determines how trustworthy this route is. If there is a similar route but with a smaller administrative distance, it is used instead, because it is more “trustworthy”. The smaller the administrative distance, the more trustworthy the route. Directly connected routes have an administrative distance of 0, which makes them the most trustworthy type of route.The metric varies from protocol to protocol, and for OSPF the metric is cost, which indicates the best quality path to use to forward packets. Other protocols, like RIP, use hop count as a metric. For neighboring routers, the metric value is 1.
Next hop router IP address
This route is available through the next hop router located at this IP address. This identifies exactly where packets go when they match this route.
Outgoing interface name
Interface used to get to the next-hop address for this route.
Duration
Length of time that this route has been present in the routing table. This is also the length of time this route has existed without an update. If the route were removed and then re-added (if the cable was disconnected, for instance), this timer would begin again at 00:00:00.
Route Entry Examples
O 10.10.37.0/24 [110/11] via 10.10.31.16, eth2, 00:20:54
This route in the network 10.10.37.0/24 was added by OSPF.
This route has an administrative distance of 110 and metric/cost of 11.
This route is reachable via nexthop 10.10.31.16.
The outgoing local interface for this route is eth2.
This route was added 20 minutes and 54 seconds ago.
O E2 14.5.1.0/24 [110/20] via 10.10.31.16, eth2, 00:18:56
This route is the same as the other OSPF route above; the only difference is that it is a Type 2 External OSPF route.
C 10.10.31.0/24 is directly connected, eth2
This route is directly connected.
Route entries for network 10.10.31.0/24 are derived from the IP address of local interface eth2.
K 10.10.0.0/24 via 10.30.0.11, eth0
This route in the network 10.10.0.0/24 was learned from the kernel routing table (route was statically added using kernel commands).
This route is reachable via nexthop 10.30.0.11.
The outgoing local interface for this route is eth0.
K* 0.0.0.0/0 via 10.30.0.11, eth0
This is a default route that was learned from the kernel (route was statically added using kernel commands).
This route is reachable via nexthop 10.30.0.11.
The local interface for this route is eth0.
Example: Display OSPF Routes
The following is the output with the ospf parameter:
#show ip route ospf
O 1.1.1.0/24 [110/20] via 2.2.2.1, eth2, 00:00:44
O IA 4.4.4.0/24 [110/21] via 2.2.2.1, eth2, 00:00:44
#
Example: Display Route Summary
The following is the output with the summary parameter.
#show ip route summary
IP routing table name is Default-IP-Routing-Table(0)
IP routing table maximum-paths is 4
Route Source Networks
kernel 1
connected 5
ospf 2
Total 8
FIB 2
Example: Display RIB Routes
The following shows displaying database routes.
#show ip route database
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
> - selected route, * - FIB route, p - stale info
 
K *> 0.0.0.0/0 via 10.30.0.11, eth0
O *> 9.9.9.9/32 [110/31] via 10.10.31.16, eth2, 00:19:21
K *> 10.10.0.0/24 via 10.30.0.11, eth0
O 10.10.31.0/24 [110/1] is directly connected, eth2, 00:28:20
C *> 10.10.31.0/24 is directly connected, eth2
S *> 10.10.34.0/24 [1/0] via 10.10.31.16, eth2
O 10.10.34.0/24 [110/31] via 10.10.31.16, eth2, 00:21:19
O *> 10.10.37.0/24 [110/11] via 10.10.31.16, eth2, 00:21:19
K * 10.30.0.0/24 is directly connected, eth0
C *> 10.30.0.0/24 is directly connected, eth0
S *> 11.22.11.0/24 [1/0] via 10.10.31.16, eth2
O E2 *> 14.5.1.0/24 [110/20] via 10.10.31.16, eth2, 00:19:21
O 16.16.16.16/32 [110/11] via 10.10.31.16, eth2, 00:21:19
S *> 16.16.16.16/32 [1/0] via 10.10.31.16, eth2
O *> 17.17.17.17/32 [110/31] via 10.10.31.16, eth2, 00:21:19
C *> 45.45.45.45/32 is directly connected, lo
O *> 55.55.55.55/32 [110/21] via 10.10.31.16, eth2, 00:21:19
K * 127.0.0.0/8 is directly connected, lo
C *> 127.0.0.0/8 is directly connected, lo
The codes and modifier at the start of each route entry are explained in Table 21-66.
Routes in the FIB are marked with a *. When multiple routes are available for the same prefix, the best route is indicated with the > symbol. Unselected routes have neither the * nor the > symbol.
Route Database Entry Examples
This example shows 2 entries in the route database; one learned from the kernel and the other derived from interface information.
K * 10.30.0.0/24 is directly connected, eth0
C *> 10.30.0.0/24 is directly connected, eth0
Both these routes are in the same network 10.30.0.0/24.
The first route has originated from the kernel. The * indicates that it has been added to the FIB.
The second route is derived from the IP address of local interface eth0. It is marked as a connected route. Since a connected route has the lowest administrative distance, it is the selected route.
S *> 10.10.34.0/24 [1/0] via 10.10.31.16, eth2
O 10.10.34.0/24 [110/31] via 10.10.31.16, eth2, 00:21:19
The same prefix was learned from OSPF and from static route configuration.
Static routes are preferred over OSPF routes, so the static route is selected and installed in the FIB.
Note: If the static route becomes unavailable, OcNOS automatically selects the OSPF route and installs it in the FIB.
Example: Display VRF Routes
The following is the output with the vrf parameter:
#show ip route vrf vrf31
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "vrf31"
O 2.2.2.2/32 [110/2] via 21.1.1.2, vlan1.4, 00:01:29
O 10.1.1.0/24 [110/2] via 21.1.1.2, vlan1.4, 00:01:29
O 20.1.1.0/24 [110/2] via 21.1.1.2, vlan1.4, 00:01:29
C 21.1.1.0/24 is directly connected, vlan1.4, 00:02:54
C 31.31.1.1/32 is directly connected, lo.vrf31, 00:03:02
O 40.40.1.1/32 [110/3] via 21.1.1.2, vlan1.4, 00:00:43
C 127.0.0.0/8 is directly connected, lo.vrf31, 00:03:05
 
Gateway of last resort is not set
 
The following is the output with the vrf database parameter:
#show ip route vrf vrf31 database
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
> - selected route, * - FIB route, p - stale info
 
IP Route Table for VRF "vrf31"
O *> 2.2.2.2/32 [110/2] via 21.1.1.2, vlan1.4, 00:01:32
O *> 10.1.1.0/24 [110/2] via 21.1.1.2, vlan1.4, 00:01:32
O *> 20.1.1.0/24 [110/2] via 21.1.1.2, vlan1.4, 00:01:32
C *> 21.1.1.0/24 is directly connected, vlan1.4, 00:02:57
O 21.1.1.0/24 [110/1] is directly connected, vlan1.4, 00:02:57
C *> 31.31.1.1/32 is directly connected, lo.vrf31, 00:03:05
O 31.31.1.1/32 [110/1] is directly connected, lo.vrf31, 00:03:00
O *> 40.40.1.1/32 [110/3] via 21.1.1.2, vlan1.4, 00:00:46
B > 50.1.1.0/24 [200/0] via 41.41.41.41, 00:00:18
C *> 127.0.0.0/8 is directly connected, lo.vrf31, 00:03:08
 
Gateway of last resort is not set
 
 
Last modified date: 10/19/2023