Learn Rocky Linux - Networking & Hostname
Episode 9 of 23

Learn Rocky Linux - Networking & Hostname

This episode covers Rocky Linux network configuration with NetworkManager: static IP and DHCP connection profiles, hostname management, and bonding, VLANs, and bridges for more complex networks, complete with route concepts and configuration files.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In the previous episode 8, you made sure data is stored safely. Now it's time to make your system talk to the outside world. Networking is the communication language between servers, and on Rocky Linux that language is managed by NetworkManager — the service that manages all network interfaces, connections, IPs, DNS, and routes. Unlike other distros, configuration is done through connection profiles, not by directly writing /etc/network/interfaces or ifconfig. You'll mainly interact with it via nmcli, and by the end of the episode you'll be able to build bonds, VLANs, and bridges for real server needs.

NetworkManager and nmcli

Understanding the Concepts

NetworkManager distinguishes two concepts: device (a physical interface like eth0 or ens3) and connection profile (the logical configuration — IP, DNS, gateway — attached to a device). One device can have several profiles, but only one is active at a time.

Melihat device dan koneksi
nmcli device status
nmcli connection show

Static IP Configuration

For servers, a static IP is almost always chosen — you don't want the address to change every boot. Creating a new profile is very declarative:

Membuat koneksi IP statis
nmcli connection add type ethernet con-name server-eth ifname eth0 \
  ipv4.method manual \
  ipv4.addresses 192.168.1.100/24 \
  ipv4.gateway 192.168.1.1 \
  ipv4.dns "1.1.1.1 8.8.8.8"
Mengaktifkan koneksi
nmcli connection up server-eth

Using DHCP

For environments where addresses are assigned automatically — such as a lab or a simple network — set the method to auto:

Beralih ke DHCP
nmcli connection modify server-eth ipv4.method auto
nmcli connection up server-eth
Melihat IP yang diterima
nmcli -f IP4.ADDRESS device show eth0
ip addr

The Interactive Alternative with nmtui

If you prefer a text interface, nmtui provides interactive menus for editing connections:

Membuka editor jaringan teks
nmtui

Hostname and DNS

Managing the Hostname

The hostname identifies the server on the network. Change it with hostnamectl:

Melihat hostname saat ini
hostnamectl
Mengatur hostname baru
hostnamectl set-hostname web01.internal.example.com
Memverifikasi perubahan
hostname
hostname -f

A fully qualified hostname (FQDN) matters for many services — TLS in episode 16 even depends on a correct name.

Info

A correct hostname solves many mysterious server problems: services that refuse to work, certificates that don't match, and confusing logs often stem from a wrong or inconsistent hostname.

Bonding, VLANs, and Bridges

Bonding for Redundancy

Bonding combines two NICs into one logical connection — for greater throughput or redundancy when one NIC fails:

Membuat bond dari dua NIC
nmcli connection add type bond con-name bond0 ifname bond0 \
  bond.options "mode=active-backup,miimon=100"
 
nmcli connection add type ethernet con-name bond0-slave1 \
  ifname eth0 master bond0
nmcli connection add type ethernet con-name bond0-slave2 \
  ifname eth1 master bond0
 
nmcli connection up bond0
Melihat status bond
cat /proc/net/bonding/bond0

The active-backup mode makes one NIC active and one standby — if the active one fails, traffic moves automatically without intervention.

VLANs for Isolation

VLANs split one physical switch into several logical networks. Server-side configuration involves VLAN tags:

Membuat interface VLAN
nmcli connection add type vlan con-name vlan100 ifname eth0.100 \
  dev eth0 id 100 \
  ipv4.method manual ipv4.addresses 10.10.10.10/24
Aktifkan VLAN
nmcli connection up vlan100

Bridges for Virtualization

A bridge connects VMs and containers directly to the physical network — the key to the virtualization in episode 19. When a container runs in bridge mode, it receives an IP address from the same network as the host:

Membuat bridge
nmcli connection add type bridge con-name br0 ifname br0 \
  ipv4.method manual ipv4.addresses 192.168.1.50/24
 
nmcli connection add type ethernet con-name br0-port \
  ifname eth0 master br0

Routes and Decision Making

Viewing Routes

The path of outgoing packets is determined by the route table:

Melihat tabel route
ip route
Menambah route statis
nmcli connection modify server-eth +ipv4.routes "10.0.0.0/8 192.168.1.1"
nmcli connection up server-eth

Policy Routing

For advanced scenarios, policy routing (ip-rules) selects routes based on criteria other than the destination:

Menambah rule berbasis source
ip rule add from 10.10.10.0/24 lookup 100
ip route add default via 192.168.5.1 table 100

This model is used when there are multiple uplinks and you want to direct traffic based on origin — a common pattern in hosting environments.

Network Configuration Files

The System-Connections Directory

All profiles created with nmcli are stored as INI files in /etc/NetworkManager/system-connections/:

Melihat profil koneksi
ls -l /etc/NetworkManager/system-connections/
Membaca satu profil
cat /etc/NetworkManager/system-connections/server-eth.nmconnection

These files contain [connection], [ipv4], and [ipv6] sections that mirror exactly the nmcli options you provided. Important: these files contain encryption keys for certain connections, so restrict read access.

nmcli vs Legacy network-scripts

Legacy RHEL distros managed networking via files in /etc/sysconfig/network-scripts/. Rocky Linux has fully moved to NetworkManager, and that legacy directory is no longer needed. This design centralizes all network management in a single service — networkmanager — which is more consistent and integrated with systemd.

Memeriksa layanan NetworkManager
systemctl status NetworkManager

Warning

Don't modify network configuration directly in legacy files while NetworkManager is running — changes will be overwritten or ignored. Always use nmcli, nmtui, or files in system-connections through the supported mechanisms.

Closing

In this episode 9, you mastered Rocky Linux networking: the NetworkManager device and connection profile concepts, static IP and DHCP configuration with nmcli, hostname management with hostnamectl, bonding for redundancy, VLANs for isolation, bridges for virtualization, static routes and policy routing, and the configuration file structure in system-connections.

Key takeaways:

  • NetworkManager manages networking through connection profiles; use nmcli or nmtui.
  • A static IP with nmcli connection add is the standard for servers.
  • The hostname is set with hostnamectl set-hostname and matters for many services.
  • Bonding gives redundancy, VLANs give isolation, and bridges connect VMs to the physical network.
  • All configuration lives in /etc/NetworkManager/system-connections/; avoid legacy files.

In the next episode 10, we will discuss the kernel, boot process, and kernel modules — the journey from UEFI to GRUB2 to systemd, kernel management with grubby, sysctl configuration, module loading and unloading, and recovery mode and initramfs regeneration with dracut. The network is connected; now it's time to understand the machine that powers everything!