Ubuntu - Networking - Troubleshooting - Could not resolve

If you get errors like this when you try to access something on the network, for instance when running “apt-get update”:

Err http://security.ubuntu.com trusty-security InRelease
 
Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
 
. . .

To fix, set your nameservers to outside nameservers. This example uses Google's nameservers. Open /etc/network/interfaces for editing:

sudo vi /etc/network/interfaces

Update the dns-nameservers line as shown:

/etc/network/interfaces
. . .
iface eth0 inet6 static
        address 2604:A880:0800:0010:0000:0000:00B2:0001
        netmask 64
        gateway 2604:A880:0800:0010:0000:0000:0000:0001
        autoconf 0
        dns-nameservers 8.8.8.8 8.8.4.4

Refresh your network settings:

sudo ifdown eth0 && sudo ifup eth0

The expected output is:

Output

RTNETLINK answers: No such process
Waiting for DAD... Done

Next, create a new firewall rule to force IPv4 when it's available. Create this new file:

sudo vi /etc/apt/apt.conf.d/99force-ipv4

Add this single line to the file:

/etc/apt/apt.conf.d/99force-ipv4
Acquire::ForceIPv4 "true";

Save and close the file. Now you should be able to use APT.