How To Disable IPV6 Ubuntu 16.04

Step 1: Disable IPV6

2.1 Check if ipv6 is enabled

0 –> Enabled
1 –> Disabled

sudo cat /proc/sys/net/ipv6/conf/all/disable_ipv6
root@srv6:/# sudo cat /proc/sys/net/ipv6/conf/all/disable_ipv6
0
root@srv6:/#

Output shows a value of 0, 0 = enable

2.2 Edit the sysctl.conf

sudo nano /etc/sysctl.conf

Add the lines below at the end of the file

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Exit and Save

2.3 Update kernel parameters

sudo sysctl -p
root@srv6:/# sudo sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
root@srv6:/#

2.4 Verify that ipv6 is disable

sudo cat /proc/sys/net/ipv6/conf/all/disable_ipv6
root@srv6:/# sudo cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1
root@srv6:/#

Output shows a value of 1, 1 = disable

Donate