原标题:实战:Linux 系统如何禁用 IPV6
本文简介
IPv6早在上个世纪90年代,它就已经诞生了。IPv6全称Internet Protocol version 6,是网际协议的最新版本,用作互联网的协议。用它来取代IPv4主要是为了解决IPv4地址枯竭问题,同时它也在其他方面对于IPv4有许多改进。
是否应该“启用或者关闭”IPV6协议并不是一个很容易回答的问题。这就象是一片灰色地带,充满了各种各样的观点。如果你想要关闭的话,这篇可以来学习一下,本文档以实战的形式介绍 Linux 系统如何禁用 IPV6, 文内含长段 代码可复制可往左滑,希望对大家有帮助!
环 境
RHEL7.3
更改/etc/sysctl.conf配置文件
[root @Jakingvsftpd]# vim /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a newfile with the same in
# /etc/sysctl.d/ and put newsettings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put newsettings there.
#
# For more information, see sysctl.conf( 5) and sysctl.d( 5).
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf. default.disable_ipv6 = 1
[root @Jakingvsftpd]# ifconfig
# IPV6 字段 inet6 fe80:: 250: 56ff:fe22:db62
ens33: flags= 4163mtu 1500
inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80:: 250: 56ff:fe22:db62 prefixlen 64scopeid 0x20
ether 00: 50: 56: 22:db: 62txqueuelen 1000(Ethernet)
RX packets 11717bytes 4355183( 4.1MiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 6943bytes 2011730( 1.9MiB)
TX errors 0dropped 0overruns 0carrier 0collisions 0
lo: flags= 73mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 :: 1prefixlen 128scopeid 0x10
loop txqueuelen 1(Local Loopback)
RX packets 112bytes 9492( 9.2KiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 112bytes 9492( 9.2KiB)
TX errors 0dropped 0overruns 0carrier 0collisions 0
[root @Jakingvsftpd]# sysctl -p #让配置文件立即生效
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf. default.disable_ipv6 = 1
[root @Jakingvsftpd]# ifconfig
# IPV6 字段已经消失
ens33: flags= 4163mtu 1500
inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255
ether 00: 50: 56: 22:db: 62txqueuelen 1000(Ethernet)
RX packets 11747bytes 4357703( 4.1MiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 6961bytes 2014592( 1.9MiB)
TX errors 0dropped 0overruns 0carrier 0collisions 0
lo: flags= 73mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1(Local Loopback)
RX packets 112bytes 9492( 9.2KiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 112bytes 9492( 9.2KiB)
TX errors 0dropped 0overruns 0carrier 0collisions 0
总 结
以上就是 Linux 系统如何禁用 IPV6 的方法,希望能给大家带来帮助。返回搜狐,查看更多
责任编辑: