1

New to this so sorry for any mistakes.

I’m trying to get my Raspberry Pi Zero to ping ‘www.google.com’ but I just get 100% packet loss. I can ping 8.8.8.8 perfectly fine, as well as my home router at 192.168.0.1. I don’t believe it’s a DNS issue since its showing me the ip for google. I have a static ip set on the pi (tried just getting an ip assigned by the router, didn’t work). I tried disabling the firewall on my router, also didn’t work. I’ve gone through a number of forum posts trying to diagnose what is going on but haven’t seen anyone having this issue specifically, any help would be appreciated. If more info is needed I’ll try and provide it as soon as possible.

Jeroldx
  • 11
  • 2

2 Answers2

1

I assume you are using default Raspbian. When you set a static ip address then you have also set any other configuration by hand including the DNS server ip addresses to use for DNS name resolution. This is done in /etc/dhcpcd.conf together with the static ip address. You will find some examples in that file. An entry of

static domain_name_servers=8.8.8.8 8.8.4.4

should do a good job except you do not want to use your own DNS server.

Ingo
  • 42,107
  • 20
  • 85
  • 197
1

One of the reasons I recommend Pi users avoid static addresses is because so many do not understand networking and get it wrong.

If you are determined to do it anyway see How to set up Static IP Address

You DO NOT need to know the IP address to connect to your Pi. You can just connect to your server by name e.g. raspberrypi.local instead of IP address. (NOTE raspberrypi is the default hostname, and can/should be changed).

You can easily connect from Linux and OS X with ssh pi@hostname.local (the default hostname is raspberrypi) This should work with popular GUI ssh programs. This is sometimes problematic with some versions of Windows and networks which use .local in a non-standard way. (See https://en.wikipedia.org/wiki/.local)

NOTE .local resolution does not always work e.g. in rsync. The following should resolve IP (and can be included in bash scripts) RemotePi=$(getent hosts hostname.local | awk '{ print $1 }')

If you REALLY want to know the IP address you can discover it by many means;

arp raspberrypi.local on most networks (arp raspberrypi may work on some)

e.g.

arp archpi.local
archpi.local (10.1.1.20) -- no entry

or

getent hosts archpi.local | awk '{ print $1 }'
10.1.1.20

or

ping -c 1 archpi.local
PING archpi.local (10.1.1.20): 56 data bytes
64 bytes from 10.1.1.20: icmp_seq=0 ttl=64 time=4.607 ms
Milliways
  • 59,890
  • 31
  • 101
  • 209