RHEL BasedRocky Linux

Rocky Linux 10 Network Configuration Guide

Rocky Linux 10 Network Configuration

Network configuration forms the backbone of any Linux system administration. Rocky Linux 10, as a robust enterprise-grade operating system and Red Hat Enterprise Linux alternative, provides powerful networking capabilities that system administrators must master. This comprehensive guide covers every aspect of network configuration in Rocky Linux 10, from basic interface management to advanced networking scenarios.

Rocky Linux 10 utilizes NetworkManager as its primary network management service, offering both command-line and graphical tools for configuration. Whether you’re setting up a single server or managing multiple network interfaces in complex enterprise environments, understanding these fundamental concepts will enhance your system administration capabilities and ensure reliable network connectivity.

Prerequisites and System Preparation

Before diving into network configuration procedures, ensure your Rocky Linux 10 system meets the necessary requirements. Root or sudo privileges are essential for modifying network settings, as these operations affect system-wide functionality.

Access your system through SSH, direct console, or virtual machine interface. Verify that you have administrative privileges by running sudo whoami, which should return “root”. If you encounter permission issues, contact your system administrator or use the su command to switch to the root user.

Essential Network Tools Installation

Rocky Linux 10 typically includes NetworkManager by default, but verify its presence and install additional utilities:

sudo dnf install NetworkManager NetworkManager-tui
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager

The ip command replaces older ifconfig utilities in modern Linux distributions. Familiarize yourself with these essential commands:

  • ip addr show – Display network interfaces and IP addresses
  • ip route show – View routing table information
  • nmcli – NetworkManager command-line interface
  • nmtui – NetworkManager text-based user interface

Understanding Network Interface Naming

Rocky Linux 10 employs predictable network interface names based on hardware characteristics. Traditional names like eth0 and eth1 are replaced with descriptive identifiers such as enp0s3 (Ethernet PCI slot 0, function 3) or ens18 (Ethernet system bus 18). This naming convention prevents interface name conflicts during hardware changes and provides consistent identification across system reboots.

Network Interface Discovery and Management

Effective network configuration begins with identifying available network interfaces and understanding their current states. Rocky Linux 10 provides multiple methods for interface discovery and management.

Discovering Network Interfaces

Execute the following command to display all network interfaces:

ip addr show

This command reveals interface names, MAC addresses, IP addresses, and interface states. Look for interfaces in “UP” state, which indicates active network connections. The “DOWN” state suggests disabled or disconnected interfaces.

Alternative discovery methods include:

nmcli device status
nmcli connection show

These NetworkManager commands provide additional information about connection profiles and device management states.

NetworkManager Service Management

NetworkManager serves as the central network management daemon in Rocky Linux 10. Proper service management ensures consistent network functionality:

# Check NetworkManager status
sudo systemctl status NetworkManager

# Start NetworkManager service
sudo systemctl start NetworkManager

# Enable NetworkManager at boot
sudo systemctl enable NetworkManager

# Restart NetworkManager service
sudo systemctl restart NetworkManager

NetworkManager automatically manages network connections, handles DHCP requests, and maintains connection profiles. The service integrates seamlessly with systemd, providing reliable network management across system restarts.

Interface State Management

Control individual network interfaces using NetworkManager commands:

# Bring interface up
sudo nmcli device connect enp0s3

# Bring interface down
sudo nmcli device disconnect enp0s3

# Show detailed interface information
nmcli device show enp0s3

Understanding interface states helps troubleshoot connectivity issues and manage network resources effectively.

DHCP Configuration Methods

Dynamic Host Configuration Protocol (DHCP) automatically assigns IP addresses, subnet masks, gateways, and DNS servers to network interfaces. DHCP configuration is ideal for environments where network parameters change frequently or manual IP management becomes impractical.

Command-Line DHCP Configuration with nmcli

The nmcli utility provides comprehensive command-line network management capabilities. Configure DHCP on a network interface using these steps:

# Create new DHCP connection
sudo nmcli connection add con-name "dhcp-connection" type ethernet ifname enp0s3

# Set IPv4 method to automatic (DHCP)
sudo nmcli connection modify "dhcp-connection" ipv4.method auto

# Enable automatic connection on boot
sudo nmcli connection modify "dhcp-connection" connection.autoconnect yes

# Activate the connection
sudo nmcli connection up "dhcp-connection"

Verify DHCP configuration success by checking the assigned IP address:

ip addr show enp0s3

GUI-Based DHCP Configuration with nmtui

NetworkManager Text User Interface (nmtui) provides an intuitive menu-driven approach for network configuration:

  1. Launch nmtui: sudo nmtui
  2. Select “Edit a connection”
  3. Choose your network interface or create a new connection
  4. Set IPv4 configuration to “Automatic”
  5. Enable “Automatically connect” option
  6. Save and activate the connection

The nmtui interface offers visual feedback and reduces command-line syntax errors, making it suitable for administrators who prefer graphical tools.

