redhat7 禁用ip6

来源:互联网 发布:基金怎么玩 知乎 编辑:程序博客网 时间:2024/06/01 16:53

在文件中写入一下内容 /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1net.ipv6.conf.default.disable_ipv6 = 1

在运行中的机器中禁用ip6

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

或者

sysctl -w net.ipv6.conf.all.disable_ipv6=1sysctl -w net.ipv6.conf.default.disable_ipv6=1

Additional note #1: If problems with X forwarding are encountered on systems with IPv6 disabled, edit /etc/ssh/sshd_config and make either of the following changes:

(1) Change the line

#AddressFamily any

to

AddressFamily inet

(inet is ipv4 only; inet6 is ipv6 only)

or

(2) Remove the hash mark (#) in front of the line

#ListenAddress 0.0.0.0

Then restart ssh.

Additional note #2: If problems with starting postfix are encountered on systems with IPv6 disabled, either

(1) edit /etc/postfix/main.cf and comment out the localhost part of the config and use ipv4 loopback.

#inet_interfaces = localhostinet_interfaces = 127.0.0.1

or

(2) take out the ipv6 localhost from /etc/hosts .

Additional Note #3 : To disable RPCBIND ipv6 (rpcbind, rpc.mountd, prc.statd) remark out the udp6 and tcp6 lines in /etc/netconfig:

udp        tpi_clts      v     inet     udp     -       -tcp        tpi_cots_ord  v     inet     tcp     -       -#udp6       tpi_clts      v     inet6    udp     -       -#tcp6       tpi_cots_ord  v     inet6    tcp     -       -rawip      tpi_raw       -     inet      -      -       -local      tpi_cots_ord  -     loopback  -      -       -unix       tpi_cots_ord  -     loopback  -      -       -
0 0