Thread: /bin/hostname
View Single Post

  #3  
Old 08-22-2008, 05:49 PM
Default Re: /bin/hostname

On Aug 22, 4:16 pm, Bit Twister wrote:
> On Fri, 22 Aug 2008 12:55:59 -0700 (PDT), Vwaju wrote:
> > I am having trouble with my Debian Linux network configuration, and I
> > am trying to isolate the problem. The name of my host is "jupiter"
> > and the name of my domain is "obliqueuniverse.org".

>
> > jupiter:~# echo jupiter.obliqueuniverse.org > /etc/hostname

>
> > jupiter:~# cat /etc/hosts | sed –n 1p
> > 127.0.0.1 localhost.localdomain localhost jupiter

>
> > jupiter:~# cat /etc/hosts | sed –n 4p
> > 207.237.37.110 jupiter.obliqueuniverse.org jupiter

>
> grep jupiter /etc/hosts
> 127.0.0.1 localhost.localdomain localhost jupiter
> 207.237.37.110 jupiter.obliqueuniverse.org jupiter
>
> Why do you have jupiter on more than one line.


I am working from Linux System Administration (LSA) Adelstein &
Lubanovic, O'Reilly, 2007 (p. 14). LSA is a detailed guide to building
an internet server on Debian Linux ("sarge"), which is what I am
running.

I added the second line (following LSA) because I am building an
internet server with a static IP address, and there needs to be a line
in /etc/hosts that maps the host and the FQDN to the static IP
address.

> Look at the ip address when you do a
> ping -c1 jupiter


jupiter:~# ping –c1 jupiter | sed –n 1p
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data

> > I believe that /bin/hostname without options should output the host
> > name "jupiter", but it doesn't.


According to LSA, if I execute
echo myserver.mydomain.org > /etc/hostname
and then
/bin/hostname –F /etc/hostname
then /bin/hostname should print "myserver" (the hostname w/o the
domain name)

What do you get on your system?

Thanks for helping a neophyte, Twister.

Best Regards,
Vwaju
New York City


Reply With Quote