LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 12-03-2005, 12:31 PM   #1
tortle
Newbie
 
Registered: Jul 2004
Location: Wisconsin
Distribution: OpenSUSE, SUSE, Slackware
Posts: 22

Rep: Reputation: 15
Adding a host alias in /etc/hosts


Hi --

I'm setting up a virtual host (test.org) for testing. The
host is on my desktop machine which is running SUSE 9.3.

I added an alias to /etc/hosts:

Code:
128.0.0.1       localhost test.org
In hosts.conf I have:

Code:
order hosts, bind
So the hosts file should be checked first. (This is how
I've done this in the past.)

Anyway, I get:

Code:
user@/> host localhost
localhost has address 127.0.0.1
user@/> host test.org
Host test.org not found: 3(NXDOMAIN)
Do I need to restart the resolver? How do I do that?
 
Old 12-04-2005, 08:00 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
One of the nasty surprises from Linux is that it does NOT use /etc/hosts for nslookup/host command unlike Unix. It does resolve within programs but there's no way to prove it from the command line with either of those utilties.

I beat my head over this issue for a while since I was used to nslookup working just fine for this purpose on Unix. Most of the Linux only folks thought I was nuts for expecting it to work.

At the time I stated my opinion this is a bug in Linux.
 
Old 12-05-2005, 10:38 AM   #3
tortle
Newbie
 
Registered: Jul 2004
Location: Wisconsin
Distribution: OpenSUSE, SUSE, Slackware
Posts: 22

Original Poster
Rep: Reputation: 15
Hi jlightner --

Thanks for the reply. I think this behavior might be distro-specific,
because I'm pretty sure I had a setup similar to this working exactly
this way under Slackware a while back; don't know what's different
under SUSE. It occurred to me after I posted that SUSE might be
treating '/etc/hosts' more strictly; that is, it is allowing only
a _host name_ (i.e., and undotted string) as an alias to be added
there, and what I'm trying to add is a _domain name_ as an alias
for 127.0.0.1.

Anyway, I think I'm going to have to let this one go for now
and figure out some other way to do this. Thanks.
 
Old 12-05-2005, 10:53 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
I don't think it is distro specific because it does the same in RH 9, RH 7, RH EL AS 3, Fedora 3, RH EL AS4, Fedora 4 (all of which are RedHat derivaives I know) but also in Debian (which is NOT a RedHat derivative). Also nearly everyone that responded to the thread I posted at the time I ran across this thought I was a moron for expecting it to work. It appears to be Linux specific though of course one could modify the source to make it do whatever they want.
 
  


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
adding alias wlan0 prism2_usb fails birdseye Linux - General 0 11-19-2005 05:42 AM
Adding Network Interface alias from command line WireLine Fedora 2 06-08-2005 11:08 PM
adding perm. alias to .bashrc Lleb_KCir Linux - General 7 12-09-2004 02:35 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
Adding a host to /etc/hosts kzazula Linux - Newbie 1 10-25-2003 12:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 02:42 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