Skip to content

Commit 0bdc3fd

Browse files
kannankvsjleveque
authored andcommitted
Add VRF-related commands to Command Reference Document (sonic-net#778)
1 parent 6d0dee0 commit 0bdc3fd

File tree

1 file changed

+219
-6
lines changed

1 file changed

+219
-6
lines changed

doc/Command-Reference.md

+219-6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
* [Reloading Configuration](#reloading-configuration)
5858
* [Loading Management Configuration](#loading-management-configuration)
5959
* [Saving Configuration to a File for Persistence](saving-configuration-to-a-file-for-persistence)
60+
* [Management VRF](#Management-VRF)
61+
* [Management VRF Show commands](#management-vrf-show-commands)
62+
* [Management VRF Config commands](#management-vrf-config-commands)
6063
* [Mirroring](#mirroring)
6164
* [Mirroring Show commands](#mirroring-show-commands)
6265
* [Mirroring Config commands](#mirroring-config-commands)
@@ -183,16 +186,16 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#basic-
183186
The management interface (eth0) in SONiC is configured (by default) to use DHCP client to get the IP address from the DHCP server. Connect the management interface to the same network in which your DHCP server is connected and get the IP address from DHCP server.
184187
The IP address received from DHCP server can be verified using the `/sbin/ifconfig eth0` Linux command.
185188

186-
SONiC does not provide a CLI to configure the static IP for the management interface. There are few alternate ways by which a static IP address can be configured for the management interface.
187-
1. Use the `/sbin/ifconfig eth0 ...` Linux command. NOTE: This configuration **will not** be preserved across reboots.
189+
SONiC provides a CLI to configure the static IP for the management interface. There are few ways by which a static IP address can be configured for the management interface.
190+
1. Use the `config interface ip add eth0` command.
188191
- Example:
189192
```
190-
admin@sonic:~$ /sbin/ifconfig eth0 10.11.12.13/24
193+
admin@sonic:~$ sudo config interface ip add eth0 20.11.12.13/24 20.11.12.254
191194
```
192195
2. Use config_db.json and configure the MGMT_INTERFACE key with the appropriate values. Refer [here](https://github.com/Azure/SONiC/wiki/Configuration#Management-Interface)
193196
3. Use minigraph.xml and configure "ManagementIPInterfaces" tag inside "DpgDesc" tag as given at the [page](https://github.com/Azure/SONiC/wiki/Configuration-with-Minigraph-(~Sep-2017))
194197

195-
Once the IP address is configured, the same can be verified using "/sbin/ifconfig eth0" linux command.
198+
Once the IP address is configured, the same can be verified using either `show management_interface address` command or the `/sbin/ifconfig eth0` linux command.
196199
Users can SSH login to this management interface IP address from their management network.
197200

198201
- Example:
@@ -2270,12 +2273,13 @@ The syntax for all such interface_subcommands are given below under each command
22702273
NOTE: In older versions of SONiC until 201811 release, the command syntax was `config interface <interface_name> interface_subcommand`
22712274
22722275
2273-
**config interface ip add <interface_name> <ip_addr> (Versions >= 201904)**
2276+
**config interface ip add <interface_name> <ip_addr> [default_gw] (Versions >= 201904)**
22742277
22752278
**config interface <interface_name> ip add <ip_addr> (Versions <= 201811)**
22762279
22772280
This command is used for adding the IP address for an interface.
2278-
IP address for either physical interface or for portchannel or for VLAN interface can be configured using this command.
2281+
IP address for either physical interface or for portchannel or for VLAN interface can be configured using this command.
2282+
While configuring the IP address for the management interface "eth0", users can provide the default gateway IP address as an optional parameter from release 201911.
22792283
22802284
22812285
- Usage:
@@ -2294,6 +2298,7 @@ IP address for either physical interface or for portchannel or for VLAN interfac
22942298
*Versions >= 201904*
22952299
```
22962300
admin@sonic:~$ sudo config interface ip add Ethernet63 10.11.12.13/24
2301+
admin@sonic:~$ sudo config interface ip add eth0 20.11.12.13/24 20.11.12.254
22972302
```
22982303
*Versions <= 201811*
22992304
```
@@ -2334,6 +2339,7 @@ VLAN interface names take the form of `vlan<vlan_id>`. E.g., VLAN 100 will be na
23342339
*Versions >= 201904*
23352340
```
23362341
admin@sonic:~$ sudo config interface ip remove Ethernet63 10.11.12.13/24
2342+
admin@sonic:~$ sudo config interface ip remove eth0 20.11.12.13/24
23372343
```
23382344
*Versions <= 201811*
23392345
```
@@ -3027,6 +3033,213 @@ Saved file can be transferred to remote machines for debugging. If users wants t
30273033
Go Back To [Beginning of the document](#) or [Beginning of this section](#loading-reloading-and-saving-configuration)
30283034
30293035
3036+
## Management VRF
3037+
3038+
### Management VRF Show commands
3039+
3040+
**show mgmt-vrf**
3041+
3042+
This command displays whether the management VRF is enabled or disabled. It also displays the details about the the links (eth0, mgmt, lo-m) that are related to management VRF.
3043+
3044+
- Usage:
3045+
```
3046+
show mgmt-vrf
3047+
```
3048+
3049+
- Example:
3050+
```
3051+
root@sonic:/etc/init.d# show mgmt-vrf
3052+
3053+
ManagementVRF : Enabled
3054+
3055+
Management VRF interfaces in Linux:
3056+
348: mgmt: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
3057+
link/ether f2:2a:d9:bc:e8:f0 brd ff:ff:ff:ff:ff:ff
3058+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master mgmt state UP mode DEFAULT group default qlen 1000
3059+
link/ether 4c:76:25:f4:f9:f3 brd ff:ff:ff:ff:ff:ff
3060+
350: lo-m: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue master mgmt state UNKNOWN mode DEFAULT group default qlen 1000
3061+
link/ether b2:4c:c6:f3:e9:92 brd ff:ff:ff:ff:ff:ff
3062+
3063+
NOTE: The management interface "eth0" shows the "master" as "mgmt" since it is part of management VRF.
3064+
```
3065+
3066+
**show mgmt-vrf routes**
3067+
3068+
This command displays the routes that are present in the routing table 5000 that is meant for management VRF.
3069+
3070+
- Usage:
3071+
```
3072+
show mgmt-vrf routes
3073+
```
3074+
3075+
- Example:
3076+
```
3077+
root@sonic:/etc/init.d# show mgmt-vrf routes
3078+
3079+
Routes in Management VRF Routing Table:
3080+
default via 10.16.210.254 dev eth0 metric 201
3081+
broadcast 10.16.210.0 dev eth0 proto kernel scope link src 10.16.210.75
3082+
10.16.210.0/24 dev eth0 proto kernel scope link src 10.16.210.75
3083+
local 10.16.210.75 dev eth0 proto kernel scope host src 10.16.210.75
3084+
broadcast 10.16.210.255 dev eth0 proto kernel scope link src 10.16.210.75
3085+
broadcast 127.0.0.0 dev lo-m proto kernel scope link src 127.0.0.1
3086+
127.0.0.0/8 dev lo-m proto kernel scope link src 127.0.0.1
3087+
local 127.0.0.1 dev lo-m proto kernel scope host src 127.0.0.1
3088+
broadcast 127.255.255.255 dev lo-m proto kernel scope link src 127.0.0.1
3089+
```
3090+
3091+
**show management_interface address**
3092+
3093+
This command displays the IP address(es) configured for the management interface "eth0" and the management network default gateway.
3094+
3095+
- Usage:
3096+
```
3097+
show management_interface address
3098+
```
3099+
3100+
- Example:
3101+
```
3102+
root@sonic:/etc/init.d# show management_interface address
3103+
Management IP address = 10.16.210.75/24
3104+
Management NetWork Default Gateway = 10.16.210.254
3105+
Management IP address = FC00:2::32/64
3106+
Management Network Default Gateway = fc00:2::1
3107+
```
3108+
3109+
**show snmpagentaddress**
3110+
3111+
This command displays the configured SNMP agent IP addresses.
3112+
3113+
- Usage:
3114+
```
3115+
show snmpagentaddress
3116+
```
3117+
3118+
- Example:
3119+
```
3120+
root@sonic-s6100-07:~# show snmpagentaddress
3121+
ListenIP ListenPort ListenVrf
3122+
---------- ------------ -----------
3123+
1.2.3.4 787 mgmt
3124+
```
3125+
3126+
**show snmptrap**
3127+
3128+
This command displays the configured SNMP Trap server IP addresses.
3129+
3130+
- Usage:
3131+
```
3132+
show snmptrap
3133+
```
3134+
3135+
- Example:
3136+
```
3137+
root@sonic-s6100-07:~# show snmptrap
3138+
Version TrapReceiverIP Port VRF Community
3139+
--------- ---------------- ------ ----- -----------
3140+
2 31.31.31.31 456 mgmt public
3141+
```
3142+
3143+
### Management VRF Config commands
3144+
3145+
**config vrf add mgmt**
3146+
3147+
This command enables the management VRF in the system. This command restarts the "interfaces-config" service which in turn regenerates the /etc/network/interfaces file and restarts the "networking" service. This creates a new interface and l3mdev CGROUP with the name as "mgmt" and enslaves the management interface "eth0" into this master interface "mgmt". Note that the VRFName "mgmt" (or "management") is reserved for management VRF. i.e. Data VRFs should not use these reserved VRF names.
3148+
3149+
- Usage:
3150+
```
3151+
config vrf add mgmt
3152+
```
3153+
3154+
- Example:
3155+
```
3156+
root@sonic-s6100-07:~# config vrf add mgmt
3157+
```
3158+
3159+
**config vrf del mgmt**
3160+
3161+
This command disables the management VRF in the system. This command restarts the "interfaces-config" service which in turn regenerates the /etc/network/interfaces file and restarts the "networking" service. This deletes the interface "mgmt" and deletes the l3mdev CGROUP named "mgmt" and puts back the management interface "eth0" into the default VRF. Note that the VRFName "mgmt" (or "management") is reserved for management VRF. i.e. Data VRFs should not use these reserved VRF names.
3162+
3163+
- Usage:
3164+
```
3165+
config vrf del mgmt
3166+
```
3167+
3168+
- Example:
3169+
```
3170+
root@sonic-s6100-07:~# config vrf del mgmt
3171+
```
3172+
3173+
**config snmpagentaddress add**
3174+
3175+
This command adds the SNMP agent IP address on which the SNMP agent is expected to listen. When SNMP agent is expected to work as part of management VRF, users should specify the optional vrf_name parameter as "mgmt". This configuration goes into snmpd.conf that is used by SNMP agent. SNMP service is restarted to make this configuration effective in SNMP agent.
3176+
3177+
- Usage:
3178+
```
3179+
config snmpagentaddress add [-p <port_num>] [-v <vrf_name>] agentip
3180+
```
3181+
3182+
- Example:
3183+
```
3184+
root@sonic-s6100-07:~#config snmpagentaddress add -v mgmt -p 123 21.22.13.14
3185+
3186+
For this example, configuration goes into /etc/snmp/snmpd.conf inside snmp docker as follows. When "-v" parameter is not used, the additional "%" in the following line will not be present.
3187+
3188+
agentAddress 21.22.13.14:123%mgmt
3189+
```
3190+
3191+
**config snmpagentaddress del**
3192+
3193+
This command deletes the SNMP agent IP address on which the SNMP agent is expected to listen. When users had added the agent IP as part of "mgmt" VRF, users should specify the optional vrf_name parameter as "mgmt" while deleting as well. This configuration is removed from snmpd.conf that is used by SNMP agent. SNMP service is restarted to make this configuration effective in SNMP agent.
3194+
3195+
- Usage:
3196+
```
3197+
config snmpagentaddress del [-p <port_num>] [-v <vrf_name>] agentip
3198+
```
3199+
3200+
- Example:
3201+
```
3202+
root@sonic-s6100-07:~#config snmpagentaddress del -v mgmt -p 123 21.22.13.14
3203+
3204+
```
3205+
3206+
**config snmptrap modify**
3207+
3208+
This command modifies the SNMP trap server IP address to which the SNMP agent is expected to send the traps. Users can configure one server IP addrss for each SNMP version to send the traps. When SNMP agent is expected to send traps as part of management VRF, users should specify the optional vrf_name parameter as "mgmt". This configuration goes into snmpd.conf that is used by SNMP agent. SNMP service is restarted to make this configuration effective in SNMP agent.
3209+
3210+
- Usage:
3211+
```
3212+
config snmptrap modify <snmp_version> [-p <port_num>] [-v <vrf_name>] [-c <community>] trapserverip
3213+
```
3214+
3215+
- Example:
3216+
```
3217+
root@sonic-s6100-07:~#config snmptrap modify 2 -p 456 -v mgmt 21.21.21.21
3218+
3219+
For this example, configuration goes into /etc/snmp/snmpd.conf inside snmp docker as follows. When "-v" parameter is not used, the additional "%" in the following line will not be present. In case of SNMPv1, "trapsink" will be updated, in case of v2, "trap2sink" will be updated and in case of v3, "informsink" will be updated.
3220+
3221+
trap2sink 31.31.31.31:456%mgmt public
3222+
3223+
```
3224+
3225+
**config snmptrap del**
3226+
3227+
This command deletes the SNMP Trap server IP address to which SNMP agent is expected to send TRAPs. When users had added the trap server IP as part of "mgmt" VRF, users should specify the optional vrf_name parameter as "mgmt" while deleting as well. This configuration is removed from snmpd.conf that is used by SNMP agent. SNMP service is restarted to make this configuration effective in SNMP agent.
3228+
3229+
- Usage:
3230+
```
3231+
config snmptrap del [-p <port_num>] [-v <vrf_name>] [-c <community>] trapserverip
3232+
```
3233+
3234+
- Example:
3235+
```
3236+
root@sonic-s6100-07:~#config snmptrap del -v mgmt -p 123 21.22.13.14
3237+
3238+
```
3239+
3240+
Go Back To [Beginning of the document](#) or [Beginning of this section](#management-vrf)
3241+
3242+
30303243
## Mirroring
30313244
30323245
### Mirroring Show commands

0 commit comments

Comments
 (0)