Networking – Fix ‘Device is Strictly Unmanaged’ and Make Static IP Work

22.04network-managernetworkingserverstatic-ip

I have a Ubuntu 22.04.2 LTS machine here that needs to be set with static IP address.

I followed the Linuxize tutorial for employing netplan, plus the StackExchange update on the new syntax to set /etc/netplan/01-netcfg.yaml as follows:

network:
    version: 2
    renderer: networkd
    ethernets:
        enp2s0f0:
            dhcp4: no
            addresses:
                - 172.16.86.3/24
            routes:
                - to: default
                    via: 172.16.86.2
            nameservers:
                addresses: [200.131.157.4, 8.8.8.8]

The file /etc/NetworkManager/NetworkManager.conf is like this:

[main]
plugins=ifupdown,keyfile
 
[ifupdown]
managed=true
 
[device]
wifi.scan-rand-mac-address=no

I've tried nmcli dev set enp2s0f0 managed yes

But nmcli device status still shows:

DEVICE      TYPE        STATE       CONNECTION
enp2s0f0    ethernet    unmanaged   --
enp2s0f1    ethernet    unmanaged   --
enp2s0f2    ethernet    unmanaged   --
enp2s0f3    ethernet    unmanaged   --
lo          loopback    unmanaged   --

And nmtui is of no help:

[Activate a connection]
[Ethernet connection 1]
 
Could not activate connection:
Connection 'Ethernet Connection
1' is not available on device
enp2s0f0 because device is
strictly unmanaged.
[OK]

So, what should I do to make device manageable? Is this what I need in order to make the static IP work, or I am acting on wrong assumptions?

Please add output of ip a.

Here it is:

1: lo:  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: enp2s0f0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:25:90:5a:[...] brd ff:ff:ff:ff:ff:ff
    inet 127.16.86.3/24 brd 172.16.86.255 scope global enp2s0f0
        valid_lft forever preferred_lft forever     
    inet6 fe80::255:90ff:fe5a:fe/64 scope link
        valid_lft forever preferred_lft forever 
3: enp2s0f1:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:25:90:5a:[...] brd ff:ff:ff:ff:ff:ff
4: enp2s0f2:  mtu 1500 qdisc noop state DOWN group default qlen 1000 
    link/ether 00:25:90:5a:[...] brd ff:ff:ff:ff:ff:ff
5: enp2s0f3:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:25:90:5a:[...] brd ff:ff:ff:ff:ff:ff

Best Answer

Your device is managed by networkd.

You've successfully setup a static IP as it is shown by ip a.

It shouldn't be managable by NetworkManager, because it is not used.

Related Question