Linux Networking BasicsLinux TutorialsNekategorisano

CentOS Stream 10 Network Settings: Step-by-Step Guide to Configure Static IP, DNS

CentOS Stream 10 Network Settings are a crucial part of provisioning a reliable server. Whether you are deploying a new VM or converting an existing host to a static address, this guide provides clear, actionable steps using NetworkManager's nmcli and system tools for CentOS Stream 10. The tutorial covers setting the hostname, assigning a static IPv4 address and gateway, configuring DNS servers and search domains, verifying the interface state, and optionally disabling IPv6 at kernel boot time. Each command includes a realistic example output and a detailed explanation so you can validate and troubleshoot your network configuration confidently.

1. Prepare and verify network interfaces

Before making changes, identify the NetworkManager device name and confirm current connections. Device names vary across systems (for example enp1s0, ens3, eth0). Use nmcli to list devices and connections, then inspect interface details. This prevents accidental changes to the wrong interface and ensures you're modifying the correct connection profile.

nmcli device

DEVICE     TYPE      STATE         CONNECTION
enp1s0     ethernet  connected     enp1s0
lo         loopback  unmanaged     --

The nmcli device command lists detected network interfaces. “TYPE” indicates the interface type, “STATE” is the current state (connected, disconnected), and “CONNECTION” shows the NetworkManager profile attached to the device. Use the device name (here enp1s0) in subsequent nmcli operations.

2. Set the system hostname

Set a fully qualified domain name (FQDN) early in initial server setup. This affects system logs, certificates, and how services advertise themselves. Use hostnamectl to set the static hostname. After setting it, display the current hostnamectl status to confirm the change.

hostnamectl set-hostname dlp.srv.world

   Static hostname: dlp.srv.world
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 8f3a0b7d2a3b4f1a9c1a2b3c4d5e6f7a
           Boot ID: 5fa38690-3750-415e-99a3-155a720bc1bf
    Virtualization: kvm
  Operating System: CentOS Stream 10 (Coughlan)
       CPE OS Name: cpe:/o:centos:centos:10
            Kernel: Linux 6.12.0-32.el10.x86_64
      Architecture: x86-64

This output shows the configured static hostname and basic system metadata. The Static hostname line confirms the set-hostname operation succeeded.

3. Configure a static IPv4 address, gateway and DNS

NetworkManager stores settings per-connection. Instead of directly editing network-scripts, use nmcli to make persistent changes. Replace enp1s0 with your interface name. Below are the essential commands to set an IPv4 address, gateway, DNS servers, DNS search domains, and to switch the connection to static (manual) method. Apply the settings by bringing the connection up.

nmcli connection modify enp1s0 ipv4.addresses 10.0.0.30/24

Connection 'enp1s0' (3c1d3b5e-7f2a-4b3a-9a2b-7c6d5e4f3a2b) successfully updated.

This sets the primary IPv4 address and prefix length on the named connection profile. The UUID confirms which profile was updated.

nmcli connection modify enp1s0 ipv4.gateway 10.0.0.1

Connection 'enp1s0' (3c1d3b5e-7f2a-4b3a-9a2b-7c6d5e4f3a2b) successfully updated.

Defines the default IPv4 gateway for the connection profile. Packets to external networks will be routed via this address.

nmcli connection modify enp1s0 ipv4.dns "10.0.0.10 10.0.0.11"

Connection 'enp1s0' (3c1d3b5e-7f2a-4b3a-9a2b-7c6d5e4f3a2b) successfully updated.

Sets one or more DNS servers used by the connection. When specifying multiple servers, separate them by spaces inside the quoted string.

nmcli connection modify enp1s0 ipv4.dns-search srv.world

Connection 'enp1s0' (3c1d3b5e-7f2a-4b3a-9a2b-7c6d5e4f3a2b) successfully updated.

The dns-search option adds a default domain search suffix. This helps with short hostname resolution (for example, ping hostname will try hostname.srv.world).

nmcli connection modify enp1s0 ipv4.method manual

Connection 'enp1s0' (3c1d3b5e-7f2a-4b3a-9a2b-7c6d5e4f3a2b) successfully updated.

Switches the IPv4 method to manual, which tells NetworkManager to use the configured static settings rather than DHCP.

nmcli connection up enp1s0

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)

Brings the connection up and applies the modified profile. The confirmation line indicates activation via D-Bus and returns the active connection path.

4. Validate the applied network configuration

After activating the connection, inspect the connection details and the system's IP stack to verify addresses, routes and DNS entries are correct. Use nmcli device show and ip address show for comprehensive confirmation.

nmcli device show enp1s0

GENERAL.DEVICE:                         enp1s0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         52:54:00:ec:51:ad
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     enp1s0
IP4.ADDRESS[1]:                         10.0.0.30/24
IP4.GATEWAY:                            10.0.0.1
IP4.DNS[1]:                             10.0.0.10
IP4.DNS[2]:                             10.0.0.11
IP4.SEARCHES[1]:                        srv.world
IP6.ADDRESS[1]:                         fe80::5054:ff:feec:51ad/64

The nmcli device show output displays assigned IPv4 and IPv6 addresses, gateway and DNS servers; it confirms the active connection name and hardware information.

