Always getting new connection after changing to static IP

Hello everybody,

I have a problem with reconfiguring the network connections. It was configured as Automatic (DHCP) and I need to change it to a static ip. This works fine so far (I mainly use nmtui for the reconfiguration), but after a restart the to a static ip reconfigured connection is disabled and a new dhcp connection got created and activated.

After the reconfiguration to the static ip before a reboot (the DHCP-Server is configured for the range .1 to .200) it looks like this:

[root@fedora ~]$ 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: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e4:b9:7a:f5:2e:8f brd ff:ff:ff:ff:ff:ff
    inet 172.28.1.201/16 brd 172.28.255.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever

[root@fedora ~]$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION
enp1s0  ethernet  connected  Wired Connection
lo      loopback  unmanaged  --

[root@fedora ~]$ nmcli connection
NAME              UUID                                  TYPE      DEVICE
Wired Connection  6f9c680d-efc2-4034-9000-17b11125072b  ethernet  enp1s0

After the reboot:

[root@fedora ~]$ 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: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e4:b9:7a:f5:2e:8f brd ff:ff:ff:ff:ff:ff
    inet 172.28.1.102/24 brd 172.28.1.255 scope global dynamic noprefixroute enp1s0
       valid_lft 431880sec preferred_lft 431880sec
    inet6 fe80::8af2:4d08:756c:cefd/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

[root@fedora ~]$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION
enp1s0  ethernet  connected  Wired Connection
lo      loopback  unmanaged  --

[root@fedora ~]$ nmcli connection
NAME              UUID                                  TYPE      DEVICE
Wired Connection  2c9ff020-d4c7-430a-8dbc-6f926742f23c  ethernet  enp1s0
Wired Connection  6f9c680d-efc2-4034-9000-17b11125072b  ethernet  --

[root@fedora ~]$ nmcli connection show --active
NAME              UUID                                  TYPE      DEVICE
Wired Connection  2c9ff020-d4c7-430a-8dbc-6f926742f23c  ethernet  enp1s0

You can see, that there is now a new acitve dynamic connection, and the former connection is still there but inactive. Under /etc/sysconfig/network-scripts/ is only the one connection with the static configuration.
I also tried to disable the NetworkManager service and rebooted, which results in that there is only the dynamic connection after a reboot. So not the NetworkManager is creating this connection?!
So can you tell me what is creating this new dynamic (DHCP) connection if not NetworkManager and how can I configure this correctly?

Thanks in advance for you help!

Regards,
Markus

Modify the connection profile and fix SELinux context:

sudo restorecon -R /etc
sudo nmcli connection modify id CON_NAME \
    connection.autoconnect "yes" \
    connection.interface-name "" \
    connection.permissions ""

If that doesn’t help, try to change the settings:

sudo tee /etc/NetworkManager/conf.d/00-custom.conf << EOF > /dev/null
[main]
plugins=keyfile
no-auto-default=*
EOF
sudo systemctl restart NetworkManager.service

If the issue persists, then post the output:

grep -v -e ^# -e ^$ /etc/NetworkManager/{,conf.d/}*.conf
sudo head -v -n -0 /etc/sysconfig/network-scripts/* \
    /etc/NetworkManager/system-connections/*

Hello vgaetera,

thank you very much for your answer. I deleted the connection with the dynamic configuration and activated the one with the static and tried your two suggestions, unfortunately it didn’t help. After a reboot, a new dynamic connection got created and was active.

So here are the outputs you wanted:

[root@fedora ~]$ grep -v -e ^# -e ^$ /etc/NetworkManager/{,conf.d/}*.conf
/etc/NetworkManager/NetworkManager.conf:[main]
/etc/NetworkManager/NetworkManager.conf:[logging]
/etc/NetworkManager/conf.d/00-custom.conf:[main]
/etc/NetworkManager/conf.d/00-custom.conf:plugins=keyfile
/etc/NetworkManager/conf.d/00-custom.conf:no-auto-default=*
[root@fedora ~]$ sudo head -v -n -0 /etc/sysconfig/network-scripts/* \
>     /etc/NetworkManager/system-connections/*
==> /etc/sysconfig/network-scripts/ifcfg-Wired_Connection <==
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=172.28.1.201
PREFIX=24
GATEWAY=172.28.1.252
DNS1=10.11.11.2
DNS2=10.20.32.50
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6_DISABLED=yes
IPV6INIT=no
NAME="Wired Connection"
UUID=a53faec6-6d48-4db1-acc6-cce111d5a4b7
ONBOOT=yes
MULTI_CONNECT=3

==> /etc/NetworkManager/system-connections/Wired Connection.nmconnection <==
[connection]
id=Wired Connection
uuid=d5baabc4-215f-459e-850c-d8b91444658b
type=ethernet
multi-connect=3
permissions=
timestamp=1600255769

[ethernet]
mac-address-blacklist=

[ipv4]
address1=172.28.1.201/16,172.28.1.252
dns=10.11.11.2;10.20.52.30;
dns-search=
may-fail=false
method=manual

[ipv6]
addr-gen-mode=eui64
dns-search=
method=disabled

[proxy]

[root@fedora ~]$ nmcli connection show --active
NAME              UUID                                  TYPE      DEVICE
Wired Connection  6f6e0cc6-3866-4468-9050-4e433807ea22  ethernet  enp1s0