[步骤] Linux 网络的设置 (禁用 IPv6) (openSUSE & SLES 版)

内容一:显示 IPv6 是否启用

1.1 方法一:通过 ifconfig 命令实现

# ifconfig

1.2 方法二:通过 ip 命令实现

# ip a s

(补充:如果出现了 inet6 则 IPv6 是激活的)

1.3 方法三:通过 sysctl -a 命令实现

# sysctl -a | grep -i ipv6|grep -i disable
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.eth1.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

(补充:从输出结果中可以看出 IPv6 已经被禁用)

内容二:临时禁用 IPv6

2.1 临时禁用本地所有的 IPv6

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

(补充:系统或者网卡重启后禁用失效)

2.2 临时禁用某 1 张网卡的 IPv6

# sudo echo 1 > /proc/sys/net/ipv6/conf/ens32/disable_ipv6 


补充:
1) 这里的 ens32 是要禁用 IPv6 的网卡名称
2) 系统或者网卡重启后禁用失效

内容三:永久禁用 IPv6

# yast lan

Global Options –> IPv6 Protocol Settings –> 取消勾选 IPv6

[排错] openSUSE & SLES 解决开机后 wicked 不能设置 IP 地址

报错代码:

开机后 wicked 不能自动设置 IP 地址

# cat /var/log/messages
......
...... wickedd-nanny[1218]: device eth0: call to org.opensuse.Network.Protocol.IPv6.changeProtocol() failed: General failure
...... wickedd-nanny[1218]: eth0: failed to bring up device, still continuing
......
...... lo              up
...... eth0            device-not-running
...... Finished wicked managed network interfaces.
......

解决方法一:将 wicked 软件降级到较低版本

(步骤略)

解决方法二:取消 ipv6.disable=1 参数

2.1 修改 /etc/default/grub 文件

# /etc/default/grub

删除以下内容:

......
......ipv6.disable=1......
......

2.2 使刚刚修改的配置生效

# grub2-mkconfig -o /boot/grub2/grub.cfg

2.3 检查刚刚设置的配置

# grep "^\s*ipv6.disable" /boot/grub2/grub.cfg

[CONTENT] Linux recommended swap size

Content:

For RHEL 6, RHEL 7, RHEL 8, RHEL 9

RAM sizeRecommended swap sizeRecommended swap size if allowing for hibernation
From 0 to 2GB 2 times the RAM size3 times the RAM size
From 2GB to 8GBThe same size of the RAM2 times the RAM size
From 8GB to 64GBAt least 4GB1.5 times the RAM size
From 64GBAt least 4GBHibernation is not recommended
RHEL 6, RHEL 7, RHEL 8, RHEL 9 Recommended Swap Size Table

Note: A 100GB swap is recommended if system with over 140 logical processes or over 3TB RAM

Reference:

https://access.redhat.com/solutions/15244