# NetworkManager doesn't do DNS resolving [solved]

## cyberpatrol

I'm trying to use NetworkManager. It finds my ethernet card (eth0) and seems to establish a wired connection. It also overwrites /etc/resolv.conf correctly. But domain names aren't resolved.

When NetworkManager is started at boot time I get this message:

```
* Starting NetworkManager ...                                                                                                                        [ ok ]

Gets connected...............    1s

 * Marking NetworkManager as inactive. It will automatically be marked

 * as started after a network connection has been established.

 * WARNING: NetworkManager has started, but is inactive
```

When I then run ping I get this error message:

```
$ ping -c 3 www.gentoo.org

ping: unknown host www.gentoo.org
```

Those are my init scripts:

```
# rc-update show

       NetworkManager |      default                 

                acpid | boot                         

            alsasound | boot                         

             bootmisc | boot                         

          consolefont | boot                         

           consolekit |      default                 

                cupsd |      default                 

                 dbus |      default                 

                devfs |                       sysinit

              dmcrypt | boot                         

                dmesg |                       sysinit

           fbcondecor | boot                         

                fcron |      default                 

                 fsck | boot                         

                  gpm |      default                 

              hddtemp |      default                 

             hostname | boot                         

              hwclock | boot                         

              keymaps | boot                         

            killprocs |              shutdown        

           lm_sensors |      default                 

                local |      default                 

           localmount | boot                         

                  lvm | boot                         

              modules | boot                         

             mount-ro |              shutdown        

                 mtab | boot                         

               net.lo | boot                         

             netmount |      default                 

              numlock |      default                 

              privoxy |      default                 

               procfs | boot                         

                 root | boot                         

            savecache |              shutdown        

                 swap | boot                         

            swapfiles | boot                         

               sysctl | boot                         

                sysfs |                       sysinit

            syslog-ng |      default                 

         termencoding | boot                         

       tmpfiles.setup | boot                         

                 udev |                       sysinit

           udev-mount |                       sysinit

              urandom | boot                         

                  xdm |      default
```

NetworkManager and nm-applet are installed with those USE flags:

```
net-misc/networkmanager-0.9.8.2-r3  USE="consolekit dhcpcd introspection modemmanager nss ppp -avahi -bluetooth -connection-sharing -dhclient -gnutls -resolvconf -systemd {-test} -vala -wext"

gnome-extra/nm-applet-0.9.8.2  USE="introspection modemmanager -bluetooth -gconf"
```

Does anyone have an idea how this can be fixed?Last edited by cyberpatrol on Tue Aug 13, 2013 4:32 am; edited 1 time in total

----------

## 666threesixes666

my system shows

mkultra@mksrv [ ~ ]$ cat /etc/resolv.conf 

nameserver 8.8.4.4

can you ping 8.8.8.8??  i set static ip and static dns on my setup....

----------

## cyberpatrol

I haven't tried it, yet, but I doubt that I want to tell Google every website I visit.

My ISP's own DNS server is working correctly since I don't have a problem with DNS resolving when using /etc/init.d/net.eth0 to establish a network connection. And NetworkManager writes the same DNS IPs into /etc/resolv.conf as /etc/init.d/net.eth0 does, just with a different comment.

----------

## 666threesixes666

comment the report of cat /etc/resolv.conf with x.x.x.x or 8.8.8.8 instead of your real dns.  don't worry ill spam their data hoard with 90,000 brazzers and gentoo hits for you.  maybe set 8.8.8.8 for testing & reporting only....

----------

## Jaglover

I'd say look at ifconfig -a output. Is your eth0 getting an IP address?

----------

## cyberpatrol

Adding 8.8.8.8 to resolv.conf doesn't help as expected.

ifconfig -a as well as nm-applet show an IP address given by my ISP. So the internet connection is established, just no DNS resolving.

Btw., I found out that `host <IP address>` doesn't work either with NetworkManager.

----------

## Jaglover

Try dig @<yourdnsyouaretesting> <somedomain>, will it resolve or give you an error? For instance, dig @8.8.8.8 www.google.gom

----------

## cyberpatrol

dig gives me that output:

```
# dig @8.8.8.8 www.google.com

; <<>> DiG 9.9.3-P2 <<>> @8.8.8.8 www.google.com

; (1 server found)

;; global options: +cmd

;; connection timed out; no servers could be reached

# dig @8.8.8.8 www.gentoo.org

; <<>> DiG 9.9.3-P2 <<>> @8.8.8.8 www.gentoo.org

; (1 server found)

;; global options: +cmd

;; connection timed out; no servers could be reached
```

The same with the DNS server of my ISP's instead of 8.8.8.8.

----------

## Jaglover

Do you have any firewall in action blocking port 53?

----------

## cyberpatrol

