Comment 3 for bug 1772859

Revision history for this message
Frank Heimes (fheimes) wrote :

So this is more a configuration thing, because with netplan the default renderer is networkd (and not NetworkManager):

ubuntu@zlin:~$ grep renderer /etc/netplan/01-netcfg.yaml
  renderer: networkd

This leads to the fact that no connections are managed by nm by default:

ubuntu@zlin:~$ nmcli con show
NAME UUID TYPE DEVICE
ubuntu@zlin:~$ nmcli d s
DEVICE TYPE STATE CONNECTION
enP1p0s0 ethernet unmanaged --
enP1p0s0d1 ethernet unmanaged --
enP2p0s0 ethernet unmanaged --
enP2p0s0d1 ethernet unmanaged --
encc000 ethernet unmanaged --
lo loopback unmanaged --
encc000.2653 vlan unmanaged --

Changing the renderer from networkd to NetworkManager is probably what you are looking for:

# default:
ubuntu@zlin:~$ cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    encc000:
      dhcp4: no
      dhcp6: no
  vlans:
    encc000.2653:
      link: encc000
      id: 2653
      addresses: [ 10.245.236.14/24 ]
      gateway4: 10.245.236.1
      nameservers:
          search: [ canonical.com ]
          addresses:
              - "10.245.236.1"

# change the renderer form 'networkd' to 'NetworkManager':

ubuntu@zlin:~$ cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    encc000:
      dhcp4: no
      dhcp6: no
  vlans:
    encc000.2653:
      link: encc000
      id: 2653
      addresses: [ 10.245.236.14/24 ]
      gateway4: 10.245.236.1
      nameservers:
          search: [ canonical.com ]
          addresses:
              - "10.245.236.1"

# restart netplan / dry-run, to look for any potential config errors
ubuntu@zlin:~$ sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:2472): DEBUG: 13:47:43.846: Processing input file //etc/netplan/01-netcfg.yaml..
** (generate:2472): DEBUG: 13:47:43.846: starting new processing pass
** (generate:2472): DEBUG: 13:47:43.846: encc000.2653: setting default backend to 2
** (generate:2472): DEBUG: 13:47:43.846: encc000: setting default backend to 2
** (generate:2472): DEBUG: 13:47:43.846: Generating output files..
** (generate:2472): DEBUG: 13:47:43.846: networkd: definition encc000.2653 is not for us (backend 2)
** (generate:2472): DEBUG: 13:47:43.846: networkd: definition encc000 is not for us (backend 2)

# restart netplan in case no error are detected
ubuntu@zlin:~$ sudo netplan apply
ubuntu@zlin:~$

# now nm / nmcli has control:
ubuntu@zlin:~$ nmcli dev show
GENERAL.DEVICE: encc000.2653
GENERAL.TYPE: vlan
GENERAL.HWADDR: 02:00:00:33:B5:DD
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: netplan-encc000.2653
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveCo
IP4.ADDRESS[1]: 10.245.236.14/24
IP4.GATEWAY: 10.245.236.1
IP4.ROUTE[1]: dst = 10.245.236.0/24, nh = 0.0.0.0, mt
IP4.ROUTE[2]: dst = 0.0.0.0/0, nh = 10.245.236.1, mt =
IP4.DNS[1]: 10.245.236.1
IP6.ADDRESS[1]: fe80::ff:fe33:b5dd/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ff00::/8, nh = ::, mt = 256, table
IP6.ROUTE[2]: dst = fe80::/64, nh = ::, mt = 256

GENERAL.DEVICE: encc000
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 02:00:00:33:B5:DD
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: netplan-encc000
ubuntu@zlin:~$ nmcli con show
NAME UUID TYPE DEVICE
netplan-encc000 abd74282-8c33-3a09-985f-54c65ed16162 ethernet encc000
netplan-encc000.2653 8aabaee8-34fb-3808-b152-454ad49553d3 vlan encc000.26
Wired connection 1 ce36d943-64bd-312a-bd46-6bbf9ce71795 ethernet --
Wired connection 2 fbc21b74-c93e-3441-be46-decf30bf22f4 ethernet --
Wired connection 3 07334b8f-c16d-37d6-b8cb-dc38f4b8e3e3 ethernet --
Wired connection 4 8f06587e-be8c-366e-83b3-ab6a285e93cd ethernet --

Since networkmanager is a tool that is mainly used in the desktop space, I'm wondering what you are trying to do with nmcli and if the iproute2 tools (man ip) are a better alternative, since they can be used by default w/o the need of changing the renderer ...