Skip to content

Rocky Linux 9.6 Static IP Configuration Hands-on Record ​

Kubernetes Offline Deployment Package Creation Guide Diagram

A complete configuration process from DHCP to static IP, taking you step by step through Rocky 9.6 network settings.

Background ​

When configuring a Rocky Linux 9.6 server, the default DHCP network scheme often cannot meet production environment requirements. We need to change the network interface from automatically obtaining an IP to a static address, so as to fix the server's position in the network.

This article is based on a real configuration process, and the network card device is ens32.

Before and after configuration comparison ​

Before configuration — DHCP automatic acquisition ​

ini
[connection]
id=ens32
uuid=bf4982a2-6102-3e47-abb9-3670f1272538
type=ethernet
autoconnect-priority=-999
interface-name=ens32
timestamp=1783913471

[ethernet]

[ipv4]
method=auto

[ipv6]
addr-gen-mode=euip64
method=auto

[proxy]

Key points:[ipv4] in the paragraph method=auto Indicates that DHCP is used to automatically obtain an IP address.

After configuration — Static IP ​

ini
[connection]
id=ens32
uuid=bf4982a2-6102-3e47-abb9-3670f1272538
type=ethernet
autocomnect-priority=-999
interface-name=ens32
timestamp=1783913471

[ethernet]

[ipv4]
address1=172.16.3.223
gateway=172.16.0.1
method=manual

[ipv6]
addr-gen-mode=euie64
method=auto

[proxy]

Key changes:

Configuration itemBefore configurationAfter configuration
methodautomanual
address1None172.16.3.223
gatewayNone172.16.0.1

Operating steps ​

1. View current network adapter information ​

bash
nmcli d status

Confirm the network interface name is ens32.

2. 编辑配置文件 ​

The network card configuration file for Rocky 9.6 is located at:

bash
/etc/NetworkManager/system-connections/ens32.nmconnection

Use vim Editor:

bash
sudo vim /etc/NetworkManager/system-connections/ens32.nmconnection

3. Modify core parameters ​

will [ipv4] Change the paragraph to:

ini
[ipv4]
address1=172.16.3.223/24
gateway=172.16.0.1
dns=114.114.114.114;8.8.8.8
method=manual

Attention:address1 It is recommended to append the subnet mask prefix length afterward (e.g.,/24), otherwise the network segment may not be correctly identified.

4. Reload the configuration and activate it ​

bash
# Reload NetworkManager configuration
sudo nmcli con reload

# Reactivate network adapter connection
sudo nmcli con up ens32

5. Verify configuration ​

bash
# Check whether the IP has taken effect
ip a show ens32

# Test gateway connectivity
ping -c 4 172.16.0.1

# Test external network connectivity
ping -c 4 114.114.114.114

Pitfall Avoidance Guide ​

⚠️ Don't use systemctl restart network ​

Rocky 9.6 has deprecated traditional network-scripts, this command will report an error:

bash
systemctl restart network
# Failed to restart network.service: Unit network.service not found.

Please use consistently nmcli or nm-connection-editor Manage the network.

⚠️ Don't forget to enter the subnet mask ​

If address1 write as 172.16.3.223 rather than 172.16.3.223/24, NetworkManager may use by default /32 mask, causing the gateway to be unreachable.

⚠️ Sensitive configuration file permissions ​

NetworkManager requires the configuration file permissions to be 600(readable and writable only by root), otherwise this configuration will be ignored:

bash
sudo chmod 600 /etc/NetworkManager/system-connections/ens32.nmconnection

Summary ​

Comparison itemDHCP ConfigurationStatic IP configuration
Configuration file path/etc/NetworkManager/system-connections/ens32.nmconnectionSame
methodautomanual
Address must be entered manually❌✅
Suitable scenariosTemporary environment, desktopserver, production environment

Configuring a static IP is not complicated; the key is to pay attention to the new NetworkManager ecosystem in Rocky 9.6 and avoid the traditional network-scripts pitfalls. Hope this article helps you quickly get static IP configuration done.

Last updated on11/07/2026, 02:16 PM
@fishfinal | @fishfinals | [email protected]