LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-09-2010, 04:33 AM   #1
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
Question Hostname to Hostname mapping within /etc/hosts possible?


Hi All,

I'm 99.9999% sure I know the answer to this already, but just wanted to check no-one knew of an ingenious way to do this anyway..

Changing etc/hosts file in order to have a hostname map to a hostname ... rather like a cname I suppose.

Why?!? you ask.. well

I basically have some long DNS names that are configured in several place on a server but all of them point to the same IP address. I wondered to make sys admin easier if it was possible I create an entry such as

long_dns_name short_name

and then configure all these different places to use the shortname, just so if the DNS of the long name changes its easy to change that DNS entry... as i have no control over the DNS name?

Is it possible without installing any form of local DNS server?

Thanks all,
M
 
Old 09-09-2010, 04:39 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
According to the hosts man page:
IP_address canonical_hostname [aliases...]

Zero, one or more aliases can exist in an /etc/hosts entry. The first entry is the IP address.
 
Old 09-09-2010, 06:43 AM   #3
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
Thats what i thought, thanks for the reply. I cannot use that because I cannot set the IP address up, i'm literally just wanting to be able to use a DNS name that I can put into all configuration files of different software/packages installed, so that in the event of IP/Hostname change, I could just change the one place... etc hosts and everything else will still be configured to use the short hostname so i wouldn't need to go and change all of those places as well.
 
  


Reply


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
hostname, fqdn, /etc/hosts setup [GOD]Anck Slackware 9 07-20-2010 04:51 PM
hostname and /etc/hosts. stf92 Linux - Newbie 9 07-03-2010 12:25 PM
Correct way to define hostname in /etc/hosts thespaceman Red Hat 6 10-12-2008 10:27 AM
Changing Hostname.../etc/hosts...? vous Linux - Networking 13 01-16-2008 08:38 PM
Hosts.allow... Can't verify hostname. landev Linux - Security 9 11-29-2007 01:29 PM


All times are GMT -5. The time now is 07:35 PM.

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