Fedora Linux Support Community & Resources Center
  #1  
Old 4th November 2006, 10:36 PM
bhm8hwcm Offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Proper hostname

I am not sure what the proper naming convention for the hostname should be.

I will be hosting 2 websites - www.web1.com, www.web2.com

My hostname right now is localhost.localdomain
Should I leave this or change it? If I want to call my computer 'server', is my hostname therefore just 'server', or should it be 'server.localdomain'... or should it be 'server.web1.com'?

If hosting more than 1 website should any of hosted site domains be included in any of the naming conventions?

As well, if my linux box has a hostname of 'server' then what should the entry in the /etc/hosts file be? I have seen different things posted.

127.0.0.1 localhost.localdomain localhost server
- or -
127.0.0.1 localhost.localcomain localhost
xxx.xxx.xx.xx server

Any clarification would be appreciated. I am having a difficult time trying to nail this down. I have tried different things and my server seems to work, my mainn problems are regarding mail and I think they may be tied to this.
Reply With Quote
  #2  
Old 4th November 2006, 10:44 PM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello:
No expert, however I would think that if you server is named server then you should see in your host file
127.0.0.1 localhost.localdomain localhost server
or
127.0.0.1 server localhost.localdomain localhost
also you should have
xxx.xxx.xx.xx server
for dns resolution issues etc.

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
Reply With Quote
  #3  
Old 5th November 2006, 08:13 AM
vinbob Offline
Registered User
 
Join Date: May 2006
Location: Cheshire, UK
Posts: 108
In other words you can replace that line with something like this...

127.0.0.1 myserver myserver.web1.com myserver.web2.com

You can (or should) also have a similar line with the same host names but starting with your NIC's IP address.
Reply With Quote
  #4  
Old 5th November 2006, 08:17 AM
bhm8hwcm Offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Do you not have to have the localhost.localdomain entry in there for 127.0.0.1?

I thought this was always needed, or is atleast safe.
Reply With Quote
  #5  
Old 5th November 2006, 04:26 PM
vinbob Offline
Registered User
 
Join Date: May 2006
Location: Cheshire, UK
Posts: 108
No you don't need localhost although you could stick localhost on the end if you wish, the format isn't very strict, you could therefore have the format shown in my earlier post, here's a /etc/hosts mock-up for you...

127.0.0.1 localhost.localdomain localhost #loopback IP address
10.10.10.1 myserver myserver.web1.com myserver.web2.com #local IP address
192.168.1.1 myserver myserver.anotherdomain #a second network card attached to a different network/domain
10.10.10.2 myotherserver myotherserver.web1.com #another machine on the local network
192.168.1.5 laptop #another machine on the 192 local network

Last edited by vinbob; 5th November 2006 at 04:37 PM.
Reply With Quote
  #6  
Old 5th November 2006, 06:00 PM
bhm8hwcm Offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Thanks vinbob.

Is the 10.10.10.1 referring to the static ip I have been assigened from my ISP for the 2 hosted sites?
Reply With Quote
  #7  
Old 5th November 2006, 07:17 PM
Zotter Offline
Registered User
 
Join Date: May 2004
Location: Central Wyoming
Posts: 640
There's a school of thought that says, in a similar situation, the machines could (should?) be named:
web1.com
web2.com
And those registered as their A names in DNS. Then C names added for the www and other services.

Remember, you want to name the machines, not their services. There are other mechanisms (C names, /etc/services) to name the services offered by those machines. Allows for greater flex later if you want to do other things.

/etc/hosts should have localhost.localdomain set to 127.0.0.1 - same as default - not for outside connectivity, but for functions within the system. The loopback connector is used more than one would think.

If the box's external IP is - say - 10.0.0.2 a quick and dirty method to deal with this is:
127.0.0.1 localhost localhost.localdomain
10.0.0.2 web1.com www.web1.com

Best yet, just leave /etc/hosts alone, at it's default setup and add the IPs, names C names and MX records for each box to your local DNS server. Special if you get more than about 5 boxes going - that's worth the trivial effort it takes to setup DHCP and DNS for your LAN.
__________________
If it ain't broken - you're not really trying....
Registered Linux user #227845
Reply With Quote
Reply

Tags
hostname, proper

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The proper way to do NFS /home savage Servers & Networking 1 25th April 2009 03:26 PM
Let's give a proper welcome. techmatt Wibble 26 6th March 2008 06:38 PM
hosts puzzle ->host hostname -> host hostname not found alphonsebrown Servers & Networking 2 30th March 2005 09:26 AM
Fedora Core 3 Hostname Error (Windows cannot ping 'hostname') 3K Tech Servers & Networking 1 3rd January 2005 03:24 AM
Help Proper NFS setup... unix_eng Servers & Networking 4 19th November 2004 11:49 PM


Current GMT-time: 20:28 (Wednesday, 20-08-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat