Sonic_cli常用命令
阅读原文时间:2023年07月13日阅读:1

用户名:admin

密码:YourPaSsWoRd

//change password
1>admin@sonic:~$ passwd
Changing password for admin.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
2>
echo USER:$(LANG=C perl -e 'print crypt("PASSWORD", "salt"),"\n"') | sudo chpasswd -e
(USER:username,PASSWORD:password)
//no shutdown
root@sonic:/home/admin# config interface startup Ethernet0
//shutdown
root@sonic:/home/admin# config interface shutdown Ethernet0
//port link status
root@sonic:/home/admin# show interfaces status Ethernet0
//interface speed
root@sonic:/home/admin#config interface speed Ethernet0 10000
//check system eeprom
root@sonic:/home/admin# show platform syseeprom
Command: sudo decode-syseeprom
//check sensor info
root@sonic:/home/admin# sensors
//check version info
root@sonic:/home/admin# show version
//vlan config
root@sonic:/home/admin# config vlan add 4
//vlan port tagged/untagged
root@sonic:/home/admin# config vlan member add 4 Ethernet6
root@sonic:/home/admin# config vlan member add 4 Ethernet7 -u
// show vlan
root@sonic:/home/admin# show vlan config
//check PSU status
root@sonic:/home/admin# show platform psustatus
//check capebility
crm show thresholds all
//check current config
show runningconfiguration interfaces
//check transceivers
show interfaces transceiver eeprom --dom Ethernet0
root@sonic:/home/admin# show interfaces transceiver lpmode Ethernet1
root@sonic:/home/admin# sfputil show lpmode --port Ethernet0
root@sonic:/home/admin# show interfaces transceiver presence Ethernet0
//check port statistics
root@sonic:/home/admin# show interfaces transceiver presence Ethernet0
//enter bcmshell
root@sonic:/home/admin# bcmcmd "ps "
//show ip route
root@sonic:/home/admin# ip route show
//show port statistic
root@sonic:/home/admin# ip -s link
root@sonic:/home/admin# ip -s link ls Ethernet1
//set ip address
root@sonic:/home/admin# ip addr add 192.168.0.24/24 dev Ethernet2
//show ip address
root@sonic:/home/admin# ip addr show dev Ethernet2
//check sysmlog
show logging |more
//show psu status
root@sonic:/home/admin# psuutil status
//show transceiver eeprom
sfputil show eeprom
//show tranceiver present
root@sonic:/home/admin# sfputil show presence --port Ethernet0
root@sonic:/home/admin# sfputil show presence
//enable lpmode
root@sonic:/home/admin# sfputil lpmode on Ethernet1
//clear mac table
sonic-clear fdb all
//show mac table
root@sonic:/home/admin#fdbshow
root@sonic:/home/admin# show mac
>>how to create LAG portchannel using minigraph.xml file
1.root@sonic:/home/admin# vi /etc/sonic/minigraph.xml
PortChannel01 Ethernet112,Ethernet126 PortChannel03 Ethernet116
2.config save
3.show interface portchannel
root@sonic:/home/admin# show interfaces portchannel
Command: 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

root@sonic:/home/admin#
>>How to configuration using .json file
1.create a .json file
2.edit .json file
3.config load .json
example:
{
"VLAN": {
"vlan100": {
"vlanid": 100
},
"vlan200": {
"vlanid": 200
}

},
"VLAN_MEMBER": {

"vlan100|Ethernet1": {
"tagging_mode": "untagged"
},
"vlan200|Ethernet2": {
"tagging_mode": "tagged"

}

}

}
4.show vlan config

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章