# Can ping and access Google but no other sites on internet

## kmb346

I recently installed Gentoo version 4.9.95 and got everything up and running, I installed KDE Plasma as well without any trouble. The internet was working perfectly and I could access all sites.  However, a few days ago I tried to open some websites in my browser (Chromium and the built-in browser on Plasma, Falkon) but I keep getting error messages saying "This site can't be reached".  The only site I can access is www.google.com.  I can even search, but if I try to open a page i get the error message.

I can ping Google as well, but no other sites.  When I ping other sites I get an error "Temporary failure in name resolution"

I looked around but could not find any real similar issues.  I am new to Gentoo and am not very familiar with networking.  

I checked my newtwork interface and I have an enp0 network and it says it is up so I am not sure what is causing the issue.

Any help would be appreciated.  Please let me know what I can post that would be helpful in solving this. 

Thanks in advance.

----------

## papas

I am not sure, but try add another dns server in rour resolv.conf for example something like this:

```
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
```

----------

## kmb346

Thank you for your fast reply.

My internet is back up and running!  Thanks so much for your advice.  

When I added the nameserver to the /etc/resolv.conf, the file kept getting modified automatically and the line I added was was removed.  

I had to create a new file called /etc/resolv.conf.tail and add the nameserver to that file. 

Thanks again, I was pulling my hair out trying to find a solution.

----------

## Hu

Your change is a workaround, not a fix.  Although well-known, that nameserver may not be optimal for you.  You would likely be better off using one local to your area.  The network scripts should configure DNS for you as part of activating your network.  How do you acquire an IP address?  Static configuration?  DHCP?  Please show us the contents of /etc/conf.d/net.

----------

## kmb346

Thanks for your reply Hu.

I do not have the /etc/conf.d/net file.  Maybe it got deleted, I checked the hidden files as well and nothing?  Could the absence of this file be the cause of my issue?  Do I need to manually create the file or is there a way to recreate it somehow?

I am not running any static configuration that I am aware of, my system is running DHCPCD.

If you need any additional information please let me know and I will post it.  

Thanks again.

----------

## Hu

If you use dhcpcd, and do not configure it otherwise, then it should configure your nameserver from what your DHCP server offers.  If your DHCP server is not offering a nameserver, you would have a problem.  What is the output of dhcpcd -U eth0 (or such other interface as udev may have mangled for you)?

----------

## orion777

To Note: if You have any capacity restrictions (typically, when 3G/LTE services are used) and it is over, sometimes network providers block all traffic EXCEPT google traffic. This is done to be able to redirect You to its webpage like "your traffic is over, please pay more, and so.." using google DNS server 8.8.8.8.

----------

## kmb346

When I try dhcpd -U eth0 I get an error:

eth0: dhcp_dump: No such file or directory

I did ifconfig -a and got the following result:

```

enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.7  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 240f:95:71f6:1:689f:291a:add0:5d75  prefixlen 64  scopeid 0x0<global>

        inet6 fe80::fdf7:5cca:50d8:2b15  prefixlen 64  scopeid 0x20<link>

        ether 70:85:c2:55:94:77  txqueuelen 1000  (Ethernet)

        RX packets 41746  bytes 38130702 (36.3 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 35920  bytes 5471789 (5.2 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device interrupt 16  memory 0xdf000000-df020000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sit0: flags=128<NOARP>  mtu 1480

        sit  txqueuelen 1  (IPv6-in-IPv4)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

So I tried dhcpcd -U enp0s31f6:

```

broadcast_address=192.168.0.255

dhcp_lease_time=3600

dhcp_message_type=5

dhcp_rebinding_time=3150

dhcp_renewal_time=1800

dhcp_server_identifier=192.168.0.1

domain_name_servers=192.168.0.1

ip_address=192.168.0.7

network_number=192.168.0.0

routers=192.168.0.1

subnet_cidr=24

subnet_mask=255.255.255.0

dhcp6_dump: enp0s31f6: No such file or directory

```

Also, just for reference, I was going through this post, networking for dummies, but I got stuck because when I do ls /etc/init.d/net, I found that i have no file or directory named "net" in /etc/init.d/.  

@orion777 Thanks for your insight as well.  I do not think I have any capacity restrictions and my internet was working when I initially installed Gentoo.  I am not a real heavy network user as it is and have never experienced any problems on my other devices.

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]

----------

## saturnalia0

/etc/resolv.conf is the ultimate resolver. See man resolv.conf(5). Write your DNS servers of choice to it and then chattr +i /etc/resolv.conf and no software will overwrite it.

If your only issue is a broken DNS config file then that is a fix. No need to worry about other net config files. If it ain't broken don't fix it.

----------

## Hu

Your DHCP server set itself as a DNS server.  This may be fine, if it offers DNS service.  What does dig www.gentoo.org @192.168.0.1 show?

saturnalia0: please never suggest using chattr +i for this.  I've seen several users with weird problems that were ultimately traced to them blindly following that bit of advice.

----------

## P.Kosunen

 *kmb346 wrote:*   

> When I try dhcpd -U eth0 I get an error:
> 
> eth0: dhcp_dump: No such file or directory

 

https://wiki.gentoo.org/wiki/Eudev/Network_device_names

If you want old eth* name.

----------

## NeddySeagoon

saturnalia0,

That's what the /etc/resolv.head and  /etc/resolv.tail files are for.

chattr +i is a horrible thing to do.

----------

## kmb346

Thanks everyone for your responses.

When I do dig www.gentoo.org @192.168.0.1 I get the following output:

```

; <<>> DiG 9.11.2-P1 <<>> www.gentoo.org @192.168.0.1

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 23839

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

;; OPT PSEUDOSECTION:

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

; COOKIE: 978994fa9115693a (echoed)

;; QUESTION SECTION:

;www.gentoo.org.                        IN      A

;; Query time: 0 msec

;; SERVER: 192.168.0.1#53(192.168.0.1)

;; WHEN: Tue Sep 04 00:56:27 JST 2018

;; MSG SIZE  rcvd: 55

```

It returns with status: SERVFAIL.  I am guessing this means the DHCP server does not offer DNS service.  

What would be the best way to resolve this?

----------

## NeddySeagoon

kmb346,

Look in your router set up and see if the domain name server is turned off.

If its supposed be working by isn't, create the file /etc/resolv.conf.tail with your own name server entries.

Use your ISP provided nameservers as they will be fastest.

/etc/resolv.conf.tail is appended to /etc/resolv.conf, so if it suddenly starts working, or you move to another network, it will still jush work as your manual entries will be lower down the list than dhcpcd provided entries.

The chattr +i method will ensure that your system is not portable, since a properly working network would not be able to overwrite /etc/resolv.conf.

As an aside, you have a global scope IPv6 address

```
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.7  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 240f:95:71f6:1:689f:291a:add0:5d75  prefixlen 64  scopeid 0x0<global> 
```

I hope you have a IPv6 firewall too as global IPv6 addresses are on the big bad internet unless you do something about it.

You should also have an IPv6 nameserver, it will work without but it defeats the purpose using IPv4 to resolve hostnames to IPv6 addresses.

----------

