Currently Empty: 0.00 €
Module 2 – Lab 2 – Configuring Switch Management
The computer science department at a college has purchased a switch with pre-installed SONiC and has tasked the students with configuring it. The students were tasked with renaming the hostname of this unit to “route2open” and configuring the IP address to 192.168.1.10 netmask 255.255.255.0. After the initial configuration is complete, the switch needs to be returned to its DHCP configuration.
There is an existing DHCP server in your management network with static ip address 192.168.1.200/24.
Step 1: Change the of the SW1 switch:
Log into the switch using the default credentials and change the hostname to “r2o-sw1”.
Step 2: Configuring a static IP address and physical port parameters:
Configure the IP address 192.168.1.10 and netmask 255.255.255.0 on the interface of the SW1 switch. Verify the configuration. Execute a ping command to the server to validate the connection.
Step 3: Back to DHCP configuration on port:
Configure the eth0 interface of switch SW1 for the DHCP server, to do this remove any static IP addresses (v4 and/or v6). Verify the configuration. Check if IP address you received from DHCP server is 192.168.1.20.
Execute a ping command to the server to validate the connection.
- The eth0 port is recognized as interface “Management 0” in SONIC.
- Default authentication is login: admin, passwords: YourPaSsWoRd
- The netmask is represented as a prefix after the IP address in SONiC NOS. To set the netmask to 255.255.255.0, use the prefix 24. For example, 192.168.1.10/24.
The purpose of this lab is to practice the manual method of configuring a network switch with SONiC.
After this exercise you will know how to change the hostname, set the IP address and also how to back to DHCP configuration.
You will find an example solution of this lab below.
Step 1: Change hostname of the SW1 switch:
1. sonic login: admin
2. Password:
3. Last login: Fri Apr 14 09:20:01 UTC 2023 on ttyS0
4. Linux sonic 4.19.0–9–2–amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
5. You are on
6. ____ ___ _ _ _ ____
7. / ___| / _ \| \ | (_)/ ___|
8. \___ \| | | | \| | | |
9. ___) | |_| | |\ | | |___
10. |____/ \___/|_| \_|_|\____|
11.
12. — Software for Open Networking in the Cloud —
13.
14. Unauthorized access and/or use are prohibited.
15. All access and/or use are subject to monitoring.
16.
17. Help: http://azure.github.io/SONiC/
18.
19. admin@sonic:~$ hostname
20. sonic
21. admin@sonic:~$ sonic–cli
22. sonic# configure terminal
23. sonic(config)# hostname r2o-sw1
24. sonic(config)#
25. Broadcast message: Hostname has been changed from ‘sonic’ to ‘ r2o-sw1‘. Users running ‘sonic-cli’ are suggested to restart your session.
To save the changes, restart the switch using the command:
sonic# sudo reboot
The result can already be seen after logging into the device, and the hostname command can also be used to verify.
1. r2o-sw1 login: admin
2. Password:
3. Last login: Fri Apr 14 09:20:01 UTC 2023 on ttyS0
4. Linux sonic 4.19.0–9–2–amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
5. You are on
6. ____ ___ _ _ _ ____
7. / ___| / _ \| \ | (_)/ ___|
8. \___ \| | | | \| | | |
9. ___) | |_| | |\ | | |___
10. |____/ \___/|_| \_|_|\____|
11.
12. — Software for Open Networking in the Cloud —
13.
14. Unauthorized access and/or use are prohibited.
15. All access and/or use are subject to monitoring.
16.
17. Help: http://azure.github.io/SONiC/
18.
19. admin@r2o-sw1:~$ hostname
20. r2o-sw1
Step 2: Configuring a static IP address and physical port parameters:
1. admin@r2o–sw1:~$ sonic–cli
2. r2o–sw1# configure terminal
3. r2o–sw1(config)# interface Management 0
4. r2o–sw1(conf–if–Ethernet0)# ip address 10.10.1.100/24
5. r2o–sw1(conf–if–Ethernet0)# no shutdown
6. r2o–sw1(conf–if–Ethernet0)# exit
Verify the IP address configuration on port eth0 on switch SW1
1. admin@r2o–sw1:~$ sonic–cli
2. r2o–sw1# configure terminal
3. r2o–sw1(config)# interface Management 0
4. r2o–sw1 (conf–if–eth0)# show configuration
5. !
6. interface Management 0
7. description Management0
8. mtu 1500
9. autoneg on
10. speed 1000
11. ip address 10.10.1.100/24
12. sonic(conf–if–eth0)# end
You can also use show ip interfaces command to display information about the IP configuration of network interfaces, including the IP addresses assigned to them, their status, and other relevant details.
1. r2o-sw1# show ip interfaces
2. Flags: U–Unnumbered interface, A–Anycast IP
3. —————————————————————————————————————-
4. Interface IP address/mask VRF Admin/Oper Flags
5. —————————————————————————————————————-
6. eth0 10.10.1.100/24 up/up
7. sonic(config)#
Execute a ping to the server to validate the connection.
1. r2o–sw1# ping 10.10.1.200
2. PING 10.10.1.200 (192.168.1.200) 56(84) bytes of data.
3. 64 bytes from 10.10.1.200: icmp_seq=1 ttl=64 time=0.191 ms
4. 64 bytes from 10.10.1.200: icmp_seq=2 ttl=64 time=0.079 ms
5. 64 bytes from 10.10.1.200: icmp_seq=3 ttl=64 time=0.033 ms
6. 64 bytes from 10.10.1.200: icmp_seq=4 ttl=64 time=0.043 ms
Step 3: Back to DHCP configuration on port eth0:
1. admin@r2o–sw1:~$ sonic–cli
2. r2o–sw1# configure terminal
3. r2o–sw1(config)# interface Management 0
4. r2o–sw1(conf–if–eth0)# no ip address
5. r2o–sw1(conf–if–eth0)# exit
6. r2o–sw1(config)# exit
Verify the IP address configuration on port eth0 on switch SW1
1. r2o–sw1(conf–if–eth0)# show configuration
2. !
3. interface Management 0
4. description Management0
5. mtu 1500
6. autoneg on
7. speed 1000
8. r2o–sw1 (conf–if–eth0)# exit
9. r2o–sw1(config)# exit
In this step, you can also use the show ip interfaces command to display the IP configuration information of the network interfaces. You will see what address has been assigned by the DHCP server. In this case it is 10.10.1.0
1. r2o-sw1# show ip interfaces
2. Flags: U–Unnumbered interface, A–Anycast IP
3. —————————————————————————————————————-
4. Interface IP address/mask VRF Admin/Oper Flags
5. —————————————————————————————————————-
6. eth0 10.10.1.15/24 up/up
7. r2o-sw1#
Execute a ping to the server to validate the connection.
1. r2o–sw1# ping 192.168.1.200
2. PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data.
3. 64 bytes from 192.168.1.200: icmp_seq=1 ttl=64 time=0.191 ms
4. 64 bytes from 192.168.1.200: icmp_seq=2 ttl=64 time=0.079 ms
5. 64 bytes from 192.168.1.200: icmp_seq=3 ttl=64 time=0.033 ms
6. 64 bytes from 192.168.1.200: icmp_seq=4 ttl=64 time=0.043 ms