pfSense DHCP: Auto-Assign Hostnames to Cluster Nodes

parityboy

Limp Gawd
Joined
Nov 13, 2010
Messages
390
I'm currently using pfSense 2.0.1-RELEASE on my LAN as a DHCP server. I'm in the process of setting up a number of Ubuntu Server nodes on my network, which obviously will get their IPs via DHCP. However, I would also like to assign them a host name which is auto-generated from their assigned IP address, much like what the cable companies do.

So for example, a node with an address of 192.168.1.10 will also have a host name of node-192-168-1-10 and an FQDN of node-192-168-1-10.example.com.

Is this possible?
 
You could manually add DHCP leases for each MAC/IP pair, and assign a hostname that way. Then check "Enable registration of DHCP client names in DNS" and everything will work as you desire.

If you want a fully automatic method (which doesn't care about maintaining MAC address to IP mappings over time), dnsmasq can do this, check under "DNS Forwarder" and configure it properly. Then turn off DNS and DHCP elsewhere.
 
which obviously will get their IPs via DHCP.

Maybe I'm not understanding the whole 'obviously' part. Why not just assign statics to the servers and name the servers manually in your '192_168_1_100.somedomain.com' naming scheme?
 
@brshoemak

Because it being a cluster, I want to be able to add and remove nodes at will. I'm working on a project which will use a form of auto-sharding (it's not a database project). The app servers themselves will find each other easily enough, but I'd like the node OS instances to auto-configure as much as possible.

@unhappy_mage

Thanks for the response. So, when a cable company assigns your machine a host name like cpe-xxx-xxx-xxx-xxx.woh.res.rr.com how exactly do they do it? It obviously isn't client-side scripting; would it be some kind of template that their DNS/DHCP servers use?
 
Thanks for the response. So, when a cable company assigns your machine a host name like cpe-xxx-xxx-xxx-xxx.woh.res.rr.com how exactly do they do it? It obviously isn't client-side scripting; would it be some kind of template that their DNS/DHCP servers use?
It's like the snippet that TCM posted below:
This a zone snippet for BIND that saves you from writing hundreds of records:

Code:
$GENERATE 101-200 dhcp${-100,3} A 192.168.1.$
This expands to dhcp001 A 192.168.1.101 until dhcp100 A 192.168.1.200

Manual: http://ftp.isc.org/isc/bind9/cur/9.9/doc/arm/Bv9ARM.ch06.html#id2599174
or set up dhcp through dnsmasq and generate a bunch of records in /etc/hosts. See the documentation.
 
Back
Top