Port 53 is open for UDP and blocked for TCP. If it was blocked, DNS resolving wouldn't work with net.eth0 either.

----------

## 666threesixes666

"don't have a problem with DNS resolving when using /etc/init.d/net.eth0" is what confuses me with the dig results....

----------

## cyberpatrol

Btw., this is the dig output with net.eth0:

```
# dig @8.8.8.8 www.google.com

; <<>> DiG 9.9.3-P2 <<>> @8.8.8.8 www.google.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38096

;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 512

;; QUESTION SECTION:

;www.google.com.         IN   A

;; ANSWER SECTION:

www.google.com.      300   IN   A   64.15.112.109

www.google.com.      300   IN   A   64.15.112.88

www.google.com.      300   IN   A   64.15.112.98

www.google.com.      300   IN   A   64.15.112.103

www.google.com.      300   IN   A   64.15.112.108

www.google.com.      300   IN   A   64.15.112.118

www.google.com.      300   IN   A   64.15.112.99

www.google.com.      300   IN   A   64.15.112.104

www.google.com.      300   IN   A   64.15.112.84

www.google.com.      300   IN   A   64.15.112.113

www.google.com.      300   IN   A   64.15.112.119

www.google.com.      300   IN   A   64.15.112.94

www.google.com.      300   IN   A   64.15.112.89

www.google.com.      300   IN   A   64.15.112.123

www.google.com.      300   IN   A   64.15.112.114

www.google.com.      300   IN   A   64.15.112.93

;; Query time: 23 msec

;; SERVER: 8.8.8.8#53(8.8.8.8)

;; WHEN: Di Aug 13 03:40:46 CEST 2013

;; MSG SIZE  rcvd: 299

# dig @8.8.8.8 www.gentoo.org

; <<>> DiG 9.9.3-P2 <<>> @8.8.8.8 www.gentoo.org

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52060

;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 512

;; QUESTION SECTION:

;www.gentoo.org.         IN   A

;; ANSWER SECTION:

www.gentoo.org.      1493   IN   CNAME   www-bytemark-v4v6.gentoo.org.

www-bytemark-v4v6.gentoo.org. 593 IN   A   89.16.167.134

;; Query time: 18 msec

;; SERVER: 8.8.8.8#53(8.8.8.8)

;; WHEN: Di Aug 13 03:40:57 CEST 2013

;; MSG SIZE  rcvd: 91
```

The same with the DNS server of my ISP's.

----------

## 666threesixes666

so then

```

/etc/init.d/net.eth0 stop

/etc/init.d/NetworkManager start

```

stops the resolving?  did you turn off dhcp and other net scripts?

----------

## Jaglover

Just for testing I'd shut down that firewall and see if DNS queries get thru.

----------

## cyberpatrol

@666threesixes666: Yes. No. I'm not starting dhcpcd manually. It get's started automatically by net.eth0 and NetworkManager.

@Jaglover: No need for shutting down the firewall, it's iptables/netfilter anyway. So I just could open it completely, but since it's only port 53, which is open, this can't be the reason.

----------

## Jaglover

Right, that's what I meant, open it completely (same as shut it down) and see if the problem goes away.

----------

## cyberpatrol

That wouldn't change anything since DNS is done over port 53, and this port is already open. Otherwise net.eth0 wouldn't work. It's pretty unlikely that this is a firewall issue.

----------

## Jaglover

This is basic troubleshooting. You shut down the firewall to see if it is misconfigured. There are services that open an secondary port (as FTP), there are services that use TCP when you don't expect it. I'm trying to help you, eliminate the firewall and see if the problem persists. BTW, don't pay much attention to sixes, she is mostly misfiring.

----------

## 666threesixes666

id go with what jags saying.  rule out the firewall completely.  1 test, 20 seconds...

----------

## imaginasys

can you ping your gateway ?  e.g. ping 192.168.1.1 (if you have a router).

do you have a default route to go to the web ?  (show output of "route").

I'd suspect incorrect routing.

Regards,

               BT   :Mr. Green: 

----------

## cyberpatrol

I must apologize for the noise and thank you all for your help.

Well, opening the firewall helped indeed, but not the way you meant it. It turned out that I had a simple, and admittedly stupid, syntax error in my firewall script that I recently editied for NetworkManager, and didn't use directly with /etc/init.d/net.eth0, since /etc/init.d/iptables just loads a previously saved ruleset.

I just used some wrong braces for setting a variable with either a parameter or a default value: VAR=$(1:-default) instead of VAR=${1:-default}.

So, problem solved.

----------

## imaginasys

OK!  It happens!

Have fun with Gentoo!

----------

## cyberpatrol

Thanks. I'll definitely will have fun with Gentoo, since I had it already for 5 or 6 years and I'm back after about 5 years of using Arch Linux.

----------

