setup hostname from DNS/DHCP dynamically
hello
i have a small setup with a few VMs that i use for testing stuff. And i would like to set these up so that i can have them getting their hostnames from the DNS/DHCP setup. my VMs are either ubuntu or debian - so i would think they would require the same, or very similar, configurations. but i have no idea what needs doing. i am finding difficulty to find any valid information as the keywords that i have used for searching are not really helpful. i have tried searching for: 'hostname dynamic dns dhcp' if somebody could be so kind to provide me with some idea of the configuration, it would be most appreciated. thanks, |
No, most people leave the hostname alone. This box is RoseViolet wherever she goes.
A handy way of hacking this for yourself is to hack init scripts or the dhclient script to change hostname. Why do you need a different hostname? |
i have a template of ubuntu and another for debian Virtual Machine.
so when i create/copy a new VM - i have to edit its hostname as the default will not do; TEMPLUBU, TEMPLDEB I understand that tools such as Puppet would do this - but would be like just over the top for my requirements. just to be clearer - there is no off-the-shelve solution for this in Linux? thanks, |
If I'm right, the dhcp can give hostnames after a fashion.
The usual info is dns, and IP. You can grok a dhcp license file to see if there's a spot for hostnames. When it comes to hostname, the server can link an ip to a hostname by simply having a dns entry, and then the outside world makes that link. The dhcp server can link an ip to a mac address. But that's all server side. You can change your hostname by a command like echo "ShyTalk" > /etc/hostname. but nobody listens to that normally. Nobody interrogates it normally. If someone is listening, perhaps you should explain to us who and why. |
so your suggestion would be to have a script that
after booting, collects the IP of host nslookup - to collect the hostname for that IP, from the DNS write that hostname into /etc/hostname then reboot is that what you are suggesting? thanks, |
I'm not sure what you are trying to do and I'm not suggesting. I was pointing out that the most important thing is what the outside world thinks your hostname is, not what your box thinks it is.
|
thanks
i am back where i started. regards, |
All times are GMT -5. The time now is 12:00 PM. |