# Apt-get not working Raspberry Pi 2 B

On raspbian stretch:

I set up the raspberry pi to have a static address, so I could use VNC/ssh to access the system rather than needing the separate monitor. Even though I can ssh/VNC into the pi, I am unable to browse the internet or update files or install new packages. I am able to successfully ping 8.8.8.8 but not google.com.

The output is:

After reading some similar questions, I think I need to either set up a DNS or a proxy, but I am not sure which one is required or what the difference is. I tried to set up the DNS by adding 'server 8.8.8.8' to the as recommended by this post: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=49350. But I just managed to affect the ssh settings so I need to get a monitor before I can continue testing. Also, I was able to ping RaspberryPi.local from my mac to determine the ip address before I added the 'server' line, but that is also not working anymore.

Any recommendations or ideas on how to fix the network connection so I can use apt-get would be very helpful!

Something you did while setting up your static ip-address probably made the outside internet unavailable to your machine. If you don't know exactly how to undo this,then I would start from a fresh install. That may not be an option, but I don't know.

Do you have a router?

Many routers have a DNS service in them. Mine doesn't, but my NAS does, so I use that. I have my router hand out the IP-addresses, and the NAS serves to connect the names to the addresses.

I have too many machines in a small space for me to remember their numbers.

You can setup a DNS server on a Raspberry Pi for your internal network. I prefer "named," but many prefer avahi instead, though that is more like Bonjour.

• do you want to use avahi because it would help identify the raspberry pi on the network, which allows you to set the wifi as dhcp so the DNS would work? – Riti Jul 3 '18 at 16:11
• You need to have some way of routing the packets. You need DHCP to give ip-numbers to your machines. You don't need to run DNS unless you need name service for your home. It is useful. I don't like avahi, but many people do. – NomadMaker Jul 3 '18 at 16:24

You have set a static ip address and you can ping 8.8.8.8. So you have connection the internet and most things are right. You only need to define a dns server your raspi should use to resolve names e.g. raspbian.raspberrypi.org. I don't know how do you set up the static ip address but usually you do it in /etc/dhcpcd.conf. There is a section # Example static IP configuration. Uncomment and set:

static domain_name_servers=8.8.8.8 8.8.4.4


These are the name servers 8.8.8.8 and 8.8.4.4 from google. Be aware that there is a space between them.

Reboot and it should go.