How to always assign a static IP address on Rocky Linux that remains regardless of link status?

Hi,

If in a link-down state, an IP address is not assigned by NetworkManager. I want to always assign a static IP address to my Ethernet device regardless of its link status."

To do that, I created ‘unmanaged.conf’ in /etc/NetworkManager/conf.d to amek it an unmanaged device.

[keyfile]
unmanaged-devices=mac:08:c0:eb:97:7b:ce

[root@pc ~] nmcli device status
DEVICE TYPE STATE CONNECTION
enp202s0f0np0 ethernet unmanaged –

And then, I careted ‘ifcfg-enp202s0f0np’ in /etc/sysconfig/netowork-scripts.

BOOTPROTO=static
ONBOOT=yes
DEVICE=enp202s0f0np0
NAME=enp202s0f0np0
IPADDR=192.168.203.40
NETMASK=255.255.255.0

However, the device still does not have an IP address. Please let me know what I have done wrong.

Thank you.

There is package NetworkManager-config-server, whose description is:

This adds a NetworkManager configuration file to make it behave more like the old “network” service. In particular, it stops NetworkManager from automatically running DHCP on unconfigured ethernet devices, and allows connections with static IP addresses to be brought up even on ethernet devices with no carrier.

This package is intended to be installed by default for server deployments.

1 Like

I resloved it thank you for your comment.

Thank you!