关闭IPV6

简介: IPV6的关闭
  1. 查看是否开启IPV6

结果中显示inet6,表示开启了IPV6
[hadoop@zbx-server-agent ~]$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

link/ether 00:0c:29:d7:c8:d5 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.144/24 brd 192.168.100.255 scope global noprefixroute ens33
   valid_lft forever preferred_lft forever
inet6 fe80::a8ed:bce0:dedf:8607/64 scope link noprefixroute
   valid_lft forever preferred_lft forever
  1. 编辑/etc/sysctl.conf

添加 net.ipv6.conf.all.disable_ipv6=1
[hadoop@zbx-server-agent ~]$ sudo cat /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 new file with the same in

/etc/sysctl.d/ and put new settings there. To override

only specific settings, add a file with a lexically later

name in /etc/sysctl.d/ and put new settings there.

For more information, see sysctl.conf(5) and sysctl.d(5).

net.ipv6.conf.all.disable_ipv6=1

  1. 编辑/etc/sysconfig/network

增加 NETWORKING_IPV6=no
[hadoop@zbx-server-agent ~]$ sudo cat /etc/sysconfig/network

Created by anaconda

NETWORKING_IPV6=no

  1. 编辑/etc/sysconfig/network-scripts/ifcfg-ens33

sudo sed -i 's#IPV6INIT=yes#IPV6INIT=no#' /etc/sysconfig/network-scripts/ifcfg-ens33

[hadoop@zbx-server-agent ~]$ sudo cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=18f30053-d1e0-4cbf-8048-c1f826d8eada
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.144
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=114.114.114.114
DNS2=218.2.135.1
5.重新加载sysctl -p 或重启
sudo sysctl -p
[hadoop@zbx-server-agent ~]$ sudo sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
6.查看效果
[hadoop@zbx-server-agent ~]$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

link/ether 00:0c:29:d7:c8:d5 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.144/24 brd 192.168.100.255 scope global noprefixroute ens33
   valid_lft forever preferred_lft forever

7.参考文档
https://www.cnblogs.com/zhoading/p/11639204.html

相关文章
|
3月前
|
网络协议 网络安全 网络虚拟化
|
6月前
|
网络协议 网络安全 数据安全/隐私保护
IPv4和IPv6有什么区别
IPv4和IPv6有什么区别
|
网络协议
IPv6 到 IPv4再到IPv6转换时 消失的字段及解决方法
IPv6 到 IPv4再到IPv6转换时 消失的字段及解决方法
83 0
|
网络协议 NoSQL Linux
不要在linux上启用net.ipv4.tcp_tw_recycle参数
不要在linux上启用net.ipv4.tcp_tw_recycle参数 发布于 2015/07/27 莿鸟栖草堂 本文为翻译英文BLOG《Coping with the TCP TIME-WAIT state on busy Linux servers》,但并非完整的翻译,译者CFC4N对原文理解后,进行了调整,增加了相关论点论据,跟原文稍有不同。
3808 1
|
网络协议
在Win2000里快速切换TCP/IP设置
自己的笔记本要在多个地方上网,但家里是自动获取IP的,实验室有自己的子网,宿舍又有另一个子网,每次换地方都得手动换TCP/IP设置,很麻烦。今天在网上看到一篇文章,原来要解决这个问题是非常简单的,不需要安装任何软件,下面是我的做法。
1053 0
|
网络协议 网络架构 Linux