Legacy Configuration File Method

Although NetworkManager is preferred, understanding legacy configuration files remains valuable for troubleshooting and specialized scenarios:

# Edit interface configuration file
sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Add the following content for DHCP configuration:

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
DEVICE=enp0s3
ONBOOT=yes

Restart networking services after modifying configuration files:

sudo systemctl restart NetworkManager

Static IP Address Configuration

Static IP addresses provide consistent network identification and are essential for servers, network infrastructure devices, and systems requiring predictable network access. Proper static IP configuration prevents connectivity issues and ensures reliable network services.

Planning Static IP Configuration

Before implementing static IP addresses, gather the following network information:

  • IP address within your network range
  • Subnet mask (typically 255.255.255.0 for /24 networks)
  • Default gateway IP address
  • Primary and secondary DNS server addresses

Coordinate with network administrators to avoid IP address conflicts and ensure proper routing configuration.

nmcli Static IP Configuration

Configure static IP addresses using comprehensive nmcli commands:

# Create new static IP connection
sudo nmcli connection add con-name "static-connection" type ethernet ifname enp0s3

# Configure static IPv4 settings
sudo nmcli connection modify "static-connection" ipv4.method manual
sudo nmcli connection modify "static-connection" ipv4.addresses 192.168.1.100/24
sudo nmcli connection modify "static-connection" ipv4.gateway 192.168.1.1
sudo nmcli connection modify "static-connection" ipv4.dns "8.8.8.8,8.8.4.4"

# Enable automatic connection
sudo nmcli connection modify "static-connection" connection.autoconnect yes

# Activate the static connection
sudo nmcli connection up "static-connection"

Verify static IP configuration:

ip addr show enp0s3
ip route show

nmtui Static IP Setup Walkthrough

The NetworkManager text interface simplifies static IP configuration through guided menus:

  1. Execute sudo nmtui
  2. Select “Edit a connection”
  3. Choose your network interface
  4. Change IPv4 configuration from “Automatic” to “Manual”
  5. Enter IP address with CIDR notation (e.g., 192.168.1.100/24)
  6. Specify gateway address
  7. Add DNS servers separated by spaces
  8. Enable “Automatically connect”
  9. Save configuration and activate connection

Multiple Network Interface Configuration

Enterprise environments often require multiple network interfaces with different IP configurations. Manage multiple interfaces systematically:

# Configure first interface (LAN)
sudo nmcli connection add con-name "lan-connection" type ethernet ifname enp0s3
sudo nmcli connection modify "lan-connection" ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1

# Configure second interface (DMZ)
sudo nmcli connection add con-name "dmz-connection" type ethernet ifname enp0s8
sudo nmcli connection modify "dmz-connection" ipv4.method manual ipv4.addresses 10.0.1.100/24

# Activate both connections
sudo nmcli connection up "lan-connection"
sudo nmcli connection up "dmz-connection"

Advanced Network Configuration Options

Rocky Linux 10 supports sophisticated networking features that address complex infrastructure requirements. These advanced configurations enable VLAN segmentation, link aggregation, bridging, and custom routing scenarios.

VLAN Configuration

Virtual LAN (VLAN) configuration enables network segmentation and traffic isolation:

# Create VLAN interface on existing ethernet connection
sudo nmcli connection add type vlan con-name "vlan100" ifname enp0s3.100 dev enp0s3 id 100

# Configure VLAN IP settings
sudo nmcli connection modify "vlan100" ipv4.method manual ipv4.addresses 192.168.100.10/24

# Activate VLAN connection
sudo nmcli connection up "vlan100"

VLAN configuration requires compatible network switches and proper VLAN ID coordination across network infrastructure.

Network Interface Bonding

Link aggregation through bonding provides redundancy and increased bandwidth:

# Create bonding connection
sudo nmcli connection add type bond con-name "bond0" ifname bond0 bond.options "mode=active-backup,miimon=100"

# Add slave interfaces to bond
sudo nmcli connection add type ethernet slave-type bond con-name "bond0-slave1" ifname enp0s3 master bond0
sudo nmcli connection add type ethernet slave-type bond con-name "bond0-slave2" ifname enp0s8 master bond0

# Configure bond IP settings
sudo nmcli connection modify "bond0" ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1

# Activate bonding configuration
sudo nmcli connection up "bond0"

Bridge Interface Configuration

Bridge interfaces are essential for virtualization environments and container networking:

# Create bridge interface
sudo nmcli connection add type bridge con-name "br0" ifname br0

# Add ethernet interface to bridge
sudo nmcli connection add type ethernet slave-type bridge con-name "bridge-slave" ifname enp0s3 master br0

# Configure bridge IP settings
sudo nmcli connection modify "br0" ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1

# Activate bridge configuration
sudo nmcli connection up "br0"

Custom Routing Configuration

Advanced routing enables traffic steering and multi-homed network configurations:

# Add static route
sudo nmcli connection modify "static-connection" +ipv4.routes "10.0.0.0/8 192.168.1.254"

# Configure policy-based routing
sudo ip rule add from 192.168.1.0/24 table 100
sudo ip route add default via 192.168.1.254 table 100

Network Security and Firewall Integration

Network configuration directly impacts system security posture. Rocky Linux 10 integrates NetworkManager with firewalld to provide comprehensive network security management.

Firewalld Zone Management

Firewall zones define trust levels for network interfaces and connections:

# List available firewall zones
sudo firewall-cmd --get-zones

# Assign interface to specific zone
sudo firewall-cmd --zone=public --change-interface=enp0s3 --permanent

# Configure zone-specific services
sudo firewall-cmd --zone=public --add-service=ssh --permanent
sudo firewall-cmd --zone=public --add-service=http --permanent

# Reload firewall configuration
sudo firewall-cmd --reload

Network Security Best Practices

Implement security measures during network configuration:

  • Disable unused network interfaces to reduce attack surface
  • Configure secure DNS servers (avoid public DNS when possible)
  • Enable network logging for security monitoring
  • Regularly audit network configurations for unauthorized changes

IPv6 Configuration and Security

Modern networks require IPv6 configuration and security considerations:

# Enable IPv6 on interface
sudo nmcli connection modify "static-connection" ipv6.method auto

# Disable IPv6 if not required
sudo nmcli connection modify "static-connection" ipv6.method disabled

# Configure IPv6 privacy extensions
sudo nmcli connection modify "static-connection" ipv6.ip6-privacy 2

Troubleshooting and Validation

Effective troubleshooting methodologies help identify and resolve network configuration issues quickly. Rocky Linux 10 provides comprehensive tools for network diagnostics and problem resolution.

Network Connectivity Testing

Systematic connectivity testing isolates network problems:

# Test loopback connectivity
ping -c 4 127.0.0.1

# Test local network connectivity
ping -c 4 192.168.1.1

# Test internet connectivity
ping -c 4 8.8.8.8

# Test DNS resolution
nslookup google.com
dig google.com

Common Network Configuration Issues

Address frequent network problems systematically:

Interface Not Starting on Boot:

# Check connection autoconnect setting
nmcli connection show "connection-name" | grep autoconnect

# Enable autoconnect
sudo nmcli connection modify "connection-name" connection.autoconnect yes

IP Address Conflicts:

# Check for duplicate IP addresses
sudo arping -I enp0s3 192.168.1.100

# Release and renew DHCP lease
sudo nmcli connection down "dhcp-connection"
sudo nmcli connection up "dhcp-connection"

DNS Resolution Problems:

# Check DNS configuration
nmcli connection show "connection-name" | grep dns

# Test DNS servers individually
nslookup google.com 8.8.8.8
nslookup google.com 8.8.4.4

NetworkManager Logging and Debugging

Enable detailed logging for complex troubleshooting scenarios:

# Check NetworkManager logs
sudo journalctl -u NetworkManager -f

# Enable debug logging
sudo nmcli general logging level DEBUG

# Reset NetworkManager configuration
sudo systemctl restart NetworkManager

Performance Monitoring

Monitor network performance and identify bottlenecks:

# Display interface statistics
ip -s link show enp0s3

# Monitor network traffic
sudo netstat -i
sudo ss -tuln

# Test network bandwidth
iperf3 -c server-ip-address

Automation and Scripting

Network configuration automation reduces manual errors and ensures consistent deployments across multiple systems. Rocky Linux 10 supports various automation approaches for network management.

Bash Scripting for Network Configuration

Create reusable scripts for common network configuration tasks:

#!/bin/bash
# network-setup.sh - Automated network configuration script

INTERFACE="enp0s3"
IP_ADDRESS="192.168.1.100/24"
GATEWAY="192.168.1.1"
DNS_SERVERS="8.8.8.8,8.8.4.4"
CONNECTION_NAME="auto-static"

# Create static IP connection
nmcli connection add con-name "$CONNECTION_NAME" type ethernet ifname "$INTERFACE"
nmcli connection modify "$CONNECTION_NAME" ipv4.method manual
nmcli connection modify "$CONNECTION_NAME" ipv4.addresses "$IP_ADDRESS"
nmcli connection modify "$CONNECTION_NAME" ipv4.gateway "$GATEWAY"
nmcli connection modify "$CONNECTION_NAME" ipv4.dns "$DNS_SERVERS"
nmcli connection modify "$CONNECTION_NAME" connection.autoconnect yes

# Activate connection
nmcli connection up "$CONNECTION_NAME"

echo "Network configuration completed successfully"

Configuration Management Integration

Integrate network configuration with infrastructure automation tools:

  • Ansible playbooks for large-scale deployments
  • Puppet manifests for configuration management
  • Terraform for infrastructure as code
  • Docker networking for containerized environments

Develop standardized templates for consistent network deployments across different environments, ensuring reliable and repeatable configurations.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button