top of page
  • Writer's pictureNick Lansley

IPv6 and Ubuntu / Debian / Raspberry Pi slow updates

If your Ubuntu / Debian / Raspberry Pi operating system suddenly has difficulty trying to reach Google and other popular web sites, and your attempts to use apt-get seem to be very slow, it’s because your network ISP has switched you over to IPv6 from IPv4.  Read on for a solution!

My new spangly BTHub6 broadband router has arrived from my ISP Britsh Telecom, and I have just completed setting it up. All is well with one seemingly strange exception – whenever I use the apt-get command to update, upgrade or install applications on my Raspberry Pi and my Ubuntu machine, it seems to hang on waiting for some of the archive servers to respond.

The reason? The BTHub6 can now natively ‘talk’ IPv6 – the most recent version of the Internet Protocol, the communications language that provides an identification and location information for all devices connected to the internet. Installing that hub was combined with BT switching on IPv6 in my area (Brighton and Sussex, England).

Previously, IP addressing used IPv4 and the familiar 192.168.0.123 -style. However, with so many devices connected to the Internet, the Internet Service Providers were running out of numbers!

You can read here from Wikipedia about IPv6 but let’s get back to the problem: Whenever I used this command:

sudo apt-get update

…the update, previously fast, would hang (or, more accurately work but take 15 minutes). Worse, there were often delays getting to google.com and many other sites. Indeed my web browser would time out waiting. Life without google.com? I know! So I needed a solution.

I uncovered that there are not yet available the numbers of sites using IPv6. Most still use IPv4. The answer for this issue, then, is to tell Linux OS to try IPv4 first and, if that fails try IPv6. Here’s how to do it:

At a Ubuntu / Debian / Raspbian command-line, type this:

sudo nano -c /etc/gai.conf

Now scroll down to line 54 (the ‘-c’ will have caused Nano to show the current line number at the bottom of the terminal window). You should see this line (if not, look a comment which says “For sites which prefer IPv4 connections change the last line to”. The line you want to edit is just below that comment):

#precedence= ::ffff:0:0/96  100

Remove the  # so that the ‘p’ of precedence is now in column 1 of that line.

Press Ctrl-X then Y then Enter to save.

Finally, reboot the machine:

sudo reboot

…and when you try again after the reboot, the apt-get commands – and Google – will be fast once more. Now sit back and enjoy the fact that your ISP has you ahead of the internet curve!

78 views0 comments

Recent Posts

See All

The Daily Peacehaven Timelapse Video

A couple of posts ago I wrote about the ‘WeatherPi’ Raspberry Pi that collects the latest weather readings every 10 minutes and make a decision whether or not to lower the storm shutters in front of o

Live weather data and images!

I wanted to take the peaceful few days between Christmas and New Year to really refresh the data collected from the local weather that helps our Raspberry Pi-powered Storm Shutters Controller (known a

Post: Blog2_Post
bottom of page