How to find out GATEWAY address for static ip setup in Rocky Linux?

TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="enp0s3"
UUID="bb5e5b01-946d-493e-b595-1891bb0bab19"
DEVICE="enp0s3"
ONBOOT="yes"
ETHTOOL_OPTS="autoneg on"
IPADDR="10.0.2.16"
NETMASK="255.255.255.240"
GATEWAY="10.0.2.230"
DNS1="8.8.8.8"
DNS2="8.8.4.4"

Then,

[root@server network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> 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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:7a:1d:85 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
       valid_lft 86101sec preferred_lft 86101sec
    inet6 fe80::a00:27ff:fe7a:1d85/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

It seems like rocky linux 9 is not recognizing the config file located at /etc/sysconfig/network-scripts/ifcfg-enp0s3, How do I make it recognize it. I was reading about it and learnt that things had changed in RL9. So, let's hope for help here.

Maybe it's using network manager. Check with

systemctl status NetworkManager

Try to import the legacy sysconfig files to a default connection:

nmcli connection reload
nmcli connection show
2 Likes

It could be that NetworkManager has an existing connection profile for this interface in /etc/NetworkManager/system-connections/. If it does, that would take precedence over your /etc/sysconfig/network-scripts/ legacy interface configuration file.

For more information on the NetworkManager connection profile keyfile format, see the following Red Hat documentation:

Chapter 26. NetworkManager connection profiles in keyfile format

Hope this helps !

1 Like