---
title: Basic Routing
slug: aidc/basic-routing
createdAt: 2025-12-01T11:11:07.000Z
---

## <font color="#1d50a2">Route View</font>

<font color="#1d05a2">Table 1 Route View</font>

| **Command**                                                                                                                                | **Purpose**                      |
| ------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- |
| **show&#x20;**\{**ip**\|**ipv6**}**&#x20;route&#x20;**\[**summary**\|**connected**\|**static**\|**bgp**\|**ospf**\|**isis**\|*ip-address*] | Display IPv4/IPv6 route info.    |
| **show&#x20;**\{**ip**\|**ipv6**}**&#x20;protocol**                                                                                        | Display IPv4/IPv6 protocol info. |
| **show pbr interface&#x20;**\[**ethernet** *interface\_name*\|link-aggregation *lag-id*] \[**json**]                                       | Display PBR binding info.        |
| **show pbr map&#x20;**\[*pbr-map-name*\|**json**\|**detail**]                                                                              | Display PBR policy info.         |
| **show pbr nexthop-groups&#x20;**\[*next-group-name*\|**json**]                                                                            | Display PBR next-hop info.       |

### <font color="#1d50a2">show \{ip|ipv6\} route \[summary|connected|static|bgp|ospf|isis|*ip-address*\]</font>

**\[Command]**
**show&#x20;**\{**ip**|**ipv6**}**&#x20;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]**

```plaintext
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
```

### <font color="#1d50a2">show \{ip|ipv6\} protocol</font>

**\[Command]**
**show&#x20;**\{**ip**|**ipv6**}**&#x20;protocol**

**\[Purpose]**
Display IPv4/IPv6 protocol info.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
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
```

### <font color="#1d50a2">show pbr interface \[ethernet *interface\_name*|link-aggregation *lag-id*\] \[json\]</font>

**\[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]**

```plaintext
sonic# show pbr interface ethernet 0/0
  ethernet 0/0(15) with pbr-policy yd1
```

### <font color="#1d50a2">show pbr map \[pbr-map-name|json|detail\]</font>

**\[Command]**
**show pbr map&#x20;**\[*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]**

```plaintext
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: 10002
```

### <font color="#1d50a2">show pbr nexthop-groups \[next-group-name|json\]</font>

**\[Command]**
**show pbr nexthop-groups&#x20;**\[*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]**

```plaintext
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.2
```

## <font color="#1d50a2">Route Config</font>

<font color="#1d05a2">Table 2 Route Config</font>

| **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.                                                         |

### <font color="#1d50a2">ip route *A.B.C.D/M* \{*A.B.C.D*|*interface-type interface-name*\} \[OPTIONs\]</font>

**\[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]**

```plaintext
sonic# configure terminal
sonic(config)# ip route 20.0.0.0/24 10.0.0.57 description test
```

### <font color="#1d50a2">ipv6 route *X\:X\:\:X\:X/M* \{*X\:X\:\:X\:X*|*interface-type interface-name*\}</font> <font color="#1d50a2">\[OPTIONs\]</font>

**\[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]**

```plaintext
sonic# configure terminal
sonic(config)# ipv6 route 2001::2/96 2002::1 track 1
```

### <font color="#1d50a2">pbr-map *pbr-map-name* seq *seq-num*</font>

**\[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]**

```plaintext
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)#
```

### <font color="#1d50a2">match \{ dst-ip *dip*|dst-port *dport*|ip-protocol *ip-protocol*|src-ip *sip*|src-port *sport*\}</font>

**\[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]**

```plaintext
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)# match src-ip 1.2.1.1/32
sonic(config-pbr-map)#
```

### <font color="#1d50a2">set \{nexthop \{*A.B.C.D*|*X\:X\:\:X\:X*\}|nexthop-group *next-group-name*\}</font>

**\[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]**

```plaintext
sonic(config)# pbr-map pbrmap1 seq 1
sonic(config-pbr-map)# set nexthop 83.0.0.1
sonic(config-pbr-map)#
```

### <font color="#1d50a2">nexthop-group *next-group-name*</font>

**\[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]**

```plaintext
sonic(config)# nexthop-group nextgroup1
sonic(config-nh-group)#
```

### <font color="#1d50a2">nexthop \{*A.B.C.D*|*X\:X\:\:X\:X*\}</font>

**\[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]**

```plaintext
sonic(config)# nexthop-group nextgroup1
sonic(config-nh-group)# nexthop 82.0.0.1
sonic(config-nh-group)#
```

### <font color="#1d50a2">pbr-policy *pbr-map-name*</font>

**\[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]**

```plaintext
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# pbr-policy pbrmap1
sonic(config-if-0/0)#
```

