RHCSA Practical Lab Series – Network Configuration

Expertise in Cloud, Networking & DevOps
Photo by Nathan Dumlao / Unsplash

πŸ” Lab 1: Configuring Network Settings in RHEL 9

πŸ“Œ Objective

Configure node1 with the following network settings:

  • Hostname: node1.cloudnetops.tech
  • IP Address: 192.168.250.100
  • Subnet Mask: 255.255.255.0 (/24)
  • Gateway: 192.168.250.254
  • DNS Server: 192.168.250.254

πŸ“Œ Step 1: Open Virtual Machine Console

Launch your RHEL 9 virtual machine using virt-manager:

[kiosk@foundation0 ~]$ virt-manager

πŸ“Œ Tip: If using KVM, ensure your virtual machine has a network adapter connected to the correct virtual network.

Login with root credentials:

Username: root  
Password: cloudnetops  

πŸ“Œ Tip: Using a strong password helps improve security, and setting up SSH keys is a better alternative than password authentication.


πŸ“Œ Step 2: Check Current Network Configuration

Before making changes, identify the active network connection:

[root@clear ~]$ nmcli con show

πŸ”Ή Expected output:

NAME                UUID                                  TYPE      DEVICE
Wired connection 1  a2b3c4d5-e6f7-890a-bcde-123456789012  ethernet  enp0s3

This command lists available network connections, including Wired connection 1 or a similar interface.

πŸ“Œ Tip: The DEVICE column shows the active network interface name, which may vary (e.g., ens192 or enp1s0).


πŸ“Œ Step 3: Configure Static IP Address

Modify the existing network connection to set a static IP, gateway, and DNS server:

[root@clear ~]$ nmcli con mod 'Wired connection 1' \
    ipv4.method manual \
    ipv4.addresses 192.168.250.100/24 \
    ipv4.gateway 192.168.250.254 \
    ipv4.dns 192.168.250.254 \
    autoconnect yes

πŸ”Ή Command breakdown:

  • ipv4.method manual β†’ Switches from DHCP to manual IP configuration
  • ipv4.addresses 192.168.250.100/24 β†’ Assigns IP and subnet mask
  • ipv4.gateway 192.168.250.254 β†’ Configures default gateway
  • ipv4.dns 192.168.250.254 β†’ Sets DNS server
  • autoconnect yes β†’ Ensures the connection starts on boot

βœ… Best Practice: Use nmcli con show after modification to confirm changes.


πŸ“Œ Step 4: Apply and Verify Network Configuration

Activate the new configuration:

[root@clear ~]$ nmcli con up 'Wired connection 1'

πŸ”Ή Expected output:

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)

πŸ”Ή Check if the new IP is assigned correctly:

[root@clear ~]$ ip a

πŸ”Ή Expected output (partial):

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.250.100/24 brd 192.168.250.255 scope global dynamic noprefixroute enp0s3

πŸ”Ή **Test connectivity by pinging the gateway and DNS server:

[root@clear ~]$ ping -c 4 192.168.250.254

πŸ”Ή Expected output:

64 bytes from 192.168.250.254: icmp_seq=1 ttl=64 time=0.657 ms
64 bytes from 192.168.250.254: icmp_seq=2 ttl=64 time=0.548 ms

βœ… Troubleshooting Tip: If the network doesn’t come up, check /etc/sysconfig/network-scripts/ for interface settings or restart the network:

[root@clear ~]$ systemctl restart NetworkManager

πŸ“Œ Step 5: Enable SSH and Connect Remotely

Now that networking is configured, try SSH access from foundation0:

[kiosk@foundation0 ~]$ ssh root@192.168.250.100

πŸ”Ή Expected output:

root@192.168.250.100's password:
Last login: Thu Mar 28 10:12:34 2024 from 192.168.250.1

βœ… If successful, you will be logged into the system.


πŸ“Œ Step 6: Configure Hostname

To make the hostname persistent:

[root@clear ~]$ hostnamectl set-hostname node1.cloudnetops.tech

πŸ”Ή Verify the hostname change:

[root@node1 ~]$ hostname

πŸ”Ή Expected output:

node1.cloudnetops.tech

πŸ“Œ Tip: Ensure that the hostname is reflected in /etc/hosts for proper resolution:

echo "192.168.250.100 node1.cloudnetops.tech node1" >> /etc/hosts

πŸ“Œ Step 7: Verify Network Configuration & Persistence

1️⃣ Check IP settings:

[root@node1 ~]$ ip a

πŸ”Ή Expected output should confirm the correct IP 192.168.250.100/24.

2️⃣ Check hostname:

[root@node1 ~]$ hostnamectl status

πŸ”Ή Expected output should display node1.cloudnetops.tech.

3️⃣ Check network connectivity:

[root@node1 ~]$ ping -c 4 8.8.8.8

πŸ”Ή Expected output should confirm internet access (if available).

4️⃣ Ensure changes persist after reboot:

[root@node1 ~]$ reboot

After rebooting, confirm that the IP and hostname remain correctly configured.


βœ… Final Summary

In this lab, you successfully:
βœ” Configured static IP, gateway, and DNS
βœ” Enabled and tested network connectivity
βœ” Allowed remote SSH access
βœ” Set a persistent hostname


πŸ“Œ Next Lab: Setting Up Your System to Use Default Repositories

πŸ“© Subscribe for more RHCSA exam labs and hands-on tutorials! πŸš€

Read more