LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-08-2014, 08:09 AM   #1
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Rep: Reputation: 0
Debian hostname / fqdn


Hi all,

Following the example here I have

Code:
$ cat /etc/hosts

127.0.0.1 localhost
127.0.1.1 foobar.example.com foobar
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$
So I should get
Code:
$ hostname
foobar
$ hostname --fqdn
foobar.example.com
$
but in fact I get
Code:
$ hostname
foobar.example.com
$ hostname --fqdn
foobar.example.com
$
Any ideas please why my hostname output is wrong?

Thanks...
 
Old 09-08-2014, 09:44 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
No, you need to have a line like this in your hosts file
Code:
192.168.1.???    foobar
Where ??? is the last number of the internal ip number assigned to you by the router.
jdk
 
Old 09-08-2014, 10:10 AM   #3
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jdkaye View Post
No, you need to have a line like this in your hosts file
Code:
192.168.1.???    foobar
Where ??? is the last number of the internal ip number assigned to you by the router.
jdk
@ jdk sorry I meant to say that this is a remote server - does that make a difference?
 
Old 09-08-2014, 10:30 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Juc1 View Post
@ jdk sorry I meant to say that this is a remote server - does that make a difference?
I would think so. You mean remote server that is not within your local network. Is that correct?
jdk
 
Old 09-08-2014, 10:32 AM   #5
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jdkaye View Post
You mean remote server that is not within your local network. Is that correct?
jdk
Correct, it is a VPS.
 
Old 09-08-2014, 10:34 AM   #6
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
I have zero experience in that area. Maybe someone else can chime in.
Sorry.
jdk
 
Old 09-08-2014, 11:11 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
/etc/hosts should have an entry for each local IP address with foobar.example.com foobar

But that is not relevant to your symptoms. You don't say which distro you are using. If it were Debian or ubuntu (or probably their derivatives) ...

What's in /etc/hostname? It should contain the bare hostname, without the domain name. If you change it, make the change effective by.

Debian:
Code:
/etc/init.d/hostname.sh start
Ubuntu:
Code:
/etc/init.d/hostname start
EDIT: just noticed the thread title contains Debian but I will leave the above as it is for wider use.

Last edited by catkin; 09-08-2014 at 11:12 AM.
 
  


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 05:51 PM
hostname does not return FQDN Mufasa Linux - Software 2 04-08-2010 05:01 PM
Hostname and FQDN jason_m Linux - Server 1 06-24-2009 09:50 PM
Sendmail not using FQDN in HELO even though hostname setting is correct. Jukas Linux - Server 2 04-21-2009 10:39 PM
best pratice for hostname? FQDN vs short? zerobane Linux - Networking 1 02-03-2009 02:45 PM


All times are GMT -5. The time now is 03:21 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration