-
Notifications
You must be signed in to change notification settings - Fork 1.1k
L2 Switch mode
SONiC switches are normally operated in Layer 3 Switch mode, however, they could also be operated as L2 Switch. This document will describe the basic features supported in L2 Switch mode. (Note: This page needs to be updated for multi-asic devices like Nexus 3164 )
Below is a sample command line. Please replace the eth0 and gwaddr values with correct management IP address and default gateway address.
cat <<EOF | sudo config reload /dev/stdin -y
{
"MGMT_INTERFACE": {
"eth0|10.3.147.46/23": {
"gwaddr": "10.3.146.1"
}
},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic"
}
}
}
EOF
If dual ToR configuration is required, use the following example:
cat <<EOF | sudo config reload /dev/stdin -y
{
"MGMT_INTERFACE": {
"eth0|10.3.147.46/23": {
"gwaddr": "10.3.146.1"
}
},
"DEVICE_METADATA": {
"localhost": {
"hostname": "sonic",
"subtype": "DualToR"
}
}
}
EOF
sudo sonic-cfggen -H --write-to-db
Below is a sample command line. User should provide a SKU parameter. The output file is on stdout for validation purpose.
sudo sonic-cfggen --preset l2 -p -H -k Mellanox-SN2700-D48C8
If dual ToR configuration is required, add the argument -a '{"is_dualtor": true, "uplinks": [<uplink interfaces as list>], "downlinks": [<downlink interfaces as list>]}'
as follows (any interfaces not specified as an uplink or downlink will be set to admin down):
sudo sonic-cfggen --preset l2 -p -H -k Mellanox-SN2700-D48C8 -a '{"is_dualtor": true, "uplinks": ["Ethernet24", "Ethernet28"], "downlinks": ["Ethernet0", "Ethernet4"]}'
Deprecated command for image 201811 (dual ToR configuration is not supported):
sonic-cfggen -t /usr/local/lib/python2.7/dist-packages/usr/share/sonic/templates/l2switch.j2 -p -k Mellanox-SN2700-D48C8
Below is a sample command line. User should provide a SKU parameter. Existing ConfigDB content not relating ports and VLAN will be kept.
sudo sonic-cfggen --preset l2 -p -H -k Mellanox-SN2700-D48C8 | sudo config load /dev/stdin -y
If dual ToR configuration is required, add the argument -a '{"is_dualtor": true, "uplinks": [<uplink interfaces as list>], "downlinks": [<downlink interfaces as list>]}'
(any interfaces not specified as an uplink or downlink will be set to admin down):
sudo sonic-cfggen --preset l2 -p -H -k Mellanox-SN2700-D48C8 -a '{"is_dualtor": true, "uplinks": ["Ethernet24", "Ethernet28"], "downlinks": ["Ethernet0", "Ethernet4"]}' | sudo config load /dev/stdin -y
Deprecated command for image 201811 (dual ToR not supported):
sonic-cfggen -t /usr/local/lib/python2.7/dist-packages/usr/share/sonic/templates/l2switch.j2 -p -k Mellanox-SN2700-D48C8 | sudo config load /dev/stdin -y
If dual ToR configuration has been applied, wait until show feature config mux
show the State
as enabled (this may take up to ~2 minutes):
admin@sonic:~$ show feature config mux
Feature State AutoRestart Owner
--------- ------- ------------- -------
mux enabled enabled local
Then save ConfigDB
sudo config save -y
If dual ToR configuration is required:
sudo config reload -y
Otherwise:
sudo systemctl restart swss
Port speed is initially specified in the minigraph or generated in L2 switch mode and load into ConfigDB. During runtime, we could config port speed by CLI. Below is a sample.
sudo config interface speed Ethernet0 40000
We could verify the port speed by CLI.
show interface status
Sample command line output:
admin@sonic:~$ show interface status
Interface Lanes Speed MTU Alias Oper Admin
----------- --------------- ------- ----- ------- ------ -------
Ethernet0 0,1,2,3 40G 9100 etp1 up up
Ethernet4 4,5,6,7 40G 9100 etp2 up up
Ethernet8 8,9,10,11 40G 9100 etp3 up up
Ethernet12 12,13,14,15 40G 9100 etp4 up up
Ethernet16 16,17,18,19 40G 9100 etp5 up up
Ethernet20 20,21,22,23 40G 9100 etp6 up up
Ethernet24 24,25,26,27 40G 9100 etp7 up up
Ethernet28 28,29,30,31 40G 9100 etp8 up up
Ethernet32 32,33,34,35 40G 9100 etp9 up up
Ethernet36 36,37,38,39 40G 9100 etp10 up up
Ethernet40 40,41,42,43 40G 9100 etp11 up up
Ethernet44 44,45,46,47 40G 9100 etp12 up up
Ethernet48 48,49,50,51 40G 9100 etp13 up up
Ethernet52 52,53,54,55 40G 9100 etp14 up up
Ethernet56 56,57,58,59 40G 9100 etp15 up up
Ethernet60 60,61,62,63 40G 9100 etp16 up up
Ethernet64 64,65,66,67 40G 9100 etp17 up up
Ethernet68 68,69,70,71 40G 9100 etp18 up up
Ethernet72 72,73,74,75 40G 9100 etp19 up up
Ethernet76 76,77,78,79 40G 9100 etp20 up up
Ethernet80 80,81,82,83 40G 9100 etp21 up up
Ethernet84 84,85,86,87 40G 9100 etp22 up up
Ethernet88 88,89,90,91 40G 9100 etp23 up up
Ethernet92 92,93,94,95 40G 9100 etp24 up up
Ethernet96 96,97,98,99 40G 9100 etp25 up up
Ethernet100 100,101,102,103 40G 9100 etp26 up up
Ethernet104 104,105,106,107 40G 9100 etp27 up up
Ethernet108 108,109,110,111 40G 9100 etp28 up up
Ethernet112 112,113,114,115 40G 9100 etp29 up up
Ethernet116 116,117,118,119 40G 9100 etp30 up up
Ethernet120 120,121,122,123 40G 9100 etp31 up up
Ethernet124 124,125,126,127 40G 9100 etp32 up up
If you want to know the port number of one interface, normally you can find it in the 'Alias' column. For example the interface Ethernet0 has port number 1.
By default, the active and standby ToRs for each port will be automatically determined at startup. To manually force a certain ToR to be active or standby for a specific port, use the command:
sudo config mux hwmode state <state> <port_name>
where
-
<state>
can be eitheractive
orstandby
-
<port_name>
can be eitherall
or any one interface name on the device connected to a mux cable.
-
For Users
-
For Developers
-
Subgroups/Working Groups
-
Presentations
-
Join Us