Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Mar 18, 2008 12:52 pm 
Offline
Senior Newbie

Joined: Tue Mar 04, 2008 10:50 pm
Posts: 5
Basic question.

I told my domain hosting provider to use the Linode name server (since I'm using the Dashboard / DNS Manager for DNS management).

Then in DNS manager it points my domain, plus it added the usual other records like www and mail. Everything looks good. Both mydomain, www.mydomain, and mail.mydomain all point to my Linode machine.

Now where exactly does a machine name fit into this? I want it to be myname.mydomain. I would have to add another DNS record for "myname" just like DNS manager added one for "www" and "mail", right?

At that point the machine is legitimate, and I'm not "faking out" the machine name, right? I ask all this because in Fedora Core 8 I added to /etc/sysconfig/network the settings HOSTNAME=myname.mydomain and DOMAIN=mydomain. When the machine reboots, it says hostname is indeed "myname.mydomain" but hostname --fqdn says Unknown host.

Seems like I'm missing something or else making the machine "legitimate" by adding a DNS record for it would keep it happy (for example, ping myname.mydomain would work, Apache would be happy that my machine name resolves to the right IP address in DNS, etc).


Top
   
 Post subject:
PostPosted: Tue Mar 18, 2008 12:58 pm 
Offline
Senior Member

Joined: Sun Nov 14, 2004 6:37 pm
Posts: 138
Website: http://oldos.org
WLM: jasonlfaulkner@hotmail.com
Yahoo Messenger: jasonfncsu
AOL: jaylfaulkner
Location: NC, USA
In your /etc/hosts

127.0.0.1 localhost localhost.domain
your.ip myname myname.mydomain.tld

hostname -f uses your /etc/hosts to get the fqdn, so just make sure these are the first two lines in your hosts file and you're good!

_________________
Jay Faulkner
http://oldos.org


Top
   
 Post subject:
PostPosted: Tue Mar 18, 2008 9:51 pm 
Offline
Senior Newbie

Joined: Tue Mar 04, 2008 10:50 pm
Posts: 5
After some hours of research, trial, and error, I figured out a more appetizing or perhaps philosophically appealing way to configure a machine name. Please correct me if something here is not quite right.

First, do NOT put your machine name in /etc/hosts. Leave it alone as "127.0.0.1 localhost" and don't add any aliases. (With ipv6 you'll may want "::1 localhost6" too)

Second, do NOT put the domain in /etc/sysconfig/network where you say HOSTNAME=yourmachine. Leave that as the single word machine name, no domain.

Then to expose what's happening in your current setup try this command, and note the result (replace XX and YYY with numbers for your machine):

Code:
$ ping liXX-YYY
PING liXX-YYY.members.linode.com (AA.BB.CC.DD) 56(84) bytes of data.


Why did it magically add "members.linode.com"? That's because /etc/resolv.conf has this in it:

Code:
; generated by /sbin/dhclient-script
search members.linode.com
nameserver EE.FF.GG.HH
nameserver ...(etc)...


These values came from DHCP. I'm using the /sbin/dhclient DHCP client. Happily, it can be told to override the domain name handed to you by DHCP. You simply create the file /etc/dhclient-eth0.conf containing only:

Code:
supersede domain-name "yourdomain.com";


Next time you restart, you'll see /etc/resolv.conf has the new value

Code:
$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search yourdomain.com
nameserver EE.FF.GG.HH
nameserver ...(etc)...


If you run hostname, your machine name is truly the short single word "yourmachine". And if you run "hostname --fqdn", your machine name plus true domain is correct "yourmachine.yourdomain.com".

Do "ping localhost" and you goes to 127.0.0.1. Do "ping yourmachine" and it does to the IP AA.BB.CC.DD. Try "ping www" and see it also go to AA.BB.CC.DD since the domain is right and the search suffix has been correctly set.

The last thing to do is add an A record to DNS for "yourmachine", just like there's an A record for "www" and perhaps "mail". Does Bill Gates do "ssh microsoft.com"? Probably there's a machine name in front of the domain. So adding the A record legitimizes that. Now you can finally "ssh yourmachine.yourdomain.com" and it gets to the right place from the outside.

If you add a second machine associated with your domain, this setup continues to work, rather than trying to figure out what to do to ssh or scp files to a particular machine or another. And if you are on one machine on your domain, you can "ssh othermachine" (without domain name) and you are there.


Top
   
 Post subject:
PostPosted: Thu Mar 20, 2008 6:16 pm 
Offline
Senior Newbie

Joined: Thu Dec 27, 2007 6:07 pm
Posts: 8
Website: http://dansimiha.btn.ro
Yahoo Messenger: danutz1982
Location: Cluj-Napoca , Romania
ux9i wrote:
Does Bill Gates do "ssh microsoft.com"? Probably there's a machine name in front of the domain.


<off-topic>
Bill Gates does not ssh microsoft.com,he probabily remote desktop it.
</off-topic>


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group