I can't connect to mirrordirector.raspbian.org in Raspbian, but I don't know why.

I've already re-installed Raspbian, but it looks like this is not the problem. How can I resolve this?

After I connected to my Raspberry Pi over SSH from another computer and then run sudo apt-get update and work like a charm. But, if someone can explain why it wasn't working when I was executing the command from the Pi itself, it would be great!

  • Through the wifi had the same problem, but when connected through the LAN cable everything start working.
    – snex
    Commented Oct 3, 2019 at 14:07
  • In my case, the router blocked requests. I added a rule to the router iptables and everything worked.
    – snex
    Commented Oct 4, 2019 at 9:11
  • in /etc/apt/sources.list change ...mirrordirector.raspbi..... to ...legacy.raspb...... Commented Sep 20, 2022 at 11:02

7 Answers 7


This Answer is obsolete. The operation of mirrordirector has changed.

Using terminal or your favorite text editor you can define a specific mirror to use in


Just comment out the line

 deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware

So it looks like this

 #deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware

And replace with a mirror close to you from list below

The list of mirrors can be found here

I (being in the US) use the lease Web mirror


Problem seems dns related (except for slow ping when you used actual ip of Google.

Update your /etc/network/interfaces eth0 line to include (or update existing) to be (as last line of section)


Those are Google name servers. Just to see if get better performance. If you would like less prying eyes than Google, there are other free providers out there.

As far as slow ping when pinged ip address of Google, I would reboot router and/or modem.

Update 2

If adding to /etc/network/interfaces didn't work add the following as last line of /etc/resolv.conf


And then restart or just restart networking

Edit 3 Also if you could update answer with output of


You do this via terminal. It will show us the local address of the Pi. Also, please update answer with local ip of computer that is working, or the local address of the router. For example mine is
  • thanks for your answer!, but that does not solve my problem. It's doing the same as before. Just trying to connect to get the package but stock on 0% and I'm also unable to ping google.com. Do not why Commented Feb 10, 2015 at 13:15
  • Wired or WiFi? Did Internet work during install. Can you ping your router or any other local device.
    – geoffmcc
    Commented Feb 10, 2015 at 13:18
  • wired connection. And Yes I can ping local devices but really do not know if it was working during install, cause I did not need internet connection while installing. Commented Feb 10, 2015 at 13:37
  • Seems like a dns problem. Can you ping (Google IP)
    – geoffmcc
    Commented Feb 10, 2015 at 14:02
  • Yes, but then stop for a while (almost 2 minutes) and then continues the ping. Commented Feb 10, 2015 at 14:07

I suffered similar issue, and use this way to sovle it. First, comment out this in /etc/apt/sources.list:

#deb http://mirrordirector.raspbian.org/raspbian jessie main contrib non-free
deb http://apt.osmc.tv jessie main

then do sudo apt-get update and sudo apt-get upgrade. Then recover the sources.list

deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware
deb http://apt.osmc.tv jessie main

Do sudo apt-get update and sudo apt-get upgrade again. It no longer happen.

  • This no longer works.
    – Rebroad
    Commented Feb 28, 2020 at 12:26

My solution was to disable IPv6 in the router.

  • 2
    This is not likely to be a permanent solution as the switch to ipv6 is coming. Commented Dec 6, 2015 at 10:21
  • 1
    Well, it's actually very likely and it helped me immediately. I have IPv4 provider and I had IPv4->IPv6 tunnelling (Automatic) enabled on my Netgear router. Disabling IPv6 so far did immediately fix the ping/nslookup request to mirrordirector.raspbian.org.
    – igraczech
    Commented Nov 7, 2016 at 21:24
  • This worked for me, although I'm eager for a permanent solution.
    – Ben
    Commented Mar 5, 2018 at 15:06

One way is to add following lines to /etc/hosts file

  1. Open /etc/hosts file with sudo rights $sudo nano /etc/hosts
  2. Paste the following lines at the end of /etc/hosts file   mirrordirector.raspbian.org   archive.raspbian.org

This works for me!!


In my case (same behavior, no name server resolution) I fixed it by modifying the /etc/nsswitch.conf it only had files and dns was disabled. Now the hosts line is: hosts: files dns

  • This worked for me and many (all at the time of writing) others in this page did not. In the hosts: line in the /etc/nsswitch.conf file there was more than just 'files dns' and now it is just exactly those two and I am back in action. I have a perfectly fresh install of debian-stretch-raspbian on a new pi-0-w.
    – paul_h
    Commented Nov 11, 2017 at 14:35

I tried everything that geoffmcc provided but it still did not work for me. My solution was to change the DNS servers on my router. I used the OpenDNS name servers. enter image description here

I would imagine you can use the google name servers also as mentioned above. I would think that adding it to the resolve.conf or the interfaces file would work for some reason it didn't in my case. Hopefully this might help someone else.


I tested my IPv6 connection using this site http://ipv6-test.com/ It said my IPv6 wasn't working. I found on a forum post that someone rebooted their router and it was fixed. I rebooted my router and the problem was fixed. The person who said to reboot the router had persistent problems had had to occasionally reboot the router. Also, the IPv6 test fails at my job. My job is at a company so big that the internet goes out of a different part of the country. Disabling IPv6 on your pi might work, but I think it's better to just fix IPv6 at the router level.

Not the answer you're looking for? Browse other questions tagged or ask your own question.