First Use
此内容尚不支持你的语言。
By default, the devices support login through both the serial console and SSH (Secure Shell).
When initially logging into the device, you will need to use the console port (referred to as the serial port below) to establish a connection. After configuring the management interface’s IP address, you can then use SSH to log into the device. Local login via the serial console is the fundamental method for accessing the device, and it forms the basis for configuring other login methods. The specific steps are as follows:
Connect the Lines
Section titled “Connect the Lines”This series of devices utilize RJ-45 connectors for serial console connections. The distribution of serial console ports varies among different models. Generally, they can be found on the front panel of the device, while some might be located on the rear panel, often marked with the label “CON.”
After the device is powered on, connect the device’s serial console port to a server or PC. It’s important to ensure that the communication parameter settings of the user terminal match the default configuration of the device’s serial console to establish communication. The default values for each parameter are as shown in the table below:
| Parameter | Default Value |
|---|---|
| Baud Rate | 115200 |
| Data Bits | 8 |
| Stop Bits | 1 |
| Parity | None |
Serial Port Login Device
Section titled “Serial Port Login Device”1.Initial Login via Console Port:
Connect to the device through the Console port. After pressing Enter, a login prompt will appear.
Welcome to minicom 2.7OPTIONS: I18nCompiled on Nov 15 2018, 20:18:47.Port /dev/ttyUSB1, 11:24:17Press CTRL-A Z for help on special keys
Debian GNU/Linux 9 sonic ttyS0sonic login:2.Logging into the Device with Default Credentials:
Username: admin
Password: asteros
Last login: Fri Mar 14 03:10:51 2025 from 192.168.51.235...Entering cli view, please wait...sonic#3.Configuring the Management Interface IP Address(Any port, with in band management):
sonic# configuresonic(config)# interface ethernet 1sonic(config-if-1)# ip address 30.1.1.2/24 30.1.1.14.Saving the Configuration:
sonic# writesave running-config...Existing files will be overwritten, continue? [y/N]: yRunning command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.jsonGetting Familiar with Using CISCO-LIKE Command Line
Section titled “Getting Familiar with Using CISCO-LIKE Command Line”How to Enter the Command Line View
Section titled “How to Enter the Command Line View”| Operation | Command | Description |
|---|---|---|
| Enter the CLI view | sonic cli | By default, upon logging into the device, you will automatically enter the command line view. |
| Exit the CLI view | system bash | Use the ‘exit’ command to return to the command line configuration interface. |
Common Keywords
Section titled “Common Keywords”| Keywords | Description |
|---|---|
| no | Cancel or disable a specific setting |
| show this | Display the current configuration of the current view |
| configure terminal | Enter the system configuration mode |
| delete | Delete a configuration file |
| reboot | Reboot the device |
| write | Save the current configuration |
| shutdown | Disable or turn off a port |
| exit | Exit to the previous level or log out |
Command Line Usage Assistance
Section titled “Command Line Usage Assistance”When entering an incomplete keyword, pressing the Tab or Space key will automatically complete the keyword.
If you encounter issues while using the command line, you can utilize the help function to get assistance, eliminating the need to memorize extensive and intricate commands.
While entering a command, pressing the Tab key will display a list of matching keywords. Entering ”?” will provide hints for relevant keywords or explanations of parameters.
sonic(config)#aaa acl anti-attack-check arp authenticationclock copp counters crm crm-resourcedhcp dot1x feature hash historyimage interface ipfix ipv4-source-check ipv6-source-checkl2-multicast-table license link-aggregation lldp local-usermac-address mac-flapping mac-learning mac-limit mclagmirror monitor-link nat nd ndpntp platform port-isolate-group portal ptpqos queue ra raguard running-configsavi sla snmp-agent snooping stpsub-interface supported-timezones synce syslog-storage-capacity systemtacacs traffic-behavior user-bind version vlanvrf vxlan ztp isis bfdroute-map-unused debugging ip bgp mplsipv6 evpn router-id logging nexthop-grouppathd vrrp
sonic# configure terminalsonic(config)# access-list l3 test ingress <tab><cr>sonic(config)# access-list l3 test <enter>Syntax error: The command is not completedsonic(config)# access-list l3 test1 ingresssonic(config-l3-acl-test1)# ?end Exit to the exec Modeexit Exit from current modeno Negate a command or set its defaultsrule Add an access list entryshow show running-config
sonic(config-l3-acl-test1)# rule ?rule ID (0..500)
sonic(config-l3-acl-test1)# rule 1 ?source-mac Specify source mac addressdestination-mac Specify destination mac addressethernet-type Specify ethernet protocol typeouter-vlan Specify outer VLAN idvlan-pri Specify outer VLAN priorityConfiguration File Management
Section titled “Configuration File Management”The configuration files for this series of devices are in JSON (JavaScript Object Notation) format. JSON is a lightweight data interchange format, and its file extension is typically .json.
Viewing Configuration File
Section titled “Viewing Configuration File”By default, the system configuration files are stored in the /etc/sonic directory. The default system configuration file is named config_db.json. When performing configuration saving or restoration operations, it’s this file that gets modified, determining the initial configuration upon the device’s next startup. Additionally, this directory also contains backups of configuration files, labeled with timestamps, which facilitates configuration recovery for users. Every time the “write” command is executed, a new config_db.json file is generated to save the current configuration, and the original file’s name is modified to the format config_bd+timestamp.
Configuration Saving
Section titled “Configuration Saving”After a user logs into the device, configurations made through command-line operations or other means are temporary. If you require persistent configurations, you should manually save the modified settings. This involves updating the current configuration to the default configuration file, config_db.json. If you don’t save the configurations, the device’s settings will revert to their state before modifications after a reboot.
| Operation | Command | Description |
|---|---|---|
| Save configuration | write |