dhclient needs reconfiguring after bridge set up

Bug #1579148 reported by James Tunnicliffe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
James Tunnicliffe
juju-core
Fix Released
Critical
James Tunnicliffe
1.25
Fix Released
Critical
James Tunnicliffe

Bug Description

After switching to using iproute2 to set up the bridge we didn't take into account that dhclient is bound to the now bridged interface so DHCP updates will probably not work.

Tags: network
Changed in juju-core:
status: Triaged → In Progress
assignee: nobody → James Tunnicliffe (dooferlad)
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Initial investigation
---------------------

I started a MAAS node with two interfaces bonded together and MAAS using DHCP to assign an address. Before the bond was bridged there was one dhclient running on bond0.

sudo python3 ./add-juju-bridge.py --bridge-prefix br- --activate /etc/network/interfaces

After:
root 1147 0.0 0.0 16124 864 ? Ss 13:39 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.bond0.pid -lf /var/lib/dhcp/dhclient.bond0.leases -I -df /var/lib/dhcp/dhclient6.bond0.leases bond0
root 1860 0.0 0.0 16128 888 ? Ss 13:52 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.br-bond0.pid -lf /var/lib/dhcp/dhclient.br-bond0.leases -I -df /var/lib/dhcp/dhclient6.br-bond0.leases br-bond0

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

This is, naturally, a bit tricky.

If we wanted to just throw away the old lease:
dhclient -v -r <parent>

We can't though because this drops the connection we are using. What we actually want to do is to keep the existing lease - it needs transferring to the bridge. I can envision a hacky way of doing this, but a nice way would be nicer.

It may also be the case that the second dhclient always ends up with the same address from MAAS (it has the same MAC address), so just killing the dhclient process attached to the parent is fine.

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

ubuntu@zoe:~$ ps aux | grep dhclient
root 1154 0.0 0.0 16124 864 ? Ss 15:25 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.bond0.pid -lf /var/lib/dhcp/dhclient.bond0.leases -I -df /var/lib/dhcp/dhclient6.bond0.leases bond0
root 1661 0.0 0.0 16128 896 ? Ss 15:27 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.br-bond0.pid -lf /var/lib/dhcp/dhclient.br-bond0.leases -I -df /var/lib/dhcp/dhclient6.br-bond0.leases br-bond0
ubuntu 1721 0.0 0.0 12948 1084 pts/0 S+ 15:27 0:00 grep --color=auto dhclient
ubuntu@zoe:~$ cat /var/lib/dhcp/dhclient.bond0.leases
lease {
  interface "bond0";
  fixed-address 192.168.1.14;
  filename "pxelinux.0";
  option subnet-mask 255.255.255.0;
  option routers 192.168.1.1;
  option dhcp-lease-time 42277;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.1.2;
  option dhcp-server-identifier 192.168.1.2;
  option ntp-servers 91.189.89.199,91.189.94.4;
  option broadcast-address 192.168.1.255;
  option domain-name "maas";
  renew 2 2016/05/10 20:49:18;
  rebind 3 2016/05/11 01:42:10;
  expire 3 2016/05/11 03:10:15;
}
ubuntu@zoe:~$ cat /var/lib/dhcp/dhclient.br-bond0.leases
lease {
  interface "br-bond0";
  fixed-address 192.168.1.12;
  filename "pxelinux.0";
  option subnet-mask 255.255.255.0;
  option routers 192.168.1.1;
  option dhcp-lease-time 40831;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.1.2;
  option dhcp-server-identifier 192.168.1.2;
  option ntp-servers 91.189.89.199,91.189.94.4;
  option broadcast-address 192.168.1.255;
  option domain-name "maas";
  renew 2 2016/05/10 20:50:03;
  rebind 3 2016/05/11 01:23:01;
  expire 3 2016/05/11 02:48:05;
}

Boo.

Changed in juju-core:
milestone: 1.25.6 → 2.0-beta7
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

I have something that needs more testing, but is promising. It kills dhclient for the interface being bridged, modifies the leases file and restarts dhclient. Works on Trusty and Xenial. I haven't tested Precise yet.

I did run into some 'fun' when playing with the order of ip commands where if you got them wrong then you would lose the ability to sudo (hostname fun).

I need to configure the MAAS DHCP client to give out really short leases and make sure that something like an openstack can stay up over multiple lease renewals. I am mostly happy with the change though.

Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta7 → 2.0-beta8
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta8 → none
milestone: none → 2.0-beta8
Changed in juju-core:
assignee: nobody → James Tunnicliffe (dooferlad)
importance: Undecided → Critical
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.