[Bug 1521618] Re: wrong subnet in DHCP answer when multiple networks are present

Trent Lloyd trent.lloyd at canonical.com
Tue May 10 12:34:24 UTC 2016


Full patch and explanation here:
https://code.launchpad.net/~lathiat/maas/1.9-lp1521618-dhcp-incorrect-router

With multiple subnets, PXE DHCP clients would receive the router of the first
subnet in the configuration file regardless of which subnet they actually
received a lease from.

This happens because match sections such as "class" (used here to give PXE
clients a smaller lease time) and "host" (not currently used, but is the
example given in the below e-mail) are not actually scoped within the subnet{}
declaration as you would expect. They are actually defined in the global scope
for all subnets, but also inherit options from the subnet{} declaration they
were defined in such as "option routers".

This strange behavior is explained in the following email:
https://lists.isc.org/pipermail/dhcp-users/2011-September/014001.html

We fix this by moving the conditional declarations out into the global scope,
instead of repeating them for each subnet. This way they do not inherit any
options from the subnet scope.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to isc-dhcp in Ubuntu.
https://bugs.launchpad.net/bugs/1521618

Title:
  wrong subnet in DHCP answer when multiple networks are present

Status in MAAS:
  Triaged
Status in isc-dhcp package in Ubuntu:
  Confirmed

Bug description:
  So I have 3 interfaces with 3, non-overlapping subnets defined in my
  maas cluster controller.

  The idea would be that there is a provisioning network (10.6.0.0/16)
  to do the actual provisioning and once the node gets deployed it is
  using a different network (because the provisioning network is only
  1x1Gbit while the production network is bonded (LACP) 10Gbit).

  However, when I boot up a fresh, new node to add to MAAS, it gets the
  following DHCP reply:

  ip=10.6.239.3:10.6.250.250:9.4.113.254:255.255.255.0

  So instead of picking up the /16 subnet correctly for the 10.6.239.3
  IP, it picks up the /24 from the network where it gets it's default
  gateway from.

  Is this a bug or my understanding of how MAAS should behave when there
  are multiple networks flawed?

  Here is my /var/lib/maas/dhcpd.conf:

  subnet 9.4.113.0 netmask 255.255.255.0 {
         if option arch = 00:0E {
            filename "pxelinux.0";
            option path-prefix "ppc64el/";
         } elsif option arch = 00:07 {
            filename "bootx64.efi";
         } elsif option arch = 00:0B {
            filename "grubaa64.efi";
         } elsif option arch = 00:0C {
            filename "bootppc64.bin";
         } else {
            filename "pxelinux.0";
         }
         interface "eth0";
         ignore-client-uids true;
         option subnet-mask 255.255.255.0;
         option broadcast-address 9.4.113.255;
         option domain-name-servers 9.4.113.251;
         option domain-name "i.zc2.ibm.com";
         option routers 9.4.113.254;
         option ntp-servers ntp.ubuntu.com;
         range dynamic-bootp 9.4.113.150 9.4.113.190;
         class "PXE" {
            match if substring (option vendor-class-identifier, 0, 3) = "PXE";
            default-lease-time 30;
            max-lease-time 30;
         }
  }
  subnet 10.6.0.0 netmask 255.255.0.0 {
         if option arch = 00:0E {
            filename "pxelinux.0";
            option path-prefix "ppc64el/";
         } elsif option arch = 00:07 {
            filename "bootx64.efi";
         } elsif option arch = 00:0B {
            filename "grubaa64.efi";
         } elsif option arch = 00:0C {
            filename "bootppc64.bin";
         } else {
            filename "pxelinux.0";
         }
         interface "eth1";
         ignore-client-uids true;
         option subnet-mask 255.255.0.0;
         option broadcast-address 10.6.255.255;
         option domain-name-servers 9.4.113.251;
         option domain-name "i.zc2.ibm.com";
         option ntp-servers ntp.ubuntu.com;
         range dynamic-bootp 10.6.239.0 10.6.239.239;
         class "PXE" {
            match if substring (option vendor-class-identifier, 0, 3) = "PXE";
            default-lease-time 30;
            max-lease-time 30;
         }
  }

  Here is "subnets read":

  [
      {
          "dns_servers": [],
          "name": "9.4.113.0/24",
          "space": "space-0",
          "vlan": {
              "name": "untagged",
              "resource_uri": "/MAAS/api/1.0/vlans/0/",
              "fabric": "fabric-0",
              "vid": 0,
              "id": 0
          },
          "gateway_ip": "9.4.113.254",
          "cidr": "9.4.113.0/24",
          "id": 1,
          "resource_uri": "/MAAS/api/1.0/subnets/1/"
      },
      {
          "dns_servers": [],
          "name": "10.7.0.0/16",
          "space": "space-0",
          "vlan": {
              "name": "untagged",
              "resource_uri": "/MAAS/api/1.0/vlans/5001/",
              "fabric": "fabric-1",
              "vid": 0,
              "id": 5001
          },
          "gateway_ip": null,
          "cidr": "10.7.0.0/16",
          "id": 2,
          "resource_uri": "/MAAS/api/1.0/subnets/2/"
      },
      {
          "dns_servers": [],
          "name": "10.6.0.0/16",
          "space": "space-0",
          "vlan": {
              "name": "untagged",
              "resource_uri": "/MAAS/api/1.0/vlans/5002/",
              "fabric": "fabric-2",
              "vid": 0,
              "id": 5002
          },
          "gateway_ip": null,
          "cidr": "10.6.0.0/16",
          "id": 3,
          "resource_uri": "/MAAS/api/1.0/subnets/3/"
      }
  ]

  Running 1.9.0~rc2+bzr4509-0ubuntu1~trusty1.

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas/+bug/1521618/+subscriptions



More information about the foundations-bugs mailing list