# 'Server not found' by Firefox at launch [Solved]

## Fitzcarraldo

I'm just posting this in case someone else runs into the same problem.

I did a world update yesterday and today found that, whenever I launched Firefox, it displayed the 'Server not found' page and I had to click 'Try Again', and then Firefox displayed the expected Web site. From then onwards, Firefox would work as expected until I exited the application. Similarly, when I launched Thunderbird it could not access my e-mail accounts and I had to click a couple of times on 'Get Mail' for Thunderbird to access my e-mail accounts. I noticed that net-misc/networkmanager and kde-misc/networkmanagement were amongst the many packages updated on my laptop yesterday, so I assume one of these might have been the cause of the new behaviour. 

I used Wireshark to see what was going on and it transpired that Gentoo was using IPv6 addresses. When these addresses did not work ('server not found'), Gentoo then used an IPv4 address (which is why clicking 'Try Again' worked).

I should point out that a) IPv6 was (and still is) disabled in Network Management Settings on my laptop, b) I've always had IPv6 enabled in my kernels, and c) I've never before had to disable IPv6 in Firefox or Thunderbird. So why the change in functionality now, I wonder?

With Wireshark capturing packets, when I launched Firefox or Thunderbird I was seeing a server failure message indicating "AAAA" (IPv6) instead of "A" (IPv4).

To stop this happening I could have used about:config in Firefox and Configure Editor in Thunderbird, respectively, to change the value of network.dns.disableIPv6 to true instead of false, or I could have disabled IPv6 system-wide by editing /etc/modprobe.d/aliases.conf and uncommenting the line "alias net-pf-10 off". I chose to do the latter because the problem would affect applications other than Firefox and Thunderbird that access the Internet.

BTW, there is a file named /etc/gai.conf which it appears could be edited to make Gentoo send an IPv4 address first and an IPv6 address second, rather than  the other way around, but I did not bother to try that.

----------

## Fitzcarraldo

The person who helped me diagnose the problem described in my earlier post has just sent me the explanation below. He happens to be an Ubuntu user, and has the same model of router as me.

 *Quote:*   

> I did some more digging and found RFC 4074 that describes the problem - Common Misbehaviour Against DNS Queries for IPv6 Addresses.
> 
> http://tools.ietf.org/html/rfc4074
> 
> It would appear that with the growth in IPv6 implementations not all DNS servers respond quite as they should to DNS requests for IPv6 addresses. See Section 4 - Problematic Behaviours.
> ...

 

----------

## Fitzcarraldo

Found another way around the problem, and it does not require IPv6 to be disabled system-wide nor in the application:

http://www.mydailytechtips.com/2010/10/how-to-fix-slow-dns-issue-in-fedora.html

I added a Bash script in the directory /etc/NetworkManager/dispatcher.d/ that appends the line "options single-request" to /etc/resolv.conf. The addition of the line "options single-request" to resolve.conf causes the getaddrinfo() function in glibc to make the IPv4 and IPv6 requests sequentially rather than in parallel. With this change, Firefox and Thunderbird no longer have a problem accessing the Internet the first time they are launched.

From "man 5 resolv.conf" under "options":

 *Quote:*   

> single-request (since glibc 2.10)
> 
>   sets RES_SNGLKUP in _res.options.  By default, glibc performs IPv4 and IPv6 lookups in parallel since version 2.9.  Some appliance DNS servers
> 
>   cannot  handle  these queries properly and make the requests time out.  This option disables the behavior and makes glibc perform the IPv6 and
> ...

 

I had to use NetworkManagerDispatcher to add the line "options single-request" to /etc/resolv.conf because NetworkManager overwrites /etc/resolv.conf if you edit it manually.

----------

## PaulBredbury

This "sometimes have to load a page twice" issue has been fixed for me, after being an annoyance for years. I think one or both of these helped:

Opensuse's glibc patch: getaddrinfo-ipv6-sanity.diff

Uninstalled libproxy

----------

