Chapter 12: Manage Networking

Welcome to my latest blog post in the series on Red Hat Enterprise Linux (RHEL) lab exercises! In this chapter, I will be discussing the important topic of network management. As a server administrator, networking is a crucial aspect of my job, and it involves configuring various settings and devices to ensure smooth communication between the server and other systems on the network. In this lab exercise, I will learn how to test and inspect the current network configuration using command-line utilities, manage network settings and devices with the nmcli command, and modify network configuration by editing configuration files. Additionally, I will learn how to configure a server's static hostname and name resolution and test the results to ensure everything is working as expected. By the end of this lab exercise, I will have a solid understanding of fundamental network addressing and routing concepts, and be able to confidently manage networking settings on a RHEL server. So, let's dive in and explore the world of networking on RHEL!

Question 1: Log in to the serverb machine as the student user. Switch to the root user.

Solution:

To complete the first step of the lab exercise, I logged in to the serverb machine as the student user using the command ssh student@serverb. Once I was logged in as the student user, I used the command sudo -i to switch to the root user. This allowed me to perform administrative tasks that require root privileges. Now that I am logged in as the root user, I can begin managing the network settings on the RHEL server.

Question 2: Create a connection with a static network configuration by using the settings in the table.

ParameterSettings
Connection namelab
Interface nameenX (might vary; use the interface with 52:54:00:00:fa:0b as its MAC address)
IP address172.25.250.11/24
Gateway address172.25.250.254
DNS address172.25.250.254

Solution:

To create a connection with a static network configuration using the settings provided in the table, I first used the command ip link to show the connections on the server. This allowed me to identify the interface name with the MAC address of 52:54:00:00:fa:0b, which I will use for the new connection. Next, I used the command nmcli con show --active to show the active connection, which was 'Wired connection 1'. Now, it's time to create a new connection with a static network configuration. To do this, I used the command nmcli con add con-name lab ifname en0 type ethernet ipv4.method manual ipv4.addresses 172.25.250.11/24 ipv4.gateway 172.25.250.254 ipv4.dns 172.25.250.254. In this command, I specified the connection name as 'lab', the interface name as 'en0' (replacing 'X' with the appropriate number), and the IP address, gateway address, and DNS address as specified in the table. This created a new connection with the specified static network configuration, which I can now use to communicate with other systems on the network.

Question 3: Configure the new connection to start automatically. Other connections should not start automatically.

Solution:

To configure the new connection to start automatically and prevent other connections from starting automatically, I used the nmcli con mod command. First, I used the command nmcli con mod "lab" connection.autoconnect yes to modify the 'lab' connection and allow it to start automatically. Next, I used the command nmcli con mod "Wired connection 1" connection.autoconnect no to modify the 'Wired connection 1' and prevent it from starting automatically. This ensured that only the 'lab' connection would start automatically when the system boots up, while all other connections would need to be manually activated. With these changes, I have successfully configured the new connection to start automatically and disabled the automatic startup of other connections, ensuring that the RHEL server's networking settings are configured as desired.

Question 4: Modify the new connection so that it also uses the IP address 10.0.1.1/24.

Solution:

To modify the 'lab' connection so that it uses both the existing IP address 172.25.250.11/24 and the new IP address 10.0.1.1/24, I used the nmcli con mod command. Specifically, I used the command nmcli con mod "lab" +ipv4.addresses 10.0.1.1/24 to add the new IP address to the existing connection configuration. Alternatively, I could have edited the configuration file for the 'lab' connection using a text editor such as vim. To do this, I would have used the command vim /etc/NetworkManager/system-connections/lab.nmconnection to open the configuration file for editing. Then, I would have added the line address2=10.0.1.1/24 to the file, which would have added the new IP address to the connection configuration. Either way, by adding the new IP address to the 'lab' connection configuration, I have successfully modified the connection to use both the existing IP address and the new IP address as required.

Question 5: Configure the hosts file so that you can reference the 10.0.1.1 IP address with the private name.

Solution:

To configure the hosts file to reference the 10.0.1.1 IP address with the private name, I used the command echo "10.0.1.1 private" >> /etc/hosts. This command appends the line "10.0.1.1 private" to the end of the hosts file, which maps the private name to the IP address. The hosts file is located at /etc/hosts, and it is a local file that maps hostnames to IP addresses. By adding this mapping to the file, I can now reference the 10.0.1.1 IP address using the private name, which makes it easier to manage and reference the connection in the future. With these changes, I have successfully configured the hosts file to reference the 10.0.1.1 IP address with the private name, and I can now use this name to reference the connection as needed.

Question 6: Reboot the system.

Solution: To reboot the system, I used the systemctl reboot command. This command initiates a system reboot, which will restart the system and apply any changes that have been made. After executing this command, the system will shut down and then automatically restart. It may take some time for the system to fully restart, especially if there are updates that need to be applied or if there are any issues that need to be resolved during the boot process. Once the system has rebooted, any changes that were made to the network configuration will take effect. In this case, the new network connection with the static IP address and other settings will be active, and I can use the private name to reference it as needed. With the system rebooted, I have successfully applied the changes to the network configuration and can now use the new connection with the desired settings.

Question 7: Verify that the serverb machine is initialized.

Solution:

To verify that the serverb machine is initialized and can be reached from the workstation server, I used the ping command. Specifically, I used the command ping -c3 serverb, which sends three packets to the serverb machine and waits for a response. If the serverb machine is properly initialized and can be reached over the network, it will respond to these packets and the ping command will report a successful connection. If there are any issues with the network configuration or the machine itself, the ping command may report errors or fail to connect. In this case, the ping command was successful and I was able to verify that the serverb machine is initialized and can be reached from the workstation server. This means that the changes made to the network configuration have been properly applied and are working as intended.

Conclusion

In this lab, I configured networking settings on a Red Hat Enterprise Linux server. By following the steps outlined in the lab instructions, I was able to create a new connection with a static network configuration, configure it to start automatically, modify it to use multiple IP addresses, and update the hosts file to reference the private IP address. Along the way, I used a variety of command-line utilities such as nmcli, ip, and ping to inspect and modify the network configuration, test connectivity, and verify that the changes were working as intended. Overall, this lab provided a great opportunity to learn more about network addressing and routing for a server, as well as how to use command-line utilities to manage networking settings and devices on a Linux system. What do you think? Did you find this lab helpful? Were there any parts that were particularly challenging or interesting? We would love to hear your thoughts and feedback in the comments below!