用户名:admin
密码:YourPaSsWoRd
一、change password
admin@sonic:~$ passwd
Changing password for admin.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
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
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<AttachTo>Ethernet112,Ethernet126</AttachTo>
<SubInterface/>
</PortChannel>
<PortChannel>
<Name>PortChannel03</Name>
<AttachTo>Ethernet116</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
config save
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"
}