DHCP hijacks static IP and route in /etc/sysconfig/network

Hi, I have leap 15.3., I’ve been on dhcp, but now I want to switch to static IP only. So I did this:

me@opensuse:~> cat /etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static'
#ZONE=''
IPADDR='10.0.0.71'
MTU='1500'
NAME=''
NETMASK='255.255.255.128'
STARTMODE='auto'
USERCONTROL='no'
me@opensuse:~> cat /etc/sysconfig/network/routes
default 10.0.0.1 - -

Before editing resolv.conf, I have replaced NETCONFIG_DNS_POLICY=“auto” with “” in /etc/sysconfig/network/config like this:
NETCONFIG_DNS_POLICY=""
and placed in resolv.conf

me@opensuse:~> cat /etc/resolv.conf
nameserver 1.1.1.1
nameserver 1.0.0.1

Nonetheless IP and route settings in config files have no effect, everything is still replaced by dhcp. Settings I wrote into /etc/resolv.conf vaporised everytime I reboot, but I managed to resolve it by rm /etc/resolv.conf and creating it again, because it was a symlink to /run. I’m using NetworkManager instead of wicked, so I cannot edit network via yast, but even if I could, I’d like to manage that myself :wink: My interface is really eth0, not that enpwhatever.

Thank you.

Why didn’t you use the YaST module for this. There one of the items is to choose if you want to use DHCP and you can configure all the rest also there.

Which never used configuration files in /etc/sysconfig/network so your changes there are irrelevant.

I’d like to manage that myself

Use NetworkManager GUI provided by your desktop environment, use nmtui or nmcli or edit NetworkManager connection definitions directly. It is up to you. But you have to use tools and configuration files suitable for the program that manages your network.

Thank you, nmtui worked, I have no DE installed, only openbox. I’m using networkmanager, because it is on other distros too, and during install I can choose to use either wicked, or networkmanager. If I could, I’d not use any of them, but I don’t know how :shame:

Because yast is addictive, not available on other systems and I don’t want to get addicted :wink: