View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 12-05-2007, 09:43 AM   #1
Registered: Jan 2007
Posts: 35

Rep: Reputation: 15
Cool Append DNS suffix in Linux

I have the following problem or dilema:

In windows whenever I try to ping a hostname I just use for example
"ping avatar" in which the dns server responds and answers me with the ip of the machine named avatar.

In windows however the append suffix name is made automatically so when I do "ping avatar" it goes automatically to "ping avatar.test" cause that's the dns suffix.

When I try to use the same command in linux "ping avatar" it says it's unknown host name. So I'm going to /etc/hosts file and I make it manually. In this way it works. But from the /etc/host.conf file it says that first it goes to hosts and then bind file.

My question is how do I make it to append dns suffix automatically in Linux so when I try to "ping avatar" it goes automatically like in windows to "ping avatar.test".

Offcourse if I give the command "ping avatar.test" in linux it works. Am I missing something?
Old 12-05-2007, 09:48 AM   #2
Slackware Contributor
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,032

Rep: Reputation: 424Reputation: 424Reputation: 424Reputation: 424Reputation: 424
$ cat /etc/resolv.conf
search rlwhome.lan
Old 12-05-2007, 09:52 AM   #3
Registered: Jan 2007
Posts: 35

Original Poster
Rep: Reputation: 15
I have the following settings in resolv.conf


But it still doesn't work.

Last edited by ingerul9; 12-05-2007 at 09:53 AM.
Old 12-05-2007, 10:03 AM   #4
Gault LaRue
Registered: Jul 2005
Location: Columbia, MD
Distribution: Slackware 10.2 / 11.0 / 12.0
Posts: 38

Rep: Reputation: 15
Change "search" to just "search test" if you are looking for avatar.test.

Old 12-05-2007, 10:16 AM   #5
Registered: Jan 2007
Posts: 35

Original Poster
Rep: Reputation: 15
Ok. It worked. I am so stupid .

Now I have another question regarding the DNS section of the same problem. Whenever I try to use the command dig avatar it doesn't work but when I use dig avatar.test it works.

I know it's related to FQDN I think. Is it possible to change somewhere to resolve only when I type "dig avatar" and not "dig"

Last edited by ingerul9; 12-05-2007 at 10:31 AM.
Old 12-05-2007, 11:30 AM   #6
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

Rep: Reputation: 29
can you just type the command

man dig

you will get a answer
Old 12-05-2007, 12:09 PM   #7
Registered: Jan 2007
Posts: 35

Original Poster
Rep: Reputation: 15
I know how to look into man pages of the commands. But if I would have understood the first time from reading the man page of the dig command I wouldn't have posted here.

So do u want to enlighten me? Sometimes I miss the obvious.
Old 12-05-2007, 12:39 PM   #8
Registered: Aug 2004
Location: Matrix
Distribution: slack currrent
Posts: 61

Rep: Reputation: 16
Working on your homework?
Old 12-05-2007, 01:28 PM   #9
Registered: Jan 2007
Posts: 35

Original Poster
Rep: Reputation: 15
I'm trying to understand. I have no homework. I'm trying to learn.
Old 12-07-2007, 03:47 AM   #10
Registered: Mar 2005
Location: Right behind you.
Distribution: NBG, then randomed.
Posts: 480

Rep: Reputation: 31
Avatar.test has to actually exist, which means you'd need to have a local nameserver running the .test top-level domain (which you likely don't) for this to work.
Old 12-01-2014, 01:58 PM   #11
LQ Newbie
Registered: Dec 2014
Posts: 1

Rep: Reputation: Disabled
DNS suffix Looks up etc

As the original questions was never really answered. Let me take a quick stab at it. When looking up the name of another machine, your computer (Linux, windows) will follow the following process.
1. Look in the "hosts" file for the machine name and ip address.
2. Look up the machine via a DNS server
3. Broadcast

Lets tackle these one at a time.

Host file
If you setup a network with 2 machines one named Fred ( and another named Bob (
The two machines are on the same network but neither has a reference that allow them to see each other other via name.
if I am logged into Fred and I try to ping Bob, Fred has no idea "who" I am asking it to communicate with.
However, if I add an entry to my hosts file like this: BOB
Fred will know exactly who I want him to talk to. Based on this entry, Fred now knows that any time I reference Bob, he should immediately go to ip

DNS Server:
In it's simplest terms, a DNS server is basically a giant hosts file. Machines are added manually or dynamically to the list
of IP's and Names and other machines can query this machine in addition to their host file to match Names to IP addresses.
This is very basic description of what a DNS server does but for the purpose of this answer it will do.

We have come to a day and age where most will not remember when and how this was used to resolve machine names.
However, Using and old protocol called NetBeui, windows machine would broadcast for name resolution when they could
not match a name against the Hosts file or the DNS server. The machine with that name in turn would respond and life would continue.

For reference: Windows host files can be found under this path c:\windows\system32\drivers\etc\hosts
Linux hosts files can be found under /etc/hosts

This answer is not perfect, but at least it will point you in the right direction.

host files examples: bob

If I used ping, and refrence any of the names given, i will get the same IP address
ping bob ==>
ping ==>
ping ==>

Last edited by Sixhammers; 12-01-2014 at 02:08 PM.


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
LXer: Hash Suffix Array Delta Compression on Linux LXer Syndicated Linux News 0 11-28-2007 08:50 PM
How do I configure DNS suffix in Fedora Core 6 dperryr Linux - Newbie 1 11-01-2007 07:52 AM
DNS suffix Golzari-Ali Linux - General 2 09-30-2006 02:23 PM
can't access/locate other PCs with different DNS suffix rsumbeling Linux - Networking 1 12-06-2004 06:41 PM
BIND9 and W2k dhcp clients DNS suffix issue. wasp4141 Linux - Networking 1 04-06-2004 11:56 PM

All times are GMT -5. The time now is 01:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration