RHCSA Practical Lab Series β Network Configuration
π 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 configurationipv4.addresses 192.168.250.100/24
β Assigns IP and subnet maskipv4.gateway 192.168.250.254
β Configures default gatewayipv4.dns 192.168.250.254
β Sets DNS serverautoconnect 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! π