Disable ipv6 on Debian/Ubuntu
If you don't need ipv6 and wanna keep network "clean" especially for local servers/services you can easily disable ipv6.
- check to see ipv6 under interfaces configuration (you can see ipv6 info for every interface)
ip a sh 1: lo:
mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether ba:e5:a4:d5:02:a5 brd ff:ff:ff:ff:ff:ff inet 10.20.11.31/24 brd 10.20.11.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::b8e5:a4ff:fed5:2a5/64 scope link valid_lft forever preferred_lft forever - to disable put at the end of
/etc/sysctl.conf
file next 3 lines:net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
- then reboot server or reload
sysctl
:sudo sysctl -p
- if you check interface configuration there is no more ipv6
1: lo:
mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether ba:e5:a4:d5:02:a5 brd ff:ff:ff:ff:ff:ff inet 10.20.11.31/24 brd 10.20.11.255 scope global eth0 valid_lft forever preferred_lft forever
Of course don't forget remove service bindings on ipv6 addresses if you have it for example postfix. Also if there are commands that rely on ipv6 like nagios check_alive service that pings local host using ipv6 you need to edit that command and add "-4" as an option.