pexip / rp-turn

Pexip Reverse Proxy/TURN Server
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

installwizard network config has less precedence than cloud-init's default #36

Closed MichaelOultram-pexip closed 1 year ago

MichaelOultram-pexip commented 1 year ago

/etc/netplan/50-cloud-init.yaml is preferred over /etc/netplan/01-netcfg.yaml

Jamie- commented 1 year ago

I think actually both are applied simultaneously .

From a deployed VM I see

$ sudo netplan get all

** (process:2500): WARNING **: 13:28:06.823: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
network:
  version: 2
  renderer: networkd
  ethernets:
    nic0:
      match:
        name: "nic0"
        macaddress: "00:50:56:80:e3:fa"
      addresses:
      - "10.151.255.161/16"
      nameservers:
        addresses:
        - 10.47.3.17
      gateway4: 10.151.0.1
      dhcp4: true
      dhcp6: false
      set-name: "nic0"

You'll see there is a static address (from 01-netcfg.yaml) and also dhcp4: true (from 50-cloud-init.yaml)

And the VM has two IP addresses

$ 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
2: nic0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:80:e3:fa brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet 10.151.255.161/16 brd 10.151.255.255 scope global nic0
       valid_lft forever preferred_lft forever
    inet 10.151.0.163/16 metric 100 brd 10.151.255.255 scope global secondary dynamic nic0
       valid_lft 287sec preferred_lft 287sec
    inet6 fe80::250:56ff:fe80:e3fa/64 scope link 
       valid_lft forever preferred_lft forever

I think that leaves us with 2 options:

  1. Have the installwizard write network config out in cloud-init format to /etc/cloud/cloud.cfg.d/ so the default no-config config is not applied
  2. Have the installwizard create /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with content network: {config: disabled} to avoid cloud-init creating us default network config.

Note though that if option 1 is chosen, if the hypervisor/cloud provider in use does not provide any cloud-init datasource (causing cloud-init-generator to not start cloud-init) the machine will have no network connectivity.

Jamie- commented 1 year ago

Further I wondered if, after we create netplan network config, cloud-init would skip it's network fallback config step as there is already non-cloud-init working network config. Deleted 50-cloud-init.yaml and rebooted, did not reappear after reboot and networking came up with just the static address as expected.

So actually I propose a new option 3: Have the installwizard delete 50-cloud-init.yaml if it exists when it writes out 01-netcfg.yaml