LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-08-2009, 01:49 PM   #1
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Just wondering: Domain Name Really Required? Using 127.0.0.1 for the Machine Name?


Question 1:
When you configure networking under Slackware, you are prompted for the hostname that you want to assign to the machine, as well as a domain name. I have always found the requirement for the domain name a little strange; other Linux distribution can work without it, so why couldn't Slackware?

I decided to try and get rid of the domain name, and see if that might create any problems. Here's what I did:
  • I removed the domain name from the "/etc/HOSTNAME" file, so that just the (unqualified) hostname remained.
  • I removed the fully qualified hostname from the "/etc/hosts" file.
It seems to me that everything continues to work just normally. The "hostname" command continues to display the unqualified hostname, and the output from "hostname --fqdn" is now also the unqualified hostname.

Would there be any features that might run into problems now? I'll continue to run without a domain name for now, and see if anything breaks, but so far, everything seems to be perfectly OK.

Are there any specific reasons why the domain name should be required for Slackware, or could it have been made optional instead?
Question 2:
Under Slackware, the "/etc/hosts" file includes the following comment:
Quote:
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine. It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
Even so, the file does contain an entry that associates 127.0.0.1 with the hostname (both the unqualified and the fully qualified one). I have noticed, however, that Ubuntu, for example, defines address 127.0.1.1 (which ends in ".1.1" instead of ".0.1") for the hostname instead--which apparently works fine.

I have now modified my "/etc/hosts" file on my Slackware system, to associate the 127.0.1.1 address with the hostname, without any apparent ill effects.

I have no idea why using 127.0.0.1 for the hostname may cause any problems, but if it really is such a bad idea, then wouldn't it be more appropriate for Slackware to use the 127.0.1.1 address instead?
 
Old 11-08-2009, 03:10 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

No - it's not a problem to omit the "domain" part of an fqdn ... if you don't happen to be part of a domain (if you're a standalone host, or just have two or three hosts on a small LAN). Personally, I think a better approach is to call your domain something like "mylan.local" ... and then make sure every host (including, and especially, any devices like a wifi base station or cable modem) all follow the same convention (assuming the devices allow to to configure an fqdn).

And yes, associating 127.0.0.1 with a hostname is OK. It's a bit bass-ackwards to assign your OWN hostname to loopback. But one example is to assign "HOSTB" to "127.0.0.1" if you want to PREVENT yourself from ever calling out to the "real" (external) "HOSTB". In other words, you can use "127.0.0.1" to "comment out" specific hostnames, if you need to.

'Hope that helps .. PSM
 
Old 11-08-2009, 03:44 PM   #3
Squall90
Member
 
Registered: Oct 2009
Distribution: Currently several distros :S
Posts: 148

Rep: Reputation: 29
Quote:
Originally Posted by paulsm4 View Post
And yes, associating 127.0.0.1 with a hostname is OK. It's a bit bass-ackwards to assign your OWN hostname to loopback. But one example is to assign "HOSTB" to "127.0.0.1" if you want to PREVENT yourself from ever calling out to the "real" (external) "HOSTB". In other words, you can use "127.0.0.1" to "comment out" specific hostnames, if you need to.
I wonder why Xfce seems to need this entry. There appears a message that Xfce might not work properly if there is no such entry in /etc/hosts.
 
Old 11-08-2009, 05:23 PM   #4
granth
Member
 
Registered: Jul 2004
Location: USA
Distribution: Slackware64
Posts: 212

Rep: Reputation: 55
Answer 1

You can leave it blank, or fill it in. It doesn't have to be a fqdn. Use whatever you want - Eg. local.lan , null.post , root.me , etc.
It will be needed if you use NFS, NIS, or similar network services.



Answer 2

127.0.0.1 is for loopback connections. Any address in 127.0.0.0/8 network range is mapped to 127.0.0.1. Therefore, associating 127.0.1.1 with the hostname is the same as associating 127.0.0.1 with this hostname.

Regardless, you should change your /etc/hosts file to match the following:


127.0.0.1 localhost
x.x.x.x hostname.domain hostname
^^^ replace this with whatever local IP that matches your environment. Eg. 192.x.x.x , 172.x.x.x , or 10.x.x.x

This isn't an area where you should be getting "creative". Just set it up right, and everything will work. I cannot think of any scenario where it would be beneficial to bork this file standard.
 
Old 11-08-2009, 07:29 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
luvr -

Just FYI, granth is absolutely correct on both counts. I said you *could* do these things (and you can), but I didn't necessarily imply that you *should*.

The only reason you'd want "127.0.0.1" "trick" is if you had an environment where sometimes you'd want "HOSTX" to be a real host, and other times you want to insure you CAN'T and WON'T communicate with it. One of my clients does this. And frankly, I think it's really less of a "trick" than a "hack". I would certainly discourage you from doing it unless you really needed to.

And as far as defining your own hostname as loopback: I don't see any problem (including with Xfce!) ... but I certainly wouldn't recommend it.

'Hope that helps .. PSM

Last edited by paulsm4; 11-08-2009 at 08:46 PM.
 
  


Reply



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
Joining a linux machine to a windows domain having a wndows 2003 as domain contoller sukalyan_g SUSE / openSUSE 1 03-28-2008 01:31 AM
Sendmail : relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refuse macadam Linux - Software 0 09-23-2007 02:44 PM
Wondering if my machine is Comromised?? nevarlen Linux - Security 3 01-10-2006 10:40 PM
wondering how well this machine will run linux h00ligan Linux - Newbie 2 02-13-2004 12:53 AM
Joining a machine from another domain to my linux samba domain acummins Linux - Networking 0 09-13-2003 07:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:32 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
Open Source Consulting | Domain Registration