View previous topic :: View next topic |
Author |
Message |
acidreign Tux's lil' helper
Joined: 21 Apr 2002 Posts: 122 Location: Brisbane, Australia
|
Posted: Sat May 04, 2002 3:42 am Post subject: Name resolution |
|
|
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 |
|
|
fghellar Bodhisattva
Joined: 10 Apr 2002 Posts: 856 Location: Porto Alegre, BR
|
|
Back to top |
|
|
lk42pro Tux's lil' helper
Joined: 21 Apr 2002 Posts: 114 Location: New Jersey, USA
|
Posted: Sun May 05, 2002 3:37 am Post subject: |
|
|
good thing i done it.... _________________ "I am a wanderer, It's time for me to wander again" |
|
Back to top |
|
|
paulisdead Guru
Joined: 10 Apr 2002 Posts: 510 Location: Seattle, WA
|
Posted: Sun May 05, 2002 6:10 pm Post subject: |
|
|
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 |
|
|
Jeevz Bodhisattva
Joined: 15 Apr 2002 Posts: 195 Location: Boston, MA
|
Posted: Sun May 05, 2002 6:43 pm Post subject: |
|
|
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 |
|
|
west n00b
Joined: 09 May 2002 Posts: 28 Location: Dinamarca
|
Posted: Mon May 13, 2002 10:41 pm Post subject: |
|
|
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 ... ) |
|
Back to top |
|
|
Curious Bodhisattva
Joined: 13 May 2002 Posts: 395 Location: Sydney, Australia
|
Posted: Tue May 14, 2002 1:52 am Post subject: |
|
|
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:
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.
Bryn. _________________ Are you down with the Hawk? |
|
Back to top |
|
|
FINITE Guru
Joined: 10 May 2002 Posts: 449
|
Posted: Thu May 16, 2002 2:15 am Post subject: |
|
|
Hmm, maybe this is my prob with kde. Will have to check it out. Thanx |
|
Back to top |
|
|
rlyacht Apprentice
Joined: 17 Apr 2002 Posts: 170
|
Posted: Sat May 18, 2002 1:40 am Post subject: What to put in /etc/hosts for dhcp??? |
|
|
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 |
|
|
acidreign Tux's lil' helper
Joined: 21 Apr 2002 Posts: 122 Location: Brisbane, Australia
|
Posted: Mon May 20, 2002 6:53 am Post subject: Dont panic if you dont have an /etc/hosts.conf |
|
|
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:
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.
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.
Which is the new standard for the glibc configuration. |
|
Back to top |
|
|
acidreign Tux's lil' helper
Joined: 21 Apr 2002 Posts: 122 Location: Brisbane, Australia
|
Posted: Mon May 20, 2002 6:54 am Post subject: Mental note to self |
|
|
UNTICK THE BOX TO DISABLE BBCODE IN THIS POST. |
|
Back to top |
|
|
Curious Bodhisattva
Joined: 13 May 2002 Posts: 395 Location: Sydney, Australia
|
Posted: Mon May 20, 2002 10:05 am Post subject: Re: Dont panic if you dont have an /etc/hosts.conf |
|
|
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 |
|
|
gsfgf Veteran
Joined: 08 May 2002 Posts: 1266
|
Posted: Wed May 22, 2002 10:34 pm Post subject: |
|
|
I can tell. |
|
Back to top |
|
|
bakgwailo Tux's lil' helper
Joined: 31 May 2002 Posts: 113
|
Posted: Sat Jun 01, 2002 10:25 pm Post subject: host name with attbi? |
|
|
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 |
|
|
betatim n00b
Joined: 18 Apr 2002 Posts: 28
|
Posted: Wed Jun 05, 2002 8:37 am Post subject: |
|
|
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 |
|
|
arkane l33t
Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Wed Jun 05, 2002 6:05 pm Post subject: |
|
|
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 |
|
|
arkane l33t
Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Wed Jun 05, 2002 6:11 pm Post subject: Re: host name with attbi? |
|
|
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 |
|
|
kraylus l33t
Joined: 07 Jun 2002 Posts: 648 Location: ft.worth.tx
|
Posted: Sat Jun 15, 2002 9:19 am Post subject: |
|
|
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 |
|
|
sonicwave n00b
Joined: 18 Apr 2002 Posts: 28 Location: The Netherlands
|
Posted: Sat Jun 15, 2002 11:15 am Post subject: |
|
|
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 |
|
|
johnnyb n00b
Joined: 20 Jun 2002 Posts: 2 Location: California, USA
|
Posted: Thu Jun 27, 2002 2:31 am Post subject: /etc/hosts and releated files for DHCP clients |
|
|
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:
(This appears to be the default for a Gentoo system.) |
|
Back to top |
|
|
csnyder n00b
Joined: 18 Jun 2002 Posts: 44 Location: Grand Rapids, MI
|
Posted: Mon Jul 01, 2002 10:58 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
hielvc Advocate
Joined: 19 Apr 2002 Posts: 2805 Location: Oceanside, Ca
|
Posted: Thu Jul 04, 2002 12:48 am Post subject: |
|
|
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 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 |
|
|
rommel Veteran
Joined: 19 Apr 2002 Posts: 1145 Location: Williamsburg Virginia
|
Posted: Thu Jul 04, 2002 2:13 am Post subject: |
|
|
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 |
|
|
csnyder n00b
Joined: 18 Jun 2002 Posts: 44 Location: Grand Rapids, MI
|
Posted: Fri Jul 05, 2002 4:09 am Post subject: |
|
|
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 |
|
|
hielvc Advocate
Joined: 19 Apr 2002 Posts: 2805 Location: Oceanside, Ca
|
Posted: Sat Jul 06, 2002 5:37 am Post subject: |
|
|
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 |
|
|
|