Sonic Commands
General commands
Layer 2 commands
Layer 3 commands
show // show command
ip // ip command
show ip route
ip route show // show ip route
ip -s link // show port statistics
ip -s link ls Ethernet1 // show port statistics
ip addr add 192.168.0.24/24 dev Ethernet2 // set ip address
ip addr show dev Ethernet2 // show ip address
system status
show logging //show system log
show logging | more //show system log
psuutil //psuutil command
sudo psuutil status //show psu status
sfputil //sfputil command
sudo sfputil show eeprom // show transceiver eeprom
shdo sfputil show presence // show transceiver present
sfputil show presence –port Ethernet0 // show transceiver present
enable lpmode/reset SFP transceiver/show version
sudo sfputil lpmode on Ethernet1 // enable lpmode
sudo sfputil reset Ethernet1 // enable lpmode
sudo sfputil version // enable lpmode
show/clear mac table
fdbshow // show mac table
show mac // show mac table
sonic-clear fdb all // clear mac table
How to create LAG portchannel using minigraph.xml file
vi /etc/sonic/minigraph.xml // create LAG portchannel
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<AttachTo>Ethernet112,Ethernet126</AttachTo>
<SubInterface/>
</PortChannel>
<PortChannel>
<Name>PortChannel03</Name>
<AttachTo>Ethernet116</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
[config save] // save configuration
show interfaces portchannel
show interfaces portchannel // show interfaces portchannel
teamshow
[teamshow]
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available, S - selected, D - deselected
No. Team Dev Protocol Ports
----- ------------- ----------- -------
01 PortChannel01 LACP(A)(Dw) N/A
03 PortChannel03 LACP(A)(Dw) N/A
configuration using .json file
- Create a myconfig.json file
- edit myconfig.json file
- config load myconfig.json
- config file example
{
"VLAN": {
"vlan100": {
"vlanid": 100
},
"vlan200": {
"vlanid": 200
}
},
"VLAN_MEMBER": {
"vlan100|Ethernet1": {
"tagging_mode": "untagged"
},
"vlan200|Ethernet2": {
"tagging_mode": "tagged"
}
}
}