# long time resolving addresses

## onefriedrice

I'm not much of a network guy, so I need help diagnosing this problem.

Gentoo takes a long time (anywhere from 3 to 10 seconds) to resolve addresses.

I've also got Ubuntu, Fedora, and Vista installed and configured similarly (on the same machine), and they don't have this problem.

Each OS uses dhcp to get the ip address from the router (a dsl modem).  I've verified that resolv.conf is the same for each distro.

Actually, apparently ping is able to resolve the address quickly, so I don't know.  Both Opera and Firefox have a delay while 'looking up' the site.

Help is much appreciate, and thanks in advance,

Onefriedrice

----------

## SeaTiger

Is this a recent event or happen for a long time(more than 1 month)?

When did you last do "emerge -avDN update" or something similar?

----------

## onefriedrice

It's been a problem for over a month (I've had this quad-boot setup for about a month and a half).  Obviously it makes browsing slow and annoying, so I've mostly been using Ubuntu while I haven't gotten around to figuring it out.  I prefer Gentoo, though, so I reckon it's to figure this out so I can spend most of my time here.  I updated world yesterday, so the software is recent.

I don't see any configuration differences between my Gentoo and Ubuntu, so it's kinda a mystery.

My configuration consists of this (/etc/conf.d/net):

```
config_eth0=("null")

config_eth1=("dhcp")

```

And here's what ifconfig says:

```
eth0      Link encap:Ethernet  HWaddr 00:50:8D:B3:D2:AC  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:23 Base address:0x4000 

eth1      Link encap:Ethernet  HWaddr 00:50:8D:B3:D2:AD  

          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::250:8dff:feb3:d2ad/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:426 errors:0 dropped:0 overruns:0 frame:0

          TX packets:430 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:188527 (184.1 Kb)  TX bytes:82930 (80.9 Kb)

          Interrupt:22 Base address:0x6000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

Looks reasonable to me, but I'm no genius.  Anyone see anything wrong with this?

Thanks much,

Onefriedrice

----------

## SeaTiger

Seems you don't have a default route, assume your gateway is 192.168.0.1, the following line should be in your /etc/conf.d/net :

```
routes_eth1="default via 192.168.0.1"
```

Try command "route", if the output doesn't have a line like the following then that properly is the problem:

```
default         192.168.0.1     0.0.0.0         UG    2      0        0 eth1
```

----------

## DarKRaveR

Is there any particular reson why one would use DHCP and not get the default gate from the DHCP server. And if he hadn't a default gateway, he would most certainly not be able to resolve at all.

Now, it seem sthat command line tools (ping he said) works, I assume they use the lighteight resolver lib mor or less directly (not taking nsswitch into account for now).

The major difference is, Firefox/Opera are using a desktop enivronment, they might not directly call the resolver lib but using some abstract layer in between to transparently use different resolving services which might be responsible for the delays.

My first uestion is, did you use any avahi/zroconf flags or something like that, which has an impact on name resolution?

My advice would be to run firefox from the console, by runing it through ltrace/strace and try to track down, where the delay is introduced ... i.e. which system call or library call takes several seconds to return.

----------

## SeaTiger

Oops, my bad, I forget that he is using DHCP  :Embarassed: 

But, still, try the "route" command and see if there is a default gateway.

----------

## DarKRaveR

 *junksiu wrote:*   

> Oops, my bad, I forget that he is using DHCP 
> 
> But, still, try the "route" command and see if there is a default gateway.

 

You are right, doing a quick check if the route is set up properl won't do any harm.

@Opener:

You said, you compared the resolve.confs and they are identical - I assume you have them autogenerated by the dhcp client anyway?

----------

## Erulabs

Could you please post the stats section of the output of dig?

Please do both:

# dig gentoo.org

and

# dig gentoo.org @bitsy.mit.edu

You will see a "Query time" and a "SERVER" line. What server are you querying when doing # dig gentoo.org?

----------

## onefriedrice

```
# route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 eth1

link-local      *               255.255.0.0     U     0      0        0 eth1

loopback        *               255.0.0.0       U     0      0        0 lo

default         dslmodem.domain 0.0.0.0         UG    0      0        0 eth1

```

I have both avahi and zeroconf flags set in make.conf.

Also, resolv.conf is autogenerated in each OS by the dhcp client (dhcpcd in the case of Gentoo), and they end up being identical.

```
# dig gentoo.org

;; Query time: 82 msec

;; SERVER: 192.168.0.1#53(192.168.0.1)
```

```
# dig gentoo.org @bitsy.mit.edu

;; Query time: 111 msec

;; SERVER: 18.72.0.3#53(18.72.0.3)
```

The command line programs seem to be able to resolve quickly.  Does this narrow it down to something related to the desktop environment?  Interesting.. I'm running fluxbox at the moment, and the delay also exists in KDE3.5 (which I no longer have installed).

Thanks for the help,

Onefriedrice

----------

## jcat

Dig query is obviously fine, but I think dig just uses DNS, you need to just check your hosts entire name resolution layer with a quick

```
ping google.com
```

If that resolves the name quickly as well, then it must be some browser based issue.

Cheers,

jcat

----------

## DarKRaveR

dig does the NS lookup itself, sine cmd line tools work w/o problems it was obvious this wasn'T necessary.

if ping and the like (try ftp maybe, or telnet) all resolve quickly, then it usualy is, because they resolve through libresolv (lightweight resolver lib).

I bet ffox/opera resolv through avahi or something, which is screwing up (for whatever reason, that's to see later).

As I recommended, I'd trace firefox and check which calls it does - if some common (gnome, whatever you use) lib is used which in turns does avahi (libreswolv etc.) then it would effect all GUI related tools using this lib.

Another option to start with could be, to check the ependency grph of mozilla firefox, see if it indirectly depends on avahi for example and which package might need avahi etc. 

And I am really curious if firefox uses avahi in you setup, you could trace firefox and se if it accesses avahis local socket ...

----------

## SeaTiger

onefriedrice,

Can you post out put for "emerge --info" and "eix mozilla-firefox", that can tell us the compile option used for your browser.

Also, did you test with Opera, which is a completely different browser.

----------

## onefriedrice

```
# emerge --info

Portage 2.1.4.4 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-gentoo-r9 x86_64)

=================================================================

System uname: 2.6.23-gentoo-r9 x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz

Timestamp of tree: Mon, 21 Apr 2008 01:00:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:     3.2_p17-r1

dev-lang/python:     2.4.4-r9

dev-python/pycrypto: 2.0.1-r6

dev-util/ccache:     2.4-r7

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.1

sys-devel/binutils:  2.18-r1

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=nocona -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"

CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-march=nocona -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://mirror.usu.edu/mirrors/gentoo/ http://public.planetmirror.com/pub/gentoo/"

LANG="C"

MAKEOPTS="-j5"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X aac acl acpi alsa amd64 arts bash-completion berkdb bzip2 cairo cddb cdparanoia cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam firefox flac fortran ftp gdbm gif glut gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg jpeg2k kerberos lame ldap loop-aes lua mad midi mikmod mmx mp3 mpeg mudflap musicbrainz ncurses nls nptl nptlonly nsplugin objc objc++ ogg openal opengl openmp oss pam pcre pdf perl png posix pppd python qt3 qt3support qt4 quicktime readline reflection samba sdl session sockets spell spl sse sse2 ssl svg tcpd threads tiff truetype unicode usb vcd videos vim-syntax vim-with-x vorbis x264 xine xml xorg xscreensaver xv xvid xvmc zlib" ALSA_CARDS="snd_hda_intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

```
# eix mozilla-firefox

[I] www-client/mozilla-firefox

     Available versions:  2.0.0.11 2.0.0.12 2.0.0.13 2.0.0.14 [M]~3.0_beta5-r1 {+xulrunner bindist dbus debug filepicker gnome iceweasel ipv6 java linguas_af linguas_ar linguas_be linguas_bg linguas_ca linguas_cs linguas_da linguas_de linguas_el linguas_en linguas_en_GB linguas_en_US linguas_es linguas_es_AR linguas_es_ES linguas_eu linguas_fi linguas_fr linguas_fy linguas_fy_NL linguas_ga linguas_ga_IE linguas_gu linguas_gu_IN linguas_he linguas_hu linguas_id linguas_it linguas_ja linguas_ka linguas_ko linguas_ku linguas_lt linguas_mk linguas_mn linguas_nb linguas_nb_NO linguas_nl linguas_nn linguas_nn_NO linguas_pa linguas_pa_IN linguas_pl linguas_pt linguas_pt_BR linguas_pt_PT linguas_ro linguas_ru linguas_sk linguas_sl linguas_sq linguas_sv linguas_sv_SE linguas_tr linguas_uk linguas_zh linguas_zh_CN linguas_zh_TW mozdevelop moznopango restrict-javascript startup-notification xforms xinerama xprint}

     Installed versions:  2.0.0.14(20:30:49 04/20/08)(ipv6 -bindist -debug -filepicker -gnome -iceweasel -java -linguas_af -linguas_ar -linguas_be -linguas_bg -linguas_ca -linguas_cs -linguas_da -linguas_de -linguas_el -linguas_en -linguas_en_GB -linguas_en_US -linguas_es -linguas_es_AR -linguas_es_ES -linguas_eu -linguas_fi -linguas_fr -linguas_fy -linguas_fy_NL -linguas_ga -linguas_ga_IE -linguas_gu -linguas_gu_IN -linguas_he -linguas_hu -linguas_it -linguas_ja -linguas_ka -linguas_ko -linguas_ku -linguas_lt -linguas_mk -linguas_mn -linguas_nb -linguas_nb_NO -linguas_nl -linguas_nn -linguas_nn_NO -linguas_pa -linguas_pa_IN -linguas_pl -linguas_pt -linguas_pt_BR -linguas_pt_PT -linguas_ro -linguas_ru -linguas_sk -linguas_sl -linguas_sv -linguas_sv_SE -linguas_tr -linguas_uk -linguas_zh -linguas_zh_CN -linguas_zh_TW -mozdevelop -moznopango -restrict-javascript -xforms -xinerama -xprint)

     Homepage:            http://www.mozilla.org/projects/firefox/

     Description:         Firefox Web Browser

* www-client/mozilla-firefox-bin

     Available versions:  2.0.0.14 [M]~3.0_beta5 {linguas_af linguas_ar linguas_be linguas_bg linguas_ca linguas_cs linguas_da linguas_de linguas_el linguas_en linguas_en_GB linguas_en_US linguas_es linguas_es_AR linguas_es_ES linguas_eu linguas_fi linguas_fr linguas_fy linguas_fy_NL linguas_ga linguas_ga_IE linguas_gu linguas_gu_IN linguas_he linguas_hu linguas_id linguas_it linguas_ja linguas_ka linguas_ko linguas_ku linguas_lt linguas_mk linguas_mn linguas_nb linguas_nb_NO linguas_nl linguas_nn linguas_nn_NO linguas_pa linguas_pa_IN linguas_pl linguas_pt linguas_pt_BR linguas_pt_PT linguas_ro linguas_ru linguas_sk linguas_sl linguas_sq linguas_sv linguas_sv_SE linguas_tr linguas_uk linguas_zh linguas_zh_CN linguas_zh_TW restrict-javascript}

     Homepage:            http://www.mozilla.com/firefox

     Description:         Firefox Web Browser

Found 2 matches.

```

Sorry it's been a while since I've been back here.  In the meantime, since it was suspected that avahi or zeroconf might have had something to do with this problem, I removed both flags (and updated with newuse) since I don't use zeroconf functionality anyway; unfortunately the delay continues to exist in both firefox and opera (and lynx, by the way, although links is fine).

Actually, that's interesting.  Lynx exhibits the delay and links does not.  They both seem to load libresolv.  Well, I don't know what to make of that.  Any further advice would be much appreciated of course.

Cheers,

Onefriedrice

----------

