Menu

#179 makedhcp -n fails to create subnet entries in dhcpd.conf

2.9
open
makedhcp (1)
5
2014-10-21
2013-09-18
Will N
No

Problem

makedhcp -n fails to create subnet entries in dhcpd.conf if:
1) There are 2 interfaces connected to the same subnet
2) AND, the 1st interface is defined in site.dhcpinterfaces, while the 2nd interface is not.

Steps to reproduce

1) Configure 2 interfaces on the xCAT master which are assigned IP addresses on the same subnet. In my cluster, eth1 and eth2 are on the same 192.168.57.0/24 subnet.

# ifconfig

eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.57.2 Bcast:192.168.57.255 Mask:255.255.255.0
...

eth2 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.57.222 Bcast:192.168.57.255 Mask:255.255.255.0

...

2) Add 192.168.57.0/24 subnet to networks table

# tabdump networks
#netname,net,mask,mgtifname,gateway,dhcpserver,tftpserver,nameservers,ntpservers,logservers,dynamicrange,staticrange,staticrangeincrement,nodehostname,ddnsdomain,vlanid,domain,comments,disable
"provision","192.168.57.0","255.255.255.0","eth1","<xcatmaster>",,"192.168.57.2",,,,"192.168.57.201-192.168.57.254","192.168.57.3-192.168.57.200","1",,,,"private.dns.zone",,</xcatmaster>

3) Add eth1 to site.dhcpinterfaces

# tabdump site | grep dhcpinterfaces
"dhcpinterfaces","eth1",,

4) Run makedhcp to generate dhcpd.conf file from scratch

# makedhcp -n
Renamed existing dhcp configuration file to /etc/dhcp/dhcpd.conf.xcatbak

5) Check /etc/dhcp/dhcpd.conf file and notice that it is missing the subnet sections.

#xCAT generated dhcp configuration

authoritative;
option space isan;
option isan-encap-opts code 43 = encapsulate isan;
option isan.iqn code 203 = string;
option isan.root-path code 201 = string;
option space gpxe;
option gpxe-encap-opts code 175 = encapsulate gpxe;
option gpxe.bus-id code 177 = string;
option user-class-identifier code 77 = string;
option gpxe.no-pxedhcp code 176 = unsigned integer 8;
option tcode code 101 = text;
option iscsi-initiator-iqn code 203 = string;
ddns-update-style interim;
ignore client-updates;
option client-architecture code 93 = unsigned integer 16;
option tcode "America/New_York";
option gpxe.no-pxedhcp 1;

omapi-port 7911;
key xcat_key {
algorithm hmac-md5;
secret "cDFYZXRBOU16QnZRVlBlZnZ5UE53dzIwRGtrWDZzSE8=";
};
omapi-key xcat_key;
class "pxe" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
ddns-updates off;
max-lease-time 600;
}

Patch

The root problem is that the logic to handle adding the subnet entries to dhcpd.conf doesn't work when it encounters two interfaces on the same subnet.

The attached patch seems to solve the problem.

1 Attachments

Discussion

  • Bruce

    Bruce - 2013-10-07

    John,

    Can you look at this patch and apply it if it makes sense to you?

     
  • ting ting li

    ting ting li - 2013-10-09
    • assigned_to: John Simpson --> Guang Cheng Li
     
  • Guang Cheng Li

    Guang Cheng Li - 2013-10-28
     
  • Guang Cheng Li

    Guang Cheng Li - 2013-10-28

    Recreated this bug in my environment, will look further into it.

     
  • Guang Cheng Li

    Guang Cheng Li - 2013-10-28

    This is more complex than I thought, the patch William attached does not work if we want to use the second nic(eth2 in this bug). xCAT NetworkUtils code does not handle the scenario in which multiple nics configured with ip addresses in the same subnet. like the xCAT::NetworkUtils->my_ip_facing. makenetworks needs to handle this case also.

    The current logic uses the first nic anyway, so I would like to checkin a quick fix to use the first nic, and do some design work in 2.8.4 for this configuration.

     
  • Bruce

    Bruce - 2013-10-28

    Guang Cheng,

    I agree with your assessment: quick fix for 2.8.3 and design work for 2.8.4.

    William,

    Is this an actual customer requirement? Or is this due to a special test environment you have. I don't really understand why someone would need 2 nics on the same subnet, that aren't bonded together, and want dhcp listening on only one of them.

     
  • Guang Cheng Li

    Guang Cheng Li - 2013-10-29

    I checked in some temp fix in 2.8.3 and 2.9: if there are more than one nics in the samesubnet, use the first nic as the dhcp interface. Need more work to be done in 2.8.4.

    2.8.3: 1dfb366a1b4c2ec17d4bf48ab1db04160e394eb8
    2.9: cac2677c1cfe4c3936a037c1a36994043153ae56

    I added a restriction in the 2.8.3 release notes to mention this.

     
  • Guang Cheng Li

    Guang Cheng Li - 2013-10-29
    • Milestones: 2.8.3 --> 2.8.4
     
  • Guang Cheng Li

    Guang Cheng Li - 2014-02-26

    Moving this bug to 2.9 unless William has objection. As the bug comments indicated, configuring the ip addresses on the same subnet on multiple nics is not a common configuration, using the first nic in dhcpd.conf should be able to handle the situation. It will need quite a few changes, not sure if it is worthwhile.

     
  • Guang Cheng Li

    Guang Cheng Li - 2014-02-26
    • component: --> general
    • Milestones: 2.8.4 --> 2.9
     
  • Guang Cheng Li

    Guang Cheng Li - 2014-10-21

    Ticket moved from /p/xcat/bugs/3792/

    Can't be converted:

    • _component: general
    • _milestone: 2.9