How to stop using IPv6 on Ubuntu

Step1: Vim the file below

sudo vim /etc/sysctl.d/99-sysctl.conf

Step2: Add the following three lines in this file

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Step3: Reload conf

sudo sysctl -p

Now, all connections will try IPv4 initially like below:

--2020-01-29 02:22:24--  
Resolving (, 2607:f8b0:4026:800::200e
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK 

Tags: Linux, Ubuntu, DNS, IPv4, IPv6, Disable, Avoid, Ban, Link, Connection, Priority

0 0 vote
Article Rating