IPv6 is the next generation Internet Protocol (IP) address standard intended to replace IPv4, The protocol most Internet services are using today. Every computer, mobile phone and any other device connected to the Internet needs a numerical IP address in order to communicate with other. It is an identity of a computer over Internet.
In this article we will help you to disable IPv6 from your Linux box.
1. Check IPv6 Address
Use ifconfig command to view current IPv6 address on your system. You will get results like below.
eth0 Link encap:Ethernet HWaddr 00:25:90:C1:D8:36 inet addr:129.121.177.162 Bcast:129.121.191.255 Mask:255.255.240.0 inet6 addr: fe80::225:90ff:fec1:d836/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1379983101 errors:0 dropped:0 overruns:0 frame:0 TX packets:1292563666 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:205408934685 (191.3 GiB) TX bytes:1169860757207 (1.0 TiB) Memory:dfa20000-dfa3ffff eth0:0 Link encap:Ethernet HWaddr 00:25:90:C1:D8:36 inet addr:65.75.129.33 Bcast:65.75.143.255 Mask:255.255.240.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Memory:dfa20000-dfa3ffff eth0:1 Link encap:Ethernet HWaddr 00:25:90:C1:D8:36 inet addr:65.75.130.25 Bcast:65.75.143.255 Mask:255.255.240.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Memory:dfa20000-dfa3ffff
2. Disable IPv6 Temporarily
If you want disable IPv6 for your current session, Simply use following command to set run time variable. Note that below changes will be discarded after system reboot.
echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
3. Disable IPv6 Permanent
To disable IPv6 permanently, edit /etc/sysctl.conf file and add/update following parameters:
nano /etc/sysctl.conf
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Now reload sysctl configuration by using following command:
sysctl -p