Assign fixed addresses for a group of hosts

Reinhard Brandstaedter Reinhard.Brandstaedter at jku.at
Tue Jan 30 09:05:44 UTC 2007


Hi,

Is it possible to assign fixed IP addresses based on dhcp-eval
expressions?
What I want is that a host whose MAC ends in "01" gets the IP .101 and
the DNS name jboss-1. Dynamically of course, without multiple host
statements. I know this is not very useful in the most common scenarios
but my "jboss" hosts are Xen Virtual machines and I can completely
control their MAC addresses so that there are no duplicates (two MACs
ending in the same number)

Currently I'm doing something like that:

pool {
 allow members of "jboss-nodes";
 # DNS Name based in last digit in MAC address
 # (jboss-2 = 00:00:00:00:00:02)
 #option host-name =
     concat("jboss-",binary-to-ascii(10,8,"",suffix(hardware,1)));
 #ddns-hostname =        
     concat("jboss-",binary-to-ascii(10,8,".",suffix(hardware,1)));

 # DNS name based on the last digit of the leased address
 # (jboss-2 = 192.168.1.102)
 #option host-name = 
     concat("jboss-",
            substring(binary-to-ascii(10,8,
                      "",suffix(leased-address,1)),2,1));
 #ddns-hostname =
     concat("jboss-",
            substring(binary-to-ascii(10,8,
                      "",suffix(leased-address,1)),2,1));
 range 192.168.1.101 192.168.1.106;
}

which is semi-optional because:
- Xen names the virtual machine "jboss-1" (internal, not DNS)
- Xen assigns a MAC ending in ":01"
- DHCP assigns a IP address maybe ending in ".105" and not ".101"
- DHCP assigns a hostname "jboss-1" (MAC based) or "jboss-5" (leased
address based)

Either way I have a naming conflict in one spot.

Thanks for help,
Reinhard



More information about the dhcp-users mailing list