# [SOLVED]Cannot ping google but can ping 8.8.8.8

## curiousdoge

Hi, I'm quite new to gentoo and I've managed to install gentoo. I've had issues about getting the internet to work without the liveCD and managed to get it to work by emerging wpa_supplicant. I've also emerged NetworkManger but after that my internet is no longer working properly. When I run NetworkManager I have no connection to the internet so I stopped it and tried to use wpa_supplicant again, which worked but I can no longer ping google.com . However I can ping IPs like 8.8.8.8 or 192.168.1.1 just fine.

I've googled the problem and many solutions have to do with editing the /etc/resolv.conf file, however this file doesn't exist for me anymore.

Any help would appericated.Last edited by curiousdoge on Tue May 02, 2017 10:58 am; edited 1 time in total

----------

## cboldt

Another poster recently had trouble with /etc/resolv.conf, but his /etc/resolv.conf was pointing to a non-existent file that was related to a (removed) installation of NetworkManager.  The fix for him was to remove /etc/resolv.conf (command = `rm /etc/resolv.conf`), in light of the fact that the tool he was using to register network details (dhcp) creates /etc/resolv.conf, and could not create it over top of the link that NetworkManager installed.

How are you starting your network?

----------

## curiousdoge

I've haven't removed NetworkManager but just did so now. I also removed the /etc/resolv.conf file.

How would I go about creating a new resolv.conf file?

My network starts automatically on boot, I believe by starting wpa_supplicant and my interface.

Thanks for helping!

----------

## cboldt

You don't create a new /etc/resolv.conf file.  Just start the network, the network makes a new one for you.  Assuming that you have configured your network interface to use dhcp, which is the default and most common arrangement.  The fact that you can view the network says that the interface is up, and the fact that you can't "view/ping by name" but can "view/ping by IP address" is a symptom of no DNS lookup.

The IP address (it is ALWAYS a number) that will be used for DNS lookup is sent to you by your dhcp-provider, maybe your router is performing that function, maybe another computer on your network.  The IP address (always a number) that will be used for DNS lookup is stored in /etc/resolv.conf.

Oh, when your network starts automatically at boot, if likely gives some sort of message.  Here I get "Bringing up interface [interfacename]"  I don't have to reboot to restart that interface name.

The exact method of restarting a network interface depends on the system you are using for booting.  I use openrc.  Some people use systemd.  I will be of no help if you are booting with systemd, because I deliberately keep myself ignorant of systemd's way of working.

If you use openrc, the way to restart an interface is to run "/etc/init.d/net.[interfacename] restart"  Typical interfacenames are "eth0", "wlan0" or nowadays some sort of weird assignment.  At any rate, I suspect you know the interfacename you are working with.Last edited by cboldt on Sun Apr 30, 2017 3:14 pm; edited 1 time in total

----------

## NeddySeagoon

curiousdoge,

dhcpcd may create /etc/resolv.conf for you.

It needs to contain at least one line of the form

```
nameserver <IP_of_nameserver>
```

If you create it by hand, because dhcpcd didn't, it will be removed when your dhcpch lease expires

----------

## NeddySeagoon

cboldt,

As long as you allow hex as numbers, yes.

```
nameserver 213.133.x.y

nameserver 2a01:4f8:0:a0a1::
```

Entries redacted.

----------

## curiousdoge

I've managed to to fix the issue by using the liveCD and chrooting and remaking the /etc/resolv.conf there using net-setup. I can ping google.com again!

Interesting note, dhcpcd never works without the liveCD, it always times out.

Anyways, thanks for all your help.

----------

## ct85711

When you boot your computer normally, check to see what ip address it has.  If the ip address is something than the 169.x.x.x (trash address), then the system already called dhcpd for you.  The most common issue that people have is trying to call dhcpd on an interface that is already up using dhcpd.  The livecd works, because the interfaces are usually not started right away.

----------

## Jaglover

 *curiousdoge wrote:*   

> I've managed to to fix the issue by using the liveCD and chrooting and remaking the /etc/resolv.conf there using net-setup. I can ping google.com again!
> 
> Interesting note, dhcpcd never works without the liveCD, it always times out.
> 
> Anyways, thanks for all your help.

 

That was the hard way ... instead of creating the file and following Neddy's suggestion.

```
echo 'nameserver <IP_of_nameserver>' > /etc/resolv.conf

```

^^

----------

