Red Hat System Administration I · RH124

Chapter 17

Introduction to Networking

IPv4 basics · NetworkManager · nmcli and nmtui · Name resolution
CIS126RH — Mesa Community College
Describe basic IPv4 concepts, view current network configuration, and configure connections with NetworkManager's command-line and text-based tools.

Key Commands

  • ip addr
  • nmcli
  • nmtui
  • hostnamectl
  • ping

An IPv4 address is a 32-bit number written as four decimal groups, such as 192.168.1.50. A subnet mask separates the network portion from the host portion.

TermMeaning
IP addressUnique number that identifies a device on a network
Subnet maskShows which bits identify the network and which identify the host
CIDR notationShorthand for a subnet mask: /24 = 255.255.255.0
Default gatewayRouter that receives traffic for destinations outside the local network
DNS serverTranslates host names into IP addresses
Why It MattersMost network problems come down to one of these five settings being missing or wrong. Check them one at a time.

NetworkManager manages RHEL network connections: it detects interfaces, applies configuration, and keeps connections up.

ToolInterface
nmcliCommand-line, scriptable
nmtuiText-based menu UI, good for interactive use over SSH
GNOME SettingsGraphical, for desktop systems
Tip — Same Backend, Different DoorsA change made with one tool shows up in the others.
# Show all network interfaces and their IP addresses
ip addr show

# Shortened form of the same command
ip a

# Show just one interface
ip addr show eth0

# Show the routing table, including the default gateway
ip route show

# List NetworkManager connection profiles
nmcli connection show

# Show general device status (connected/disconnected, connection name)
nmcli device status
Note — Interface vs. ConnectionA device (such as eth0) is the interface. A connection is a saved profile applied to it. One device can have several profiles; usually one is active. Many RHEL systems name interfaces like ens3 or enp1s0.
# Configure a static IPv4 address, prefix, and gateway on a connection
nmcli connection modify eth0 ipv4.addresses 192.168.1.50/24
nmcli connection modify eth0 ipv4.gateway 192.168.1.1
nmcli connection modify eth0 ipv4.dns 192.168.1.1
nmcli connection modify eth0 ipv4.method manual

# Switch back to DHCP instead of a static address
nmcli connection modify eth0 ipv4.method auto

# Apply the changes by bringing the connection down and back up
nmcli connection down eth0
nmcli connection up eth0
Warning — Changes Don't Apply Until You Reactivatemodify updates only the saved profile. Bring the connection down and up, or reboot. Over SSH, changing your own connection's address will disconnect you.
# Launch the text-based network configuration menu
nmtui
  • Edit a connection
  • Activate or deactivate a connection
  • Set the system hostname

Navigate with the arrow keys and Tab; press Enter to select.

Tip — Know Bothnmtui suits quick interactive changes; nmcli suits scripts and automation.
# Show the current hostname and related system details
hostnamectl

# Set a new static hostname
sudo hostnamectl set-hostname server1.example.com

# Resolve a hostname to an IP address
getent hosts example.com

# View statically defined host entries
cat /etc/hosts
Note/etc/hosts is checked before DNS by default, so an entry there can override name resolution for testing.
# Test basic reachability to a host
ping server1.example.com

# Send only 4 packets, then stop
ping -c 4 server1.example.com

# Test whether a specific TCP port is reachable
curl -v telnet://server1.example.com:22
Tip — A Simple Troubleshooting OrderPing the gateway → ping an outside IP address → ping a hostname. Each step narrows the problem to local addressing, routing, or DNS.
IP address
Unique number assigned to a network device
subnet mask / CIDR
Defines the network portion of an address versus the host portion
default gateway
Router used to reach destinations outside the local network
NetworkManager
RHEL service that manages interfaces and connections
connection profile
Saved NetworkManager settings applied to a device
nmcli
Command-line tool for querying and configuring NetworkManager
nmtui
Text-based menu tool for configuring NetworkManager interactively
DNS
System that translates host names into IP addresses
  1. What does a subnet mask determine about an IP address?
  2. In NetworkManager, what is the difference between a device and a connection?
  3. What nmcli commands switch a connection named eth0 from static addressing back to DHCP and apply the change?
  4. Why might a change made with nmcli connection modify not seem to take effect immediately?
  5. Which command lets you configure networking through a menu during an SSH session?
  6. Which file statically maps a hostname to an IP address without involving DNS?
  7. A system can't reach a website by hostname. In what order would you troubleshoot?