Score:0

Can't change default connection in Network Manager

at flag
egg

I know that ubuntu-server uses networkd by default but some features of gnome doesn't play well with it so I'm trying to replace with Network Manager. The problem is that Network Manager's default connection doesn't give access to internet (it has a non-automatic ipv4 configuration), I tried to edit it and create new connections with higher priorities but after reboot the same default connection appears and is used again.

NAME            UUID                                  TYPE      DEVICE 
enp0s3          24ba6c77-1bee-4bf6-a4d5-dfcds9e8f5d37  ethernet  enp0s3 
enp0s3          170f0ded-562e-e99b-b9a8-e66be0s63bdb1  ethernet  --     
my_connection   df453bef-42b3-4ead-b380-3c66b95cd6aas  ethernet  --     
netplan-enp0s3  1eaf7e45-3b9d-3043-0435-9690a02759203  ethernet  --     

The first ensp0s3 is the mentioned connection created and used by default after the reboot, the second is my attempt before the reboot to edit this default connection, the netplan-enp0s3 is created automatically based on /etc/netplan/50-cloud-init.yaml (I tried to disable cloud-init too). If I change to any other connection the default one would disappear instantly and my internet works again.

My /etc/netplan/50-cloud-init.yaml:

network:
    renderer: NetworkManager
    ethernets:
        enp0s3:
            dhcp4: true
            match:
                macaddress: 02:09:93:B7:81:45
            set-name: enp0s3
    version: 2

My /etc/NetworkManager/NetworkManager.conf:

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

Possibly relevant: when I reboot the nmcli command returns with enp0s3: connected (externally) to enp0s3.

user535733 avatar
cn flag
If you are using NetworkManager, then you should define the connections within NetworkManager. Your Netplan YAML should not have the `ethernets` section, as it will make that connection immutable to Network Manager.
egg avatar
at flag
egg
@user535733 Just removed the ethernets section and the behavior is still the same. But I don't think that because I could modify the the "netplan-enp0s3" before.
user535733 avatar
cn flag
The problem you specified is "*Network Manager's default connection doesn't give access to internet (it has a non-automatic ipv4 configuration)*" That seems like a mis-configuration of Network Manager. But since we have not seen your NM configs, that's a guess. It's also confusing what the title "*Network manager keeps creating a new connection on Ubuntu Server*" means.
egg avatar
at flag
egg
Thanks for the feedback, I tried to make it clearer. I focused on the NM creating a new connection because I don't care a lot about the default settings, I just want to change it to something that works, but NM keeps bringing back the same settings after reboot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.