IPV6 is not yet fully popular, but after the installation of the system IPV6 is effective, to a certain extent, the impact of network performance, so in the case we do not use IPv6 at all, it is best to close the IPv6. In fact, in the previous article on the network setup, we mentioned whether to activate IPv6, but only that setting still can't completely close IPv6, so this article describes how to close it with complete steps.
View IP Configuration
#ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:cc:22:28
inet addr:192.168.2.253 bcast:192.168.2.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FECC:2228/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:200403 errors:0 dropped:0 overruns:0 frame:0
TX packets:5756 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18713209 (17.8 MiB) TX bytes:2042418 (1.9 MiB)
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:65536 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
If Inet6 appears above, it means that IPV6 is enabled.
Method One:
1. Modify/etc/sysconfig/network, append:
Networking_ipv6=no
2. Modify the/etc/hosts, the IPv6 of the local hostname parsing also commented out:
#::1 localhost Localhost6 localhost6.localdomain6
3. Let the system does not load IPv6 related modules, which need to modify the Modprobe related settings files, in order to manage the convenience, we create a new set of files/etc/modprobe.d/ipv6off.conf, the content is as follows, three ways, there is always a suitable for you:
Alias net-pf-10 off
Options IPv6 disable=1
Or
Install Ipv6/bin/true
Or
Install ipv6/sbin/modprobe-n-I IPv6
Note that if you use network card binding (bond) technology and do not want to use IPv6, then you use the first, otherwise the bonding module may fail to load when the system starts.
4. Restart the system and confirm that:
[Email protected] ~]# Lsmod | Grep-i IPv6
[Email protected] ~]# Ifconfig | Grep-i Inet6
If the results of the above 2 commands do not show any, then the IPv6 has been completely banned.
Postscript:
In the third step without loading the IPv6 module, someone might have a setup method like this:
Alias net-pf-10 off
Alias IPv6 off
Options IPv6 disable=1
Although this is true after the system restarts, IPv6 is not loaded, but because of the second sentence, in some versions of the system, when we restart the network, the following error occurs:
Fatal:module off not found.
Method Two:
(No need to restart the system)
Edit/etc/sysctl.conf
#vim/etc/sysctl.conf
Add to
# IPV6 Disabled
Net.ipv6.conf.all.disable_ipv6 = 1
Net.ipv6.conf.default.disable_ipv6 = 1
Net.ipv6.conf.lo.disable_ipv6 = 1
Make it effective
#sysctl-P
View
#ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:cc:22:28
inet addr:192.168.2.253 bcast:192.168.2.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:200717 errors:0 dropped:0 overruns:0 frame:0
TX packets:5898 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18742847 (17.8 MiB) TX bytes:2064730 (1.9 MiB)
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Up LOOPBACK RUNNING mtu:65536 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
This article is from the "Technology vs" blog, so be sure to keep this source http://yuj0607.blog.51cto.com/2330331/1613563
Linux Disable IPV 6