ip addrnmclinmtuihostnamectlpingAn 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.
| Term | Meaning |
|---|---|
| IP address | Unique number that identifies a device on a network |
| Subnet mask | Shows which bits identify the network and which identify the host |
| CIDR notation | Shorthand for a subnet mask: /24 = 255.255.255.0 |
| Default gateway | Router that receives traffic for destinations outside the local network |
| DNS server | Translates host names into IP addresses |
NetworkManager manages RHEL network connections: it detects interfaces, applies configuration, and keeps connections up.
| Tool | Interface |
|---|---|
nmcli | Command-line, scriptable |
nmtui | Text-based menu UI, good for interactive use over SSH |
| GNOME Settings | Graphical, for desktop systems |
# 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
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
modify 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
Navigate with the arrow keys and Tab; press Enter to select.
nmtui 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
/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
nmcli commands switch a connection named eth0 from static addressing back to DHCP and apply the change?nmcli connection modify not seem to take effect immediately?