---
title: VRF
slug: aidc/vrf
createdAt: 2025-12-01T11:11:07.000Z
---

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

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

| **Command**                 | **Purpose**                                                   |
| --------------------------- | ------------------------------------------------------------- |
| **show vrf brief**          | Display VRF configuration.                                    |
| **show vrf interface**      | Display the binding relationship between VRFs and interfaces. |
| **show interface mgmt vrf** | Display VRF configuration of management port.                 |

### <font color="#1d50a2">show vrf brief</font>

**\[Command]**
**show vrf brief**

**\[Purpose]**
Display VRF configuration.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vrf brief
+------------+-------+-----------+
|   vrf name | vni   | src_mac   |
+============+=======+===========+
|        100 |       |           |
+------------+-------+-----------+
|        101 |       |           |
+------------+-------+-----------+
|        200 | 2000  |           |
+------------+-------+-----------+
```

### <font color="#1d50a2">show vrf interface</font>

**\[Command]**
**show vrf interface**

**\[Purpose]**
Display the binding relationship between VRFs and interfaces.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vrf interface
+------------+--------------+
|   vrf name | interfaces   |
+============+==============+
|        200 | vlan 227     |
|            | vlan 237     |
+------------+--------------+
|        101 | loopback 1   |
+------------+--------------+
```

### <font color="#1d50a2">show interface mgmt vrf</font>

**\[Command]**
**show interface mgmt vrf**

**\[Purpose]**
Display VRF configuration of management port.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show interface mgmt vrf
ManagementVRF : Disabled
```

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

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

| **Command**                                                                  | **Purpose**                       |
| ---------------------------------------------------------------------------- | --------------------------------- |
| **vrf mgmt**                                                                 | Set the VRF of mgmt.              |
| **vrf** *vrf\_name* <font color="#1d05a2">(Global Configuration View)</font> | Create a VRF.                     |
| **vrf** *vrf\_name* <font color="#1d05a2">(Interface View)</font>            | Bind the interface to the VRF.    |
| **mac** *HH\:HH\:HH\:HH\:HH\:HH*                                             | Configure the MAC address of VRF. |
| **ip route** *A.B.C.D/M* *A.B.C.D*                                           | Add routes for VRFs.              |

### <font color="#1d50a2">vrf mgmt</font>

**\[Command]**
**vrf mgmt**

**\[Purpose]**
Set the VRF of mgmt.

**\[View]**
Management Port Configuration View

**\[Notes]**
Run command **no vrf mgmt** to delete Management Interface VRF configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface mgmt 0
sonic(config-mgmt-0)# vrf mgmt
```

### <font color="#1d50a2">vrf *vrf\_name* (Global Configuration View)</font>

**\[Command]**
**vrf** *vrf\_name*

**\[Purpose]**
Create a VRF.

**\[Parameters]**

| **Parameter** | **Description**                                   |
| ------------- | ------------------------------------------------- |
| *vrf\_name*   | Specify the VRF name, the default VRF is default. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no vrf** *vrf\_name* to delete VRF

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vrf 123
```

### <font color="#1d50a2">vrf *vrf\_name* (Interface View)</font>

**\[Command]**
**vrf** *vrf\_name*

**\[Purpose]**
Bind the interface to the VRF.

**\[Parameters]**

| **Parameter** | **Description**                                   |
| ------------- | ------------------------------------------------- |
| *vrf\_name*   | Specify the VRF name, the default VRF is default. |

**\[View]**
Physical Interface/VLANIF/LAGIF/Loopback Interface Configuration View

**\[Notes]**
Loopback0 is not allowed to bind VRFs.
Run command **no vrf** Unbind the interface from the VRF.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface loopback 1
sonic(config-loif-1)# vrf 123
```

### <font color="#1d50a2">mac *HH\:HH\:HH\:HH\:HH\:HH*</font>

**\[Command]**
**mac** *HH\:HH\:HH\:HH\:HH\:HH*

**\[Purpose]**
Configure the MAC address of VRF.

**\[Parameters]**

| **Parameter**            | **Description** |
| ------------------------ | --------------- |
| *HH\:HH\:HH\:HH\:HH\:HH* | MAC address.    |

**\[View]**
VRF Configuration View

**\[Notes]**
Run command **no mac** to delete VRF MAC address configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vrf 123
sonic(config-vrf)# mac 00:a0:23:12:23:53
```

### <font color="#1d50a2">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*\]</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 static routes for VRF.

**\[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]**
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)# vrf 123
sonic(config-vrf)# ip route 10.0.0.0/24 20.0.0.2
```

