# dns resolve issue

## salemoh

Hi All,

I'm having a weird network problem. When I use portage (emerge) to access packages on the internet (gentoo mirrors) it can't resolve the server name. 

If I ping the server name and then use emerge again it works  :Shocked:  !!!!

Any ideas?!!!

----------

## fennec

do you have correct nameserver in /etc/resolv.conf ?

----------

## mayday147

As an ultimate solution , you can do this

```
host ftp.your_gentoo_mirror.org

###then add the IP address in /etc/hosts as:

212.93.150.12    ftp.your_gentoo_mirror.org
```

----------

## salemoh

My machine is running a static IP and /etc/resolv.conf has the correct nameserver entry. 

Just to be on the safe side I started Knoppix and did the settings for the values and I was able to correctly connect to the net.

What is weird is that ping actually works and can see the sites but other applications can't (read something about disabling IPv6 but when I do that I loose connectivity all together).

After I ping a site other applications can resolve it too.

----------

## Anton Gubarkov

Thanks for a workaround. Putting the favourite mirror IP to /etc/hosts did the trick for me. 

I just wonder why the DNS resolver works for ping and doesn't work for emerge  :Sad: 

----------

## phoeniximago

For what its worth I have the same problem and am using the same workaround with success. Years ago I installed gentoo on a pc (its a mac laptop this time) and had the same problem. The common denominator is my router... I wonder whether firewall settings could have something to do with it?

Rob

----------

## PaulBredbury

 *salemoh wrote:*   

> has the correct nameserver entry.

 

Sounds like your nameserver is slow  :Wink: 

Try opendns or install bind.

----------

## phoeniximago

But surely no matter how slow the dns lookup emerge would wait for the IP address rather than going ahead and trying to connect to 1.0.0.0? Thing is I have a windozepc, two macs and a debian machine all working through this router with no complaints. Gentoo's the only thing that has a problem which is a shame 'cos my gentoo laptop's the only one I actually enjoy using these days!

OK, now here's the really weird thing. I've got Thunderbird working for my email and it works fine but when I tried claws-mail and mutt they didn't work at all. The manual config of mutt jogged me into trying putting imap.gmail.com's IP into my etc/hosts and bingo suddenly mutt works fine. So whatever it is mutt/claws-mail/emerge are doing triggers this attempt to connect to 1.0.0.0 while thunderbird and ping (a bizarre pairing dont ya think?!) work fine. It's no emergency 'cos there's a workaround but I've got this love/hate relationship with mysteries that keeps me yammering...

Rob

----------

## phoeniximago

Thanks Paul you were right(&I was wrong;-)! I tried opendns and suddenly I can resolve hosts when they're not in the etc/hosts. Should solve quite a few other related problems I think...

Still doesn't entirely explain why gentoo (and only some programs in gentoo at that) has a problem with my addon gwar3000 router's dns when debian, xp, vista and macos8 and 9 seem perfectly happy. If I get time I'd like to write a few test programs to see if I can find out exactly where the problem is.

----------

## phoeniximago

Great, now it seems to work sometimes but not always. Flaky is better than inoperative I suppose...

----------

## matagou

Hello

My Gentoo's /etc/resolv.conf is

```

nameserver 208.67.222.222

```

When i reboot PC the record from /etc/resolv.conf is deleted and this file become blank.

I am not using DHCP server, and i entered my IP address and netmask manually.

Any advices?

Thanks

----------

## matagou

 *matagou wrote:*   

> Hello
> 
> My Gentoo's /etc/resolv.conf is
> 
> ```
> ...

 

Hi

I've managed to resolve the above problem.

It was because of poorly configured /etc/conf.d/net

Using google && forums.gentoo.org && man pages

 :Smile: 

----------

## phoeniximago

Normally wget doesn't work (unless it's already looked up the host or its written in the /etc/hosts) but if you use the ipv4 option explicitly it works fine. The -6 option just says host not found. Any ideas anyone? I don't even need ipv6 afaics...

----------------------------------------

rob@Phoenix ~ $ wget www.phoeniximago.com/rmkcom/Classes.htm

--16:40:14--  http://www.phoeniximago.com/rmkcom/Classes.htm

           => `Classes.htm'

Resolving www.phoeniximago.com... 1.0.0.0

Connecting to www.phoeniximago.com|1.0.0.0|:80... ^C

rob@Phoenix ~ $ wget -4 www.phoeniximago.com/rmkcom/Classes.htm

--16:40:23--  http://www.phoeniximago.com/rmkcom/Classes.htm

           => `Classes.htm'

Resolving www.phoeniximago.com... 82.138.229.100

Connecting to www.phoeniximago.com|82.138.229.100|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: unspecified [text/html]

    [ <=>                                 ] 2,833         --.--K/s             

16:40:24 (16.99 MB/s) - `Classes.htm' saved [2833]

----------