ip address show

1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: enp1s0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ec:51:ad brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global noprefixroute enp1s0
    inet6 fe80::5054:ff:feec:51ad/64 scope link

The ip address show output verifies the kernel's network interface state and address assignments. “state UP” shows the device is active; inet lines show IPv4/IPv6 addresses and prefix lengths.

5. Disable IPv6 at kernel boot (optional)

If your environment requires IPv6 to be disabled globally (legacy networks, application compatibility, or policy), you can add a kernel boot parameter to disable IPv6. On CentOS Stream 10 use grubby to update kernel parameters for all installed kernels. This change becomes effective after a reboot. Note: disabling IPv6 system-wide can affect link-local addresses and modern stacks—test thoroughly.

grubby --update-kernel ALL --args ipv6.disable=1

index=0 kernel="/boot/vmlinuz-6.12.0-32.el10.x86_64" args="ro resume=UUID=5fa38690-3750-415e-99a3-155a720bc1bf rd.lvm.lv=cs/root rd.lvm.lv=cs/swap console=ttyS0,115200n8 ipv6.disable=1" root="/dev/mapper/cs-root" initrd="/boot/initramfs-6.12.0-32.el10.x86_64.img $tuned_initrd" title="CentOS Stream (6.12.0-32.el10.x86_64) 10 (Coughlan)" id="13e0d866d1054d54a96f6690117098a8-6.12.0-32.el10.x86_64"

The grubby command with –update-kernel ALL –args ipv6.disable=1 appends the kernel argument to all configured kernel entries. The printed line shows the kernel entry and the final args field, confirming the change. Reboot is required to apply the new boot option.

reboot

Broadcast message from root@dlp.srv.world (pts/0) at 14:22 ...
The system is going down for reboot NOW!

After reboot, check the IP stack—IPv6 addresses should be absent (except possibly link-local addresses depending on kernel behavior) if the parameter took effect.

ip address show

1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: enp1s0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ec:51:ad brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global noprefixroute enp1s0

The absence of inet6 lines indicates IPv6 has been disabled at the kernel level. If you later decide to re-enable IPv6, remove the kernel argument using grubby and reboot.

grubby --update-kernel ALL --remove-args ipv6.disable

index=0 kernel="/boot/vmlinuz-6.12.0-32.el10.x86_64" args="ro resume=UUID=5fa38690-3750-415e-99a3-155a720bc1bf rd.lvm.lv=cs/root rd.lvm.lv=cs/swap console=ttyS0,115200n8" root="/dev/mapper/cs-root" initrd="/boot/initramfs-6.12.0-32.el10.x86_64.img $tuned_initrd" title="CentOS Stream (6.12.0-32.el10.x86_64) 10 (Coughlan)" id="13e0d866d1054d54a96f6690117098a8-6.12.0-32.el10.x86_64"

This grubby invocation removes the ipv6.disable argument from all kernel entries. Always inspect grub configuration and test after reboot to ensure expected behavior.

6. Troubleshooting and practical tips

Common pitfalls and remediations:
– Wrong connection profile: Use nmcli connection show to list profiles and ensure you modify the intended one.
– DNS resolution issues: Verify the systemd-resolved (if enabled) or /etc/resolv.conf points to expected nameservers. On CentOS Stream 10, NetworkManager often manages /etc/resolv.conf; verify it with cat /etc/resolv.conf.
– Firewall blocking services: When binding services to the new address, update firewalld zones or iptables rules to allow required ports.
– DHCP interference: If DHCP is active on the LAN and you set a manual IP duplicate addresses can occur. Coordinate with DHCP reservations or ensure the static IP is outside the DHCP pool.
– Persistency: Always use NetworkManager tools (nmcli or nmtui) for persistent changes, especially in cloud and VM environments where cloud-init or vendor tools may overwrite network settings.

Advanced tip: Use nmcli to export and version-control connection profiles. You can script nmcli connection import/export to standardize network settings across multiple servers.

Conclusion

Configuring CentOS Stream 10 network settings is straightforward with NetworkManager's nmcli and system tools like grubby for kernel-level tweaks. Use the steps in this guide to set a stable hostname, assign static IPv4 addresses, configure DNS and search domains, and optionally disable IPv6. Always validate each change with nmcli and ip commands and plan reboots when applying kernel boot parameters. Careful verification and documentation help prevent connectivity issues and make systems easier to maintain in production.

One Comment

  1. 1. Great walkthrough — the CentOS Stream 10 Network Settings steps with nmcli made configuring a static IP painless.
    2. Nice overview; I’d add a quick reminder to back up current connection profiles before switching to a static address.
    3. Does the guide show how to set up multiple DNS servers and search domains in CentOS Stream 10 Network Settings?
    4. Helpful article — consider adding a section on persistent routes and how they’re handled by NetworkManager on CentOS Stream 10.
    5. Clear and practical tips that I can apply right away.
    6. It would be great to include a short troubleshooting checklist for when nmcli doesn’t apply changes or NetworkManager fails to restart.

Odgovori na Charlotte Miller Poništi odgovor

Vaša email adresa neće biti objavljivana. Neophodna polja su označena sa *