Skip to content
Ask AI

VRF

Table 1 VRF View

CommandPurpose
show vrf briefDisplay VRF configuration.
show vrf interfaceDisplay the binding relationship between VRFs and interfaces.
show interface mgmt vrfDisplay VRF configuration of management port.

[Command] show vrf brief

[Purpose] Display VRF configuration.

[View] Privileged User View

[Use Cases]

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

[Command] show vrf interface

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

[View] Privileged User View

[Use Cases]

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

[Command] show interface mgmt vrf

[Purpose] Display VRF configuration of management port.

[View] Privileged User View

[Use Cases]

sonic# show interface mgmt vrf
ManagementVRF : Disabled

Table 2 VRF Config

CommandPurpose
vrf mgmtSet the VRF of mgmt.
vrf vrf_name (Global Configuration View)Create a VRF.
vrf vrf_name (Interface View)Bind the interface to the VRF.
mac HH:HH:HH:HH:HH:HHConfigure the MAC address of VRF.
ip route A.B.C.D/M A.B.C.DAdd routes for VRFs.

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

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

[Command] vrf vrf_name

[Purpose] Create a VRF.

[Parameters]

ParameterDescription
vrf_nameSpecify the VRF name, the default VRF is default.

[View] Global Configuration View

[Notes] Run command no vrf vrf_name to delete VRF

[Use Cases]

sonic# configure terminal
sonic(config)# vrf 123

[Command] vrf vrf_name

[Purpose] Bind the interface to the VRF.

[Parameters]

ParameterDescription
vrf_nameSpecify 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]

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

[Command] mac HH:HH:HH:HH:HH:HH

[Purpose] Configure the MAC address of VRF.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.

[View] VRF Configuration View

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

[Use Cases]

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

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

ParameterDescription
A.B.C.D/MSpecify the destination network segment for routing.
A.B.C.DSpecify the IP address of next hop of the route.
interface-typeThe next-hop interface type. Optional parameters include ethernet, vlan, and link-aggregation.
interface-nameNext-hop interface name.
distanceStatic route distance value,range from 1-255. Default value: 1.
descriptionSpecify the description for the route. In string form.
track_idTrack ID, range from [1,4294967295].
bfdConfigure static route and BFD linkage.
vrfName 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]

sonic# configure terminal
sonic(config)# vrf 123
sonic(config-vrf)# ip route 10.0.0.0/24 20.0.0.2