Command Line Reference
IP Unicast Routing
Static Route-configuration
10 min
static route configuration static route configuration show ip route show ip route \[command] show ip route \[summary|connected|static|bgp|ospf|isis|kernel| a b c d/m | a b c d |vrf{all|string}|json] \[purpose] display all ipv4 routes \[parameter] parameter parameter description description a b c d/m ip prefix \<network>/\<length> a b c d network \[view] system view \[use cases] sonic# show ip route connected codes k kernel route, c connected, s static, r rip, o ospf, i is is, b bgp, e eigrp, n nhrp, t table, v vnc, v vnc direct, a babel, d sharp, f pbr, f openfabric, \> selected route, fib route, q queued, r rejected, b backup c> 10 0 0 0/24 is directly connected, ethernet112, 00 22 20 c> 10 1 0 103/32 is directly connected, loopback0, 20 16 20 c> 10 250 0 0/24 is directly connected, eth0, 20 16 40 c> 11 11 10 0/24 is directly connected, vlan10, 20 16 10 c> 112 0 0 0/24 is directly connected, ethernet112, 00 22 20 c> 122 0 0 0/24 is directly connected, vlan100, 20 16 10 show ip protocol \[vrf {all|string}] show ip protocol \[vrf {all|string}] \[command] show ip protocol \[purpose] display ipv4 protocol information \[parameter] parameter parameter description description vrf display ipv4 protocol information under the specified vrf \[view] system view \[use cases] sonic# show ip protocol protocol route map \ system none kernel none connected none static none rip none ripng none ospf none ospf6 none isis none bgp rm set src pim none eigrp none nhrp none hsls none olsr none table none ldp none vnc none vnc direct none vnc rn none bgp direct none bgp direct to nve groups none babel none sharp none pbr none bfd none wildcard none any none show ipv6 route show ipv6 route \[command] show ipv6 route \[summary|connected|static|bgp|ospf6|isis|kernel| x\ x x \ x /m | x\ x x \ x |vrf{all|string}|json] \[purpose] show ipv6 routing table \[parameter] parameter parameter description description summary show route summary connected show directly connected routes static display static routes bgp show bgp routes ospf6 display ospf6 routes isis show isis routes kernel show kernel routes x\ x x\ x/m ipv6 prefix \<network>/\<length> x\ x x\ x network vrf display the routes under the specified vrf json display routes in json format \[view] system view \[use cases] sonic# show ipv6 route codes k kernel route, c connected, s static, r ripng, o ospfv3, i is is, b bgp, n nhrp, t table, v vnc, v vnc direct, a babel, d sharp, f pbr, f openfabric, \> selected route, fib route, q queued, r rejected, b backup b> /0 \[20/0] via fe80 1a17 25ff\ fe37 6508, ethernet50, weight 1, 02 54 43 via fe80 1a17 25ff\ fe37 6722, ethernet49, weight 1, 02 54 43 show ipv6 protocol \[vrf {all|string}] show ipv6 protocol \[vrf {all|string}] \[command] show ipv6 protocol \[purpose] display ipv6 protocol information \[parameter] parameter parameter description description vrf display ipv6 protocol information under the specified vrf \[view] system view \[use cases] sonic# show ipv6 protocol vrf default protocol route map \ system none kernel none connected none static rm set src6 rip none ripng none ospf none ospf6 none isis none bgp rm set src6 pim none eigrp none nhrp none hsls none olsr none table none ldp none vnc none vnc direct none vnc rn none bgp direct none bgp direct to nve groups none babel none sharp none pbr none bfd none openfabric none vrrp none nhg none srte none wildcard none any none ip route a b c d{/m|a b c d} ip route a b c d{/m|a b c d} \[command] ip route a b c d {/m|a b c d} { a b c d |null0|ethernet interface num |vlan vlan id |link aggregation lag id |vxlan vni vni }\[option] ip route a b c d {/m|a b c d} {reject|blackhole} \[tag tag id | distance |label label id |table table id ] ip route a b c d {/m|a b c d} gre gre id no ip route a b c d {/m|a b c d} { a b c d |null0|ethernet interface num |vlan vlan id |link aggregation lag id |vxlan vni vni }\[option] \[purpose] configure ipv4 static routes \[parameter] parameter parameter description description a b c d/m destination ip address of the route a b c d routing the ip address of the next hop null0 no outgoing interface specified ethernet specify the outgoing interface as a physical port interface num the range of interface id 0 54 vlan specify the outgoing interface as a vlan port vlan id specify vlan id, range 1 4094 link aggregation specify the outgoing interface as the aggregation port lag id specify lag id vrf display the routes under the specified vrf vxlan vni direct vxlan vni value vni vni range 1 16777215 option options are as follows parameter parameter description description tag specify the tag value of the route, range 1 4294967295 distance specify the metric value of the route, in the range 1 255 label specify the label value of the route, ranging from 16 to 1048575, separated by "/" table specify the table value of this route, range 1 4294967295 nexthop vrf specify the vrf for the next hop of this route color specify the color value of this route, range 1 4294967295 bfd enable the bfd detection function for this route multihop set bfd's multihop mode local address set local address in multihop mode of bfd, a b c d reject specify the route as reject type blackhole specify the route as a blackhole route gre specify the routing out interface as gre gre id specify gre id range, 0 323 \[view] system configuration view \[use cases] sonic# configure terminal sonic(config)# ip route 20 0 0 0/24 10 0 0 57 ipv6 route x\ x x\ x{/m|x\ x x\ x} ipv6 route x\ x x\ x{/m|x\ x x\ x} \[command] ipv6 route x\ x x \ x {/m|x\ x x \ x } \[from x\ x x \ x /m ] { x\ x x \ x |null0|ethernet interface num |vlan vlan id |link aggregation lag id |vxlan vni vni }\[option] ipv6 route x\ x x \ x {/m|x\ x x \ x } {reject|blackhole}\[tag tag id | distance |label label id |table table id ] ipv6 route x\ x x \ x {/m|x\ x x \ x } gre gre id no ipv6 route x\ x x \ x {/m|x\ x x \ x } \[from x\ x x \ x /m ] { x\ x x \ x |null0|ethernet interface num |vlan vlan id |link aggregation lag id |vxlan vni vni }\[option] \[purpose] configure ipv6 static routes \[parameter] parameter parameter description description x\ x x\ x/m destination ipv6 address of the route x\ x x\ x routing the next hop ipv6 address from specify the source address of the route x\ x x\ x/m specify the route address prefix null0 no outgoing interface specified ethernet specify the outgoing interface as a physical port interface num the range of interface id 0 54 vlan specify the outgoing interface as a vlan port vlan id specify vlan id, range 1 4094 link aggregation specify the outgoing interface as the aggregation port lag id specify lag id vxlan vni direct vni value vni vni range 1 16777215 option options are as follows tag specify the tag value of the route, range 1 4294967295 distance specify the metric value of the route, in the range 1 255 label specify the label value of the route, ranging from 16 to 1048575, separated by "/" table specify the table value of this route, range 1 4294967295 nexthop vrf specify the vrf for the next hop of this route color specify the color value of this route, range 1 4294967295 bfd enable the bfd detection function for this route multihop set bfd's multihop mode local address set local address in multihop mode of bfd, a b c d reject specify the route as reject type blackhole specify the route as a blackhole route gre specify the route out interface as gre gre id specify gre id range, 0 323 \[view] system configuration view \[use cases] sonic# configure terminal sonic(config)# ipv6 route 2022 2000/64 1000 1
