Basic Routing
Route View
Table 1 Route View
Command | Purpose |
|---|---|
show {ip|ipv6} route [summary|connected|static|bgp|ospf|isis|ip-address] | Display IPv4/IPv6 route info. |
show {ip|ipv6} protocol | Display IPv4/IPv6 protocol info. |
show pbr interface [ethernet interface_name|link-aggregation lag-id] [json] | Display PBR binding info. |
show pbr map [pbr-map-name|json|detail] | Display PBR policy info. |
show pbr nexthop-groups [next-group-name|json] | Display PBR next-hop info. |
show {ip|ipv6} route [summary|connected|static|bgp|ospf|isis|ip-address]
[Command] show {ip|ipv6} route [summary|connected|static|bgp|ospf|isis|ip-address]
[Purpose] Display IPv4/IPv6 route info.
[Parameters]
Parameter | Description |
|---|---|
ip-address | IPv4 or IPv6 address. |
[View] Privileged User 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:10show {ip|ipv6} protocol
[Command] show {ip|ipv6} protocol
[Purpose] Display IPv4/IPv6 protocol info.
[View] Privileged User 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 : noneshow pbr interface [ethernet interface_name|link-aggregation lag-id] [json]
[Command] show pbr interface [ethernet interface_name|link-aggregation lag-id] [json]
[Purpose] Display PBR binding info.
[Parameters]
Parameter | Description |
|---|---|
interface_name | Interface name(eg.0/1) |
lag-id | LAG ID, the range is from 1 to 9999. |
[View] Privileged User View
[Use Cases]
sonic# show pbr interface ethernet 0/0
ethernet 0/0(15) with pbr-policy yd1show pbr map [pbr-map-name|json|detail]
[Command] show pbr map [pbr-map-name|json|detail] [Purpose] Display PBR policy info.
[Parameters]
Parameter | Description |
|---|---|
pbr-map-name | PBR map name. |
[View] Privileged User View
[Use Cases]
sonic# show pbr map yd1
pbr-map yd1 valid: yes
Seq: 1 rule: 300
Installed: yes Reason: Valid
SRC Match: 100.0.0.2/32
nexthop 102.0.0.2
Installed: yes Tableid: 10002show pbr nexthop-groups [next-group-name|json]
[Command] show pbr nexthop-groups [next-group-name|json] [Purpose] Display PBR next-hop info.
[Parameters]
Parameter | Description |
|---|---|
next-group-name | Next-hop group name. |
[View] Privileged User View
[Use Cases]
sonic# show pbr nexthop-groups yd
Nexthop-Group: yd Table: 10000 Valid: 1 Installed: 1
Valid: 1 nexthop 102.0.0.2
Valid: 1 nexthop 103.0.0.2Route Config
Table 2 Route Config
Command | Purpose |
|---|---|
ip route A.B.C.D/M {A.B.C.D|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf] | Configure IPv4 static routes. |
ipv6 route X:X::X:X/M {X:X::X:X|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf] | Configure IPv6 static routes. |
pbr-map pbr-map-name seq seq-num | Create PBR policy and enter the PBR-map configuration view. |
match {dst-ip dip|dst-port dport|ip-protocol ip-protocol|src-ip sip|src-port sport} | Configure PBR policy match fields. |
set {nexthop {A.B.C.D|X:X::X:X}|nexthop-group next-group-name} | Configure PBR policy actions. |
nexthop-group next-group-name | Create a next-hop group and enter the next-hop group configuration mode. |
nexthop {A.B.C.D|X:X::X:X} | Configure the next hop. |
pbr-policy pbr-map-name | Bind PBR policy. |
ip route A.B.C.D/M {A.B.C.D|interface-type interface-name} [OPTIONs]
[Command] ip route A.B.C.D/M {A.B.C.D|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf]
[Purpose] Configure IPv4 static routes.
[Parameters]
Parameter | Description |
|---|---|
A.B.C.D/M | Specify the destination network segment for routing. |
A.B.C.D | Specify the IP address of next hop of the route. |
interface-type | The next-hop interface type. Optional parameters include ethernet, vlan, and link-aggregation. |
interface-name | Next-hop interface name. |
distance | Static route distance value,range from 1-255. Default value: 1. |
description | Specify the description for the route. In string form. |
track_id | Track ID, range from [1,4294967295]. |
bfd | Configure static route and BFD linkage. |
vrf | Name of the VRF where the next-hop interface resides. |
[View] Global Configuration View / VRF Configuration View
[Notes] Run command no ip route A.B.C.D/M {A.B.C.D|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf] to delete static routes configuration.
[Use Cases]
sonic# configure terminal
sonic(config)# ip route 20.0.0.0/24 10.0.0.57 description testipv6 route X:X::X:X/M {X:X::X:X|interface-type interface-name} [OPTIONs]
[Command] ipv6 route X:X::X:X/M {X:X::X:X|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf]
[Purpose] Configure IPv6 static routes.
[Parameters]
Parameter | Description |
|---|---|
X:X::X:X/M | Specify the destination network segment for routing. |
X:X::X:X | Specify the IP address of next hop of the route. |
interface-type | The next-hop interface type. Optional parameters include ethernet, vlan, and link-aggregation. |
interface-name | Next-hop interface name. |
distance | Static route distance value,range from 1-255. Default value: 1. |
description | Specify the description for the route. In string form. |
track_id | Track ID, range from [1,4294967295]. |
bfd | Configure static route and BFD linkage. |
vrf | Name of the VRF where the next-hop interface resides. |
[View] Global Configuration View / VRF Configuration View
[Notes] Run command no ipv6 route X:X::X:X/M {X:X::X:X|interface-type interface-name}[distance][description description] [track track-id] [bfd] [nexthop-vrf vrf] to delete static routes configuration.
[Use Cases]
sonic# configure terminal
sonic(config)# ipv6 route 2001::2/96 2002::1 track 1pbr-map pbr-map-name seq seq-num
[Command] pbr-map pbr-map-name seq seq-num
[Purpose] Create PBR policy and enter the PBR-map configuration view.
[Parameters]
Parameter | Description |
|---|---|
pbr-map-name | PBR map name. |
seq-num | Sequence number, range from 1 to 700. |
[View] Global Configuration View
[Notes] Run command no pbr-map pbr-map-name [seq seq_num] to delete PBR policy configuration.
[Use Cases]
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)#match { dst-ip dip|dst-port dport|ip-protocol ip-protocol|src-ip sip|src-port sport}
[Command] match {dst-ip dip|dst-port dport|ip-protocol ip-protocol|src-ip sip|src-port sport}
[Purpose] Configure PBR policy match fields.
[Parameters]
Parameter | Description |
|---|---|
dip | Destination IP, A.B.C.D/M or X:X::X:X/M. |
dst-port | Destination port number, range from 1 to 65535. |
ip-protocol | TCP/UDP. |
sip | Source IP, A.B.C.D/M or X:X::X:X/M. |
sport | Source port number, range from 1 to 65535. |
[View] PBR-map Configuration View
[Notes] Run command no match {dst-ip dip|dst-port dport|ip-protocol ip-protocol|src-ip sip|src-port sport} to delete PBR policy match fields.
[Use Cases]
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)# match src-ip 1.2.1.1/32
sonic(config-pbr-map)#set {nexthop {A.B.C.D|X:X::X:X}|nexthop-group next-group-name}
[Command] set {nexthop {A.B.C.D|X:X::X:X}|nexthop-group next-group-name}
[Purpose] Configure PBR policy actions.
[Parameters]
Parameter | Description |
|---|---|
A.B.C.D|X:X::X:X | Next hop IP. |
next-group-name | Nexthop-group name. |
[View] PBR-map Configuration View
[Notes] Run command no set {nexthop {A.B.C.D|X:X::X:X}|nexthop-group next-group-name} to delete PBR policy actions.
[Use Cases]
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)# set nexthop 83.0.0.1
sonic(config-pbr-map)#nexthop-group next-group-name
[Command] nexthop-group next-group-name
[Purpose] Create a next-hop group and enter the next-hop group configuration mode.
[Parameters]
Parameter | Description |
|---|---|
next-group-name | Nexthop-group name. |
[View] Global Configuration View
[Notes] Run command no nexthop-group next-group-name to delete the next-hop group configuration.
[Use Cases]
sonic(config)# nexthop-group nextgroup1
sonic(config-nh-group)#nexthop {A.B.C.D|X:X::X:X}
[Command] nexthop {A.B.C.D|X:X::X:X}
[Purpose] Configure the next hop.
[Parameters]
Parameter | Description |
|---|---|
A.B.C.D|X:X::X:X | Next hop IP. |
[View] Nexthop-group Configuration View
[Notes] Run command no nexthop {A.B.C.D|X:X::X:X} to delete the next hop configuration.
[Use Cases]
sonic(config)# nexthop-group nextgroup1
sonic(config-nh-group)# nexthop 82.0.0.1
sonic(config-nh-group)#pbr-policy pbr-map-name
[Command] pbr-policy pbr-map-name
[Purpose] Bind PBR policy.
[Parameters]
Parameter | Description |
|---|---|
pbr-map-name | PBR map name. |
[View] Physical Interface/LAGIF Configuration View
[Notes] Run command no pbr-policy pbr-map-name to delete binding PBR policy configuration.
[Use Cases]
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# pbr-policy pbrmap1
sonic(config-if-0/0)#