LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-27-2012, 02:46 AM   #1
nicolasdiogo
Member
 
Registered: Oct 2003
Location: UK
Distribution: debian lenny x64
Posts: 129

Rep: Reputation: 20
Question 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,
 
Old 12-27-2012, 03:41 AM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,387

Rep: Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557
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?
 
Old 12-27-2012, 12:50 PM   #3
nicolasdiogo
Member
 
Registered: Oct 2003
Location: UK
Distribution: debian lenny x64
Posts: 129

Original Poster
Rep: Reputation: 20
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,
 
Old 12-27-2012, 01:52 PM   #4
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,387

Rep: Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557
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.
 
Old 12-27-2012, 01:59 PM   #5
nicolasdiogo
Member
 
Registered: Oct 2003
Location: UK
Distribution: debian lenny x64
Posts: 129

Original Poster
Rep: Reputation: 20
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,
 
Old 12-27-2012, 03:12 PM   #6
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,387

Rep: Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557
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.
 
Old 12-27-2012, 03:52 PM   #7
nicolasdiogo
Member
 
Registered: Oct 2003
Location: UK
Distribution: debian lenny x64
Posts: 129

Original Poster
Rep: Reputation: 20
thanks

i am back where i started.

regards,
 
  


Reply

Tags
dynamic, hostname, network


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to setup hostname using dhcp on Ubuntu 8.10 rizwanrafique Ubuntu 3 02-28-2009 02:20 PM
DHCP autoupdate DNS issue (wrong hostname) ScottChapman Linux - Networking 2 12-21-2008 07:23 AM
Wrong Hostname in the DNS and DHCP Address Leases of Windows 2000 saneax Linux - Networking 1 03-03-2005 03:14 AM
hostname/domainname/postfix setup with dynamic DNS from no-ip tesauce98 Linux - Software 10 09-17-2003 01:01 PM
DHCP is setup. Now, DNS before Samba?? itsjustme Linux - Networking 3 06-17-2003 08:33 AM


All times are GMT -5. The time now is 04:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration