Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Name resolution
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
acidreign
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 122
Location: Brisbane, Australia

PostPosted: Sat May 04, 2002 3:42 am    Post subject: Name resolution Reply with quote

Belive it or not, i have found something that effects alot of desktop application speed, is name resolution. Adding your ip and hostname to your /etc/hosts can sometimes an application change from "sluggish" to smooth.
Back to top
View user's profile Send private message
fghellar
Bodhisattva
Bodhisattva


Joined: 10 Apr 2002
Posts: 856
Location: Porto Alegre, BR

PostPosted: Sat May 04, 2002 4:15 am    Post subject: Reply with quote

This is a nice trick. I've made this post sticky. :)
_________________
| www.gentoo.org | www.tldp.org | www.google.com |
Back to top
View user's profile Send private message
lk42pro
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 114
Location: New Jersey, USA

PostPosted: Sun May 05, 2002 3:37 am    Post subject: Reply with quote

good thing i done it.... :lol:
_________________
"I am a wanderer, It's time for me to wander again"
Back to top
View user's profile Send private message
paulisdead
Guru
Guru


Joined: 10 Apr 2002
Posts: 510
Location: Seattle, WA

PostPosted: Sun May 05, 2002 6:10 pm    Post subject: Reply with quote

Would anybody happen to know how you're supposed to do this if you use DHCP? If all the IPs on the LAN start with 10.0.0, should I put that into my hosts file?

*Edit*Nevermind I just figured it out, finally. I should have just gone to google first. Anyways, to set this up for DHCP, put this in your /etc/hosts file

source /etc/dhcpc/dhcpcd-eth0.info #where eth0 is your nic
$IPADDR [hostname]
Back to top
View user's profile Send private message
Jeevz
Bodhisattva
Bodhisattva


Joined: 15 Apr 2002
Posts: 195
Location: Boston, MA

PostPosted: Sun May 05, 2002 6:43 pm    Post subject: Reply with quote

paulisdead wrote:
Would anybody happen to know how you're supposed to do this if you use DHCP? If all the IPs on the LAN start with 10.0.0, should I put that into my hosts file?

*Edit*Nevermind I just figured it out, finally. I should have just gone to google first. Anyways, to set this up for DHCP, put this in your /etc/hosts file

source /etc/dhcpc/dhcpcd-eth0.info #where eth0 is your nic
$IPADDR [hostname]


Can also use your loop back IP address: 127.0.0.1
Back to top
View user's profile Send private message
west
n00b
n00b


Joined: 09 May 2002
Posts: 28
Location: Dinamarca

PostPosted: Mon May 13, 2002 10:41 pm    Post subject: Reply with quote

Doesn't X complain if you don't do it?
[edit: add 127.0.0.1 and hostname to /etc/hosts that is :]

(no, cant check, sitting on a [W-word]-box now ... :roll:)
Back to top
View user's profile Send private message
Curious
Bodhisattva
Bodhisattva


Joined: 13 May 2002
Posts: 395
Location: Sydney, Australia

PostPosted: Tue May 14, 2002 1:52 am    Post subject: Reply with quote

Oh yeah, this one got me on KDE3 for the first time - but remember you might also need to alter and or create /etc/host.conf ( I think ) so it says:

Code:
order hosts,bind


This will tell it to search the hosts files before querying name servers ( which is probably the best way to do it. )

And there I was wondering why my gateway was dialling everytime I started KDE. :-P

Bryn.
_________________
Are you down with the Hawk?
Back to top
View user's profile Send private message
FINITE
Guru
Guru


Joined: 10 May 2002
Posts: 449

PostPosted: Thu May 16, 2002 2:15 am    Post subject: Reply with quote

Hmm, maybe this is my prob with kde. Will have to check it out. Thanx :D
Back to top
View user's profile Send private message
rlyacht
Apprentice
Apprentice


Joined: 17 Apr 2002
Posts: 170

PostPosted: Sat May 18, 2002 1:40 am    Post subject: What to put in /etc/hosts for dhcp??? Reply with quote

I am usng dhcp and it's working fine. However my machine can't look itself up. That is (machine is named tumnus), I can't ping tumnus. This is causing me some trouble. Code that does gethostbyname fails. I saw this post:

Code:
DHCP, put this in your /etc/hosts file

source /etc/dhcpc/dhcpcd-eth0.info #where eth0 is your nic
$IPADDR [hostname]


but it doesn't work for me, and seems to be inconsistent with the man page for /etc/hosts. It kinds of makes sense. Are people literally using an /etc/hosts that looks like
Code:

127.0.0.1 localhost
source /etc/dhcpc/dhcpcd-eth0.info 
$IPADDR tumnus
Back to top
View user's profile Send private message
acidreign
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 122
Location: Brisbane, Australia

PostPosted: Mon May 20, 2002 6:53 am    Post subject: Dont panic if you dont have an /etc/hosts.conf Reply with quote

Curious wrote:
Oh yeah, this one got me on KDE3 for the first time - but remember you might also need to alter and or create /etc/host.conf ( I think ) so it says:

Code:
order hosts,bind


This will tell it to search the hosts files before querying name servers ( which is probably the best way to do it. )

And there I was wondering why my gateway was dialling everytime I started KDE. :-P

Bryn.


Just a quick note, the order hosts, bind is no longer in use.(With the new glibc anyway) It has been replaced by a more global settings file called /etc/nsswitch.conf.

It should contain the line.

Code:
 hosts:       files dns


Which is the new standard for the glibc configuration.
Back to top
View user's profile Send private message
acidreign
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 122
Location: Brisbane, Australia

PostPosted: Mon May 20, 2002 6:54 am    Post subject: Mental note to self Reply with quote

UNTICK THE BOX TO DISABLE BBCODE IN THIS POST.
Back to top
View user's profile Send private message
Curious
Bodhisattva
Bodhisattva


Joined: 13 May 2002
Posts: 395
Location: Sydney, Australia

PostPosted: Mon May 20, 2002 10:05 am    Post subject: Re: Dont panic if you dont have an /etc/hosts.conf Reply with quote

acidreign wrote:

Just a quick note, the order hosts, bind is no longer in use.(With the new glibc anyway) It has been replaced by a more global settings file called /etc/nsswitch.conf.


That's quite interesting... I have this file ( /etc/nsswitch.conf ), and it is configured as described - and yet name lookups were definitely causing dialups as the resolver tried to contact primary and secondary dns on 203.56.8.1 and 203.56.8.2 respectively.

Very odd. Very odd.
_________________
Are you down with the Hawk?
Back to top
View user's profile Send private message
gsfgf
Veteran
Veteran


Joined: 08 May 2002
Posts: 1266

PostPosted: Wed May 22, 2002 10:34 pm    Post subject: Reply with quote

I can tell.
Back to top
View user's profile Send private message
bakgwailo
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2002
Posts: 113

PostPosted: Sat Jun 01, 2002 10:25 pm    Post subject: host name with attbi? Reply with quote

What host name should I use with ATT Broad Band ? They wont give you one as its assigned by DHCPCD (I think...). I've tried everything as a host name and IP addy, but they all cause errors at boot (host name is invalid, etc.). Any suggestions? Also, if it matters, this comp is hooked up to a 4 port Belkin router. Thanks!

joe
_________________
aiya, tau tong ah!
Back to top
View user's profile Send private message
betatim
n00b
n00b


Joined: 18 Apr 2002
Posts: 28

PostPosted: Wed Jun 05, 2002 8:37 am    Post subject: Reply with quote

having a look at the nsswitch.conf fiel i found this
Code:
networks:    files dns


what exactly is this??which fiels does it look at?or what does it try to fidn out ?? it isn't nameresolution but network resolution ???
_________________
Never underestimate the power of stupid people in large groups.
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Wed Jun 05, 2002 6:05 pm    Post subject: Reply with quote

betatim wrote:
having a look at the nsswitch.conf fiel i found this
Code:
networks:    files dns


what exactly is this??which fiels does it look at?or what does it try to fidn out ?? it isn't nameresolution but network resolution ???


Whoa there Kimosabe... your about to have a coronary there....

that just tells in what order to do name resolution. It's checking files first (/ec/resolv.conf, /etc/hosts) then it goes for DNS.

name and network resolution soemetimes go hand in hand.... it's all translation of a human name to a number system.
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Wed Jun 05, 2002 6:11 pm    Post subject: Re: host name with attbi? Reply with quote

bakgwailo wrote:
What host name should I use with ATT Broad Band ? They wont give you one as its assigned by DHCPCD (I think...). I've tried everything as a host name and IP addy, but they all cause errors at boot (host name is invalid, etc.). Any suggestions? Also, if it matters, this comp is hooked up to a 4 port Belkin router. Thanks!

joe


that you would have to ask them, but it honestly shouldn't matter. I just made up one.

Mine is orioncomputing.com...

Where do you get errors? is it when sendmail (or whatever) pops up, or what?
Back to top
View user's profile Send private message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Sat Jun 15, 2002 9:19 am    Post subject: Reply with quote

ok, so now im confused...

since im using dhcp what file do i edit and what do i put in it?

so many people said different things :(

ryan
_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
sonicwave
n00b
n00b


Joined: 18 Apr 2002
Posts: 28
Location: The Netherlands

PostPosted: Sat Jun 15, 2002 11:15 am    Post subject: Reply with quote

I simply use: 127.0.0.1 <hostname>

And i am using DHCP all the time.. but as that IP is a loopback to your own computer it should do the trick.
Back to top
View user's profile Send private message
johnnyb
n00b
n00b


Joined: 20 Jun 2002
Posts: 2
Location: California, USA

PostPosted: Thu Jun 27, 2002 2:31 am    Post subject: /etc/hosts and releated files for DHCP clients Reply with quote

1) Make sure /etc/hostname contains a single line with your complete hostname like this:
Code:
[hostname].[domain]


