1

We are building a private cloud here, VMs have at least 2 NICs, sometimes 3 or 4, each may be statically configured for IPv4 and/or IPv6 or be configured by DHCP or a combo of the two.

Yes it's a mess, but this is the design I have to work with...

So say I have a RHEL or CentOS image coming up with eth1 and eth0, both have dhcp and dvcpV6, the way I understand it, it will have 4 clients running? Now what happens if all 4 are getting host names from the DHCP servers that answered them? which one "wins"? can I configure it to happen deterministically? Can I do it without pre-deciding this in the image, instead using some sort of dynamically defined priority or other logic to pick the hostname to use?

Ira
  • 139
  • 1
  • 2

2 Answers2

2

Option 12 of the DHCP spec is "Hostname" (see RFC 2132 - DHCP Options and BOOTP Vendor Extensions). This is a field you can push out as part of the response containing IP etc. and allows you to send a hostname at the same time. So all you need to do is get a DHCP server that can support this option and set a hostname per MAC.

For DHCPv6, see option 39 OPTION_CLIENT_FQDN, described by RFC 4704 - DHCPv6 Client Fully Qualified Domain Name (FQDN) Option.

Chopper3
  • 101,299
  • 9
  • 108
  • 239
  • this is a good answer, That is usually what you do when you want to restrict ip releases by dhcp server to only known devices on the network, hence explicitly specifying their MAC and/or hostname. – Danila Ladner Sep 09 '13 at 14:44
  • 1
    I know how DHCP servers send the hostname, question is about client behavior - if more than a single dhclient runs, whiuch hostname wins? and on RHEL, does the setting in /etc/sysconfig/network trump dhclient or gets an override? – Ira Sep 12 '13 at 08:53
  • Frankly, I think the right solution is not to use the hostname from the dhcp lease, but rather from the Cloudstack metadata service (e.g. using cloud-init) – Ira Sep 12 '13 at 08:54
0

The difference between DHCPv4 and DHCPv6 shouldn't be a problem. The hostname in DHCPv4 option 12 can populate the DNS A record (and the associated PTR record for the IPv4 address). The hostname in DHCPv6 option 39 can populate the DNS AAAA record (and the associated PTR record for the IPv6 address).

As for the multiple NICs... are they all on the same subnet, or different subnets? If the same subnet, then it's a matter of policy for the DHCP server to decide which address is used for DNS. If they're on different subnets, they could be assigned to different DNS sub-domains, and so have a DNS entry on each sub-domain. It depends what your purpose is for having multiple NICs.

Craig McQueen
  • 780
  • 7
  • 20