8

My configuration:

  • laptop: XPS 15 7590
  • system: Ubuntu 18.04
  • internet connection: wifi (5 GHz)

Every time I run git pull, git push I have to wait like 15 minutes until it is done. Same problem with running add-apt-repository ppa. As I was trying to solve it, I found this question where the solution was running:

sudo sysctl net.ipv6.conf.all.disable_ipv6=1

which is disabling IPv6 until next reboot. It really works. I would like to understand why exactly is this helping and also what can/should be done (set up) to make this permanent. And is it actually okay to set this permanently?

matt525252
  • 183
  • 1
  • 4
  • 1
    Possibly a problem with your DNS resolution in IPv6. `nmcli` in a terminal will list DNS servers associated with your network interfaces for IPv4 and IPv6. You can use these IPv6 address with `nslookup` to see if they work as servers. If not you can force IPv6 DNS in your network configuration (OpenDNS servers: `2620:119:35::35` and `2620:119:53::53`). – xenoid Apr 12 '20 at 09:26
  • 4
    You probably should [check the state of your IPv6 connectivity](https://test-ipv6.com): if your router and/or your internet provider are announcing IPv6 capability (i.e. your laptop is receiving ICMPv6 router advertisements) but connections to remote IPv6 sites are actually dropped/misrouted/blocked, then disabling IPv6 would be a possible workaround until the underlying problem is fixed (either IPv6 connectivity is fixed or false IPv6 router advertisements are stopped). You might want to contact your internet provider to verify whether IPv6 is actually supposed to work for you or not. – telcoM Apr 12 '20 at 10:12
  • I was checking router from my provider and ipv6 is disabled by default. Also https://test-ipv6.com/ does not detect ipv6. – matt525252 Apr 12 '20 at 10:24
  • You also need to make sure if your ISP supports ipv6 – GMaster Apr 12 '20 at 11:16

1 Answers1

8

In order to make this permanent, open your /etc/sysctl.conf file using sudo

sudo nano /etc/sysctl.conf

Add the line at the bottom of the file:

net.ipv6.conf.all.disable_ipv6=1

After that you may reboot your machine or run

sudo sysctl -p

Alternatively, you may instruct your ssh client to use ipv4 only. To do so, open ~/.ssh/config using vi or nano and add the following:

Host *
  AddressFamily inet

AddressFamily in the ssh config instructs which type of address to use when connecting via ssh. Valid choices are any, inet, inet6. Selecting to use inet makes sure ssh does not use ipv6 at all.

Git (commands) use either ssh or http protocol when communicating over a network. Since you are most likely using ssh protocol for your git commands, and making ssh protocol only use ipv4, it resolves the slow connectivity issue related to ipv6.

Unfortunately, this alternative approach won't fix your add-apt-repository ppa

GMaster
  • 5,992
  • 3
  • 28
  • 32