Example:
Code:
gladiator.exampledomain.com

(Yes, the domain name is part of your fully qualified hostname.)

2) Make sure /etc/hosts looks like this:

Code:
127.0.0.1     localhost [hostname].[domain] [hostname]


Example:
Code:
127.0.0.1     localhost gladiator.exampledomain.com gladiator


2b) If you have a static IP, /etc/hosts should look like this:
Code:
127.0.0.1       localhost
##.##.##.##     [hostname].[domain] [hostname]


Example:
Code:
127.0.0.1       localhost
192.168.0.1     www.gentoo.org www


3) In /etc/nsswitch.conf there should be a line that says:
Code:
hosts: files dns

(This appears to be the default for a Gentoo system.)
Back to top
View user's profile Send private message
csnyder
n00b
n00b


Joined: 18 Jun 2002
Posts: 44
Location: Grand Rapids, MI

PostPosted: Mon Jul 01, 2002 10:58 pm    Post subject: Reply with quote

paulisdead wrote:
Nevermind I just figured it out, finally. I should have just gone to google first. Anyways, to set this up for DHCP, put this in your /etc/hosts file

source /etc/dhcpc/dhcpcd-eth0.info #where eth0 is your nic
$IPADDR [hostname]


Sorry, but that doesn't work - /etc/hosts is not a shell script. Here's something I just figured out. You have to modify your /etc/init.d/net.xxx files for this to work. New code is the last three lines:

Code:

                /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
                }
                source /etc/dhcpc/dhcpcd-${IFACE}.info
                echo "127.0.0.1 localhost
${IPADDR} `hostname -s` `hostname`" > /etc/hosts


The new code started at line 42 for me.

Note: this wipes out your /etc/hosts file. If you have any other hosts in this file, you should add them to this script as well.

Another note: If the DHCP client gets another IP without being restarted, this won't be taken into account. There must be a better way to do this than this. :idea:
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Thu Jul 04, 2002 12:48 am    Post subject: Reply with quote

csnyder wrote:
/sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
retval=$?
eend ${retval} "Failed to bring ${IFACE} up"
return ${retval}
}
source /etc/dhcpc/dhcpcd-${IFACE}.info
echo "127.0.0.1 localhost
${IPADDR} `hostname -s` `hostname`" > /etc/hosts

This didnt work for me. but his idea pointed the way.
code:
/sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
retval=$?
eend ${retval} "Failed to bring ${IFACE} up"
return ${retval}
}
source /etc/dhcpc/dhcpcd-eth0.info
echo "127.0.0.1 localhost
$IPADDR gentoo.$DOMAIN gentoo" > /etc/hosts
cat /etc/resolv.conf >> /etc/hosts

Thisl yields a hosts file like this.
hosts:
127.0.0.1 localhost
68.7.73.38 gentoo.sd.cox.net gentoo
nameserver 68.6.16.30
nameserver 68.2.16.30
nameserver 68.1.17.5
search sd.cox.net

One beni is my dns lookups are sure fast :lol: THe only prob is a Xserver
fragment that only shows up when running links in a xterm. Its about finding 'service host found in line 1 host.conf.
Back to top
View user's profile Send private message
rommel
Veteran
Veteran


Joined: 19 Apr 2002
Posts: 1141
Location: Williamsburg Virginia

PostPosted: Thu Jul 04, 2002 2:13 am    Post subject: Reply with quote

i added it to the 127.0.0.0 loop since i run dhcpcd but i wasnt having i dont think problems before...i cant really say i see any speed difference with my hostname added to hosts
Back to top
View user's profile Send private message
csnyder
n00b
n00b


Joined: 18 Jun 2002
Posts: 44
Location: Grand Rapids, MI

PostPosted: Fri Jul 05, 2002 4:09 am    Post subject: Reply with quote

rommel wrote:
i added it to the 127.0.0.0 loop since i run dhcpcd but i wasnt having i dont think problems before...i cant really say i see any speed difference with my hostname added to hosts


I don't notice a speed difference either. My main reason for running this is that Apache won't start if it can't resolve its own hostname, and I want it to be able to start even if the nameserver is down.
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Sat Jul 06, 2002 5:37 am    Post subject: Reply with quote

The speed increace Ive seen is that I rarely see "looking up URL", its quite often just "loading sight".. If you'er using cox.net this isnt correst yet in that your IP ex: 67.7.71.120 and domain: sd.cox.net and marry them as so
ip67-7-71-120sd.sd.cox.net. Im just learning bash scripting so im puzzeling how to parse this. It might actualy take 3 rewrites of 'hosts'to do this correctly. I'll it in the next wk.

hielvc
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum