Managing Networking
Theory Questions
1. Determine which IP addresses belong to the same network given a subnet mask.
- Command(s):
ipcalc 192.168.4.210/24
- Why: The subnet mask (or CIDR prefix) divides an IP address into a network portion and a host portion. Performing a bitwise AND operation between the IP address and the subnet mask yields the network address. Hosts sharing the identical network address belong to the same local broadcast domain and can communicate directly without a router.
- Gotchas: Assuming hosts on different subnets (e.g.,
192.168.4.10/24and192.168.5.10/24) can talk without a default gateway configured. - Verify:
ipcalc 192.168.4.210/24 | grep Network
2. Identify which IP addresses are and are not private.
- Command(s):
ip addr show
-
Why: RFC 1918 designates three IPv4 address ranges exclusively for private network usage:
-
10.0.0.0/8(10.0.0.0–10.255.255.255) -
172.16.0.0/12(172.16.0.0–172.31.255.255) -
192.168.0.0/16(192.168.0.0–192.168.255.255) Any address outside these ranges (or CGNAT100.64.0.0/10/ loopback127.0.0.0/8) is classified as a public internet-routable IP address. -
Gotchas: Misidentifying
172.32.0.1or172.15.0.1as private IPs. Only172.16.0.0through172.31.255.255are private. -
Verify:
ip route get 8.8.8.8
3. Identify valid network interface names on a RHEL 9 system.
- Command(s):
ip link show
-
Why: RHEL 9 uses Predictable Network Interface Naming conventions based on hardware location, firmware, and PCI bus indices:
-
eno1: Onboard Ethernet device 1. -
enp2s0: Ethernet on PCI bus 2, slot 0. -
wlp3s0: Wireless interface on PCI bus 3, slot 0. -
eth0: Legacy kernel default interface name. -
Gotchas: Hardcoding
eth0in configuration scripts or commands when the virtual machine hardware enumerates the interface asenp1s0orveth*. -
Verify:
ls /sys/class/net
4. Display information about a network interface and its IP configuration.
- Command(s):
ip addr show enp1s0
# OR
nmcli device show enp1s0
- Why:
ip addr showdisplays hardware MAC addresses, assigned IPv4/IPv6 subnets, MTU, and link flags.nmcli device showprovides detailed NetworkManager metadata including DNS servers and domain search suffixes. - Gotchas: Using deprecated utilities like
ifconfig, which may not be installed by default on minimal RHEL installations. - Verify:
ip -4 addr show enp1s0
5. Evaluate statements about NetworkManager, identifying true and false claims.
- Command(s):
systemctl status NetworkManager
-
Statements Evaluation:
-
True: NetworkManager dynamically controls network interfaces and stores persistent profiles in keyfiles under
/etc/NetworkManager/system-connections/. -
True: Changes applied via
nmcli connection modifyupdate keyfile configurations on disk but requirenmcli connection upto activate runtime changes. -
False: NetworkManager configurations should be managed by editing
/etc/sysconfig/network-scripts/ifcfg-*files in RHEL 9. (Correction: Legacyifcfgscripts are deprecated in RHEL 9 in favor of INI-format keyfiles.) -
Why: Understanding NetworkManager’s modern architecture ensures compliance with current Enterprise Linux standards.
-
Gotchas: Attempting to install or use legacy
network-scriptspackages on RHEL 9/10. -
Verify:
nmcli --version
6. Find man page examples for nmcli usage.
- Command(s):
man nmcli-examples
- Why: Red Hat provides a dedicated man page (
nmcli-examples) containing syntactically correct examples for setting static IPs, creating team/bond interfaces, adding VLANs, and managing DNS. - Gotchas: Struggling to memorize complex
nmclisyntax during the exam instead of usingman nmcli-examples. - Verify:
man -k nmcli
7. Identify the text-based user interface for network connection properties.
- Command(s):
nmtui
- Why:
nmtui(NetworkManager Text User Interface) is a curses-based terminal application that allows administrators to interactively add, modify, or activate network connections and hostnames. - Gotchas: Exiting
nmtuiwithout navigating to “Activate a connection” to reload the modified profile. - Verify:
nmtui-edit
8. Set a fixed IP address to a connection using nmcli.
- Command(s):
nmcli connection modify "eth0" ipv4.addresses 192.168.4.210/24 ipv4.method manual
nmcli connection up "eth0"
- Why:
ipv4.addressesassigns the static IP/prefix, andipv4.method manualdisables dynamic DHCP assignment.nmcli connection upapplies the modified configuration into runtime memory. - Gotchas: Forgetting to set
ipv4.method manualwhen assigning a static IP; NetworkManager will continue attempting to request an IP via DHCP alongside the static address. - Verify:
ip addr show eth0
9. Identify recommended and non-recommended ways to specify DNS servers.
- Command(s):
# Recommended:
nmcli connection modify "eth0" ipv4.dns "8.8.8.8 1.1.1.1"
nmcli connection up "eth0"
-
Why:
-
Recommended: Setting DNS parameters inside NetworkManager connection profiles via
nmcliornmtui. NetworkManager automatically updates/etc/resolv.confpersistently. -
Non-Recommended: Editing
/etc/resolv.confmanually. -
Gotchas: Manually editing
/etc/resolv.confdirectly. NetworkManager will overwrite manual changes whenever the network interface restarts or dynamic leases refresh. -
Verify:
cat /etc/resolv.conf
10. Set the hostname in the correct configuration file.
- Command(s):
hostnamectl set-hostname server1.example.com
- Why:
hostnamectl set-hostnameupdates the static hostname in/etc/hostnameand notifies systemd-hostnamed to update runtime kernel structures immediately. - Gotchas: Editing
/etc/hostsexpecting it to change the system hostname./etc/hostsprovides local IP resolution, whereas/etc/hostnamedefines system identity. - Verify:
hostnamectl status
11. Calculate the network address from a given IP and CIDR prefix.
- Command(s):
ipcalc 192.168.4.210/24 | grep Network
- Why:
ipcalcperforms binary mask operations to output the base network ID, broadcast address, and host range. - Gotchas: Miscalculating non-standard CIDR boundaries (e.g.,
/27or/22) during manual bitwise math. - Verify:
ipcalc 192.168.4.210/24
12. Show link status without displaying the IP address.
- Command(s):
ip link show
# OR
nmcli device status
- Why:
ip link showdisplays Layer 2 link states (e.g.,UP,LOWER_UP, MAC address, MTU) without querying or listing Layer 3 IPv4/IPv6 addresses. - Gotchas: Confusing Layer 2 link availability (
ip link) with Layer 3 IP connectivity (ip addr). - Verify:
ip link show dev enp1s0
13. Diagnose why manually edited /etc/resolv.conf changes disappear after restart.
- Command(s):
cat /etc/resolv.conf | grep "Generated by"
- Why:
/etc/resolv.confis dynamically generated and managed by NetworkManager. Manual edits are discarded whenever NetworkManager re-evaluates active interface profiles or receives new DHCP leases. - Gotchas: Setting
rc-manager=unmanagedin NetworkManager to stop edits, which breaks automated DNS configuration for standard profiles. - Verify:
nmcli connection show "eth0" | grep ipv4.dns
14. Identify the file containing the hostname in RHEL 9.
- Path / Command:
/etc/hostname
- Why: Systemd reads
/etc/hostnameduring early system boot to initialize the kernel hostname (sysctl kernel.hostname). - Gotchas: Adding spaces or trailing invalid characters inside
/etc/hostname. - Verify:
cat /etc/hostname
15. Set the hostname using a simple command.
- Command(s):
hostnamectl set-hostname server1.example.com
- Why: Provides a single-command interface to update static, transient, and pretty hostnames persistently across reboots.
- Gotchas: Forgetting to log out and log back in (or restart the shell) to reflect the updated prompt hostname.
- Verify:
hostname
16. Locate where NetworkManager stores its generated configuration.
- Path / Command:
/etc/NetworkManager/system-connections/
- Why: In RHEL 9, connection profiles are stored as INI-format keyfiles in
/etc/NetworkManager/system-connections/<connection-name>.nmconnectionwith restricted permissions (0600). - Gotchas: Manually creating files in
/etc/NetworkManager/system-connections/without runningnmcli connection reloadand enforcing0600permissions. - Verify:
ls -la /etc/NetworkManager/system-connections/
17. Enable hostname resolution for a specific IP address.
- Command(s):
Add a mapping entry to
/etc/hosts:
echo "192.168.4.220 server2.example.com server2" >> /etc/hosts
- Why:
/etc/hostsprovides local static IP-to-hostname name resolution parsed prior to DNS server queries according to/etc/nsswitch.conf. - Gotchas: Placing hostname before the IP address in
/etc/hosts. The format must strictly be<IP_Address> <FQDN> [Alias...]. - Verify:
getent hosts server2.example.com
18. Determine whether non-administrator users can change NetworkManager connections.
- Command(s):
nmcli connection modify "eth0" ipv4.dns "8.8.8.8"
- Why: By default, Polkit policies restrict modification of system-wide NetworkManager connection profiles to administrative users (
rootor users withsudoprivileges). Standard unprivileged users are denied access unless explicit Polkit rules are configured. - Gotchas: Assuming standard users can modify network settings via
nmcliwithout administrative privileges. - Verify:
polkit-action --action-id org.freedesktop.NetworkManager.network-control
19. Verify the current status of the NetworkManager service.
- Command(s):
systemctl status NetworkManager
- Why: Displays systemd execution state, process ID, memory footprint, and recent journal log entries for NetworkManager.
- Gotchas: Checking
systemctl status network(the legacy network service does not exist in RHEL 9). - Verify:
systemctl is-active NetworkManager
20. Change the current IP address and default gateway on a network connection.
- Command(s):
nmcli connection modify "eth0" ipv4.addresses 192.168.4.210/24 ipv4.gateway 192.168.4.1 ipv4.method manual
nmcli connection up "eth0"
- Why:
ipv4.addressesupdates static host addressing,ipv4.gatewaydefines default routing table egress paths, andnmcli connection upapplies the keyfile changes live. - Gotchas: Changing IP settings over SSH without combining
modifyandupcommands properly, which can sever the active SSH session before execution completes. - Verify:
ip addr show eth0
ip route show
Lab Tasks
Networking Practice
Task 1: Set up server1.example.com and server2.example.com with proper FQDNs.
- Command(s):
# Execute on server1:
hostnamectl set-hostname server1.example.com
# Execute on server2:
hostnamectl set-hostname server2.example.com
# Update /etc/hosts on both nodes for local resolution:
cat << 'EOF' >> /etc/hosts
192.168.4.210 server1.example.com server1
192.168.4.220 server2.example.com server2
EOF
-
Why:
-
hostnamectl set-hostname: Sets persistent FQDNs in/etc/hostname. -
/etc/hosts: Ensures node names resolve reliably without external DNS dependencies. -
Gotchas: Setting short names (e.g.,
server1) instead of full FQDNs (server1.example.com) when explicitly requested. -
Verify:
hostnamectl status
ping -c 2 server2.example.com
Task 2: Configure primary network cards for DHCP and static IP assignment using nmtui or nmcli.
- Command(s):
# Option A: Interactive configuration via nmtui
nmtui
# Option B: CLI configuration via nmcli (Server 1 - Dual/Static IP setup):
nmcli connection modify "eth0" ipv4.method manual ipv4.addresses 192.168.4.210/24 ipv4.gateway 192.168.4.1 ipv4.dns "192.168.4.1"
nmcli connection up "eth0"
# CLI configuration (Server 2 - Static IP setup):
nmcli connection modify "eth0" ipv4.method manual ipv4.addresses 192.168.4.220/24 ipv4.gateway 192.168.4.1 ipv4.dns "192.168.4.1"
nmcli connection up "eth0"
-
Why:
-
ipv4.method manual: Ensures static IP bindings persist across system reboots. -
nmcli connection up: Commits modifications to runtime interface sockets. -
Gotchas: Forgetting to activate the connection after editing inside
nmtuior runningnmcli modify. -
Verify:
ip addr show eth0
Task 3: Verify bidirectional ping connectivity between server1 and server2.
- Command(s):
# Test from server1 to server2:
ping -c 4 192.168.4.220
ping -c 4 server2.example.com
# Test from server2 to server1:
ping -c 4 192.168.4.210
ping -c 4 server1.example.com
- Why: Validates complete Layer 3 IP routing and local hostname resolution between both endpoints.
- Gotchas: Local firewall rules blocking ICMP echo requests; if ping fails, check
firewall-cmd. - Verify:
ping -c 2 server2.example.com
(Output should show 0% packet loss)
Task 4: Configure the local DHCP server to provide default router and DNS servers for Internet access.
- Command(s):
# Install DHCP server package (if configuring DHCP service node):
dnf install -y dhcp-server
# Configure /etc/dhcp/dhcpd.conf:
cat << 'EOF' > /etc/dhcp/dhcpd.conf
option domain-name "example.com";
option domain-name-servers 8.8.8.8, 1.1.1.1;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.50 192.168.4.100;
option routers 192.168.4.1;
}
EOF
# Enable and start service:
systemctl enable --now dhcpd
# Open firewall port:
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --reload
-
Why:
-
option routers: Delivers default gateway addresses to DHCP clients. -
option domain-name-servers: Configures client DNS resolution endpoints dynamically upon lease acquisition. -
systemctl enable --now dhcpd: Ensures DHCP service starts automatically on system boot. -
Gotchas: Syntax errors in
/etc/dhcp/dhcpd.conf(such as missing trailing semicolons;) will preventdhcpdfrom starting. -
Verify & Reboot Persistence Test:
# Check DHCP server execution state:
systemctl status dhcpd
# Reboot system to confirm configuration persistence:
reboot
# Post-reboot check:
systemctl is-active dhcpd
nmcli connection show "eth0" | grep -E "IP4.ADDRESS|IP4.GATEWAY|IP4.DNS"
(Confirms NetworkManager settings and services remain active and persistent across system reboots)