← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1633656] [NEW] Can't disable DHCP network config on xenial

 

Public bug reported:

Using uvtool, I am trying to bring up a xenial VM with a bridge to my
LAN, and a static network address which I inject using write-files and
some bootcmd & runcmd steps (details below).

Following the instructions in /etc/network/interfaces.d/50-cloud-
init.cfg, I have written "network: {config: disabled}" to
/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg in a bootcmd step.

For a trusty VM, this works:

ubuntu@test-nwtn2:~$ ip address list
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:e1:8b:c3 brd ff:ff:ff:ff:ff:ff
    inet 10.42.20.4/16 brd 10.42.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fee1:8bc3/64 scope link 
       valid_lft forever preferred_lft forever

But for a xenial VM, I find that the VM has two IP addresses: my
statically assigned one and another which turns out to have come from
DHCP (checked using DHCP logs).

ubuntu@test-nwtn2:~$ ip address list
...
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:1d:e9:17 brd ff:ff:ff:ff:ff:ff
    inet 10.42.0.60/16 brd 10.42.255.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet 10.42.20.4/16 brd 10.42.255.255 scope global secondary ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe1d:e917/64 scope link 
       valid_lft forever preferred_lft forever

My host is running 16.04:

will@host-nwtn25:~$ uname -a
Linux host-nwtn25 4.4.0-42-generic #62-Ubuntu SMP Fri Oct 7 23:11:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
will@host-nwtn25:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial
will@host-nwtn25:~$ dpkg -l|grep cloud
ii  cloud-image-utils                     0.27-0ubuntu24                      all          cloud image management utilities
ii  ubuntu-cloudimage-keyring             2013.11.11                          all          GnuPG keys of the Ubuntu Cloud Image builder
will@host-nwtn25:~$ dpkg -l|grep uvt
ii  uvtool-libvirt                        0~bzr99-0ubuntu1                    all          Library and tools for using Ubuntu Cloud Images with libvirt

My command is:

sudo uvt-kvm create test-nwtn2 release=xenial arch=amd64 --bridge br0
--cpu 2 --memory 2048 --disk 16384 --user-data cloud-config.yml --log-
console-output

And cloud-config.yml has:

#cloud-config
...
bootcmd:
  - "echo 'network: {config: disabled}' >/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg"
write_files:
  - path: /etc/network/interfaces
    content: |
      auto lo
      iface lo inet loopback

      auto ens3
      iface ens3 inet static
      address 10.42.20.4
      network 10.42.0.0
      broadcast 10.42.255.255
      netmask 255.255.0.0
      gateway 10.42.0.1
      dns-nameservers 10.42.0.1
runcmd:
  - ifdown -a && ifup -a

I've also tried removing /etc/network/interfaces.d/50-cloud-init.cfg in
my bootcmd step, which didn't seem to change anything.

(For trusty, the write_files talked about eth0 instead of ens3.)

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1633656

Title:
  Can't disable DHCP network config on xenial

Status in cloud-init:
  New

Bug description:
  Using uvtool, I am trying to bring up a xenial VM with a bridge to my
  LAN, and a static network address which I inject using write-files and
  some bootcmd & runcmd steps (details below).

  Following the instructions in /etc/network/interfaces.d/50-cloud-
  init.cfg, I have written "network: {config: disabled}" to
  /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg in a bootcmd
  step.

  For a trusty VM, this works:

  ubuntu@test-nwtn2:~$ ip address list
  ...
  2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      link/ether 52:54:00:e1:8b:c3 brd ff:ff:ff:ff:ff:ff
      inet 10.42.20.4/16 brd 10.42.255.255 scope global eth0
         valid_lft forever preferred_lft forever
      inet6 fe80::5054:ff:fee1:8bc3/64 scope link 
         valid_lft forever preferred_lft forever

  But for a xenial VM, I find that the VM has two IP addresses: my
  statically assigned one and another which turns out to have come from
  DHCP (checked using DHCP logs).

  ubuntu@test-nwtn2:~$ ip address list
  ...
  2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      link/ether 52:54:00:1d:e9:17 brd ff:ff:ff:ff:ff:ff
      inet 10.42.0.60/16 brd 10.42.255.255 scope global ens3
         valid_lft forever preferred_lft forever
      inet 10.42.20.4/16 brd 10.42.255.255 scope global secondary ens3
         valid_lft forever preferred_lft forever
      inet6 fe80::5054:ff:fe1d:e917/64 scope link 
         valid_lft forever preferred_lft forever

  My host is running 16.04:

  will@host-nwtn25:~$ uname -a
  Linux host-nwtn25 4.4.0-42-generic #62-Ubuntu SMP Fri Oct 7 23:11:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  will@host-nwtn25:~$ lsb_release -a
  No LSB modules are available.
  Distributor ID:	Ubuntu
  Description:	Ubuntu 16.04.1 LTS
  Release:	16.04
  Codename:	xenial
  will@host-nwtn25:~$ dpkg -l|grep cloud
  ii  cloud-image-utils                     0.27-0ubuntu24                      all          cloud image management utilities
  ii  ubuntu-cloudimage-keyring             2013.11.11                          all          GnuPG keys of the Ubuntu Cloud Image builder
  will@host-nwtn25:~$ dpkg -l|grep uvt
  ii  uvtool-libvirt                        0~bzr99-0ubuntu1                    all          Library and tools for using Ubuntu Cloud Images with libvirt

  My command is:

  sudo uvt-kvm create test-nwtn2 release=xenial arch=amd64 --bridge br0
  --cpu 2 --memory 2048 --disk 16384 --user-data cloud-config.yml --log-
  console-output

  And cloud-config.yml has:

  #cloud-config
  ...
  bootcmd:
    - "echo 'network: {config: disabled}' >/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg"
  write_files:
    - path: /etc/network/interfaces
      content: |
        auto lo
        iface lo inet loopback

        auto ens3
        iface ens3 inet static
        address 10.42.20.4
        network 10.42.0.0
        broadcast 10.42.255.255
        netmask 255.255.0.0
        gateway 10.42.0.1
        dns-nameservers 10.42.0.1
  runcmd:
    - ifdown -a && ifup -a

  I've also tried removing /etc/network/interfaces.d/50-cloud-init.cfg
  in my bootcmd step, which didn't seem to change anything.

  (For trusty, the write_files talked about eth0 instead of ens3.)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1633656/+subscriptions


Follow ups