我有两个虚拟机;一个使用 RHEL 7,另一个使用 CentOS 7。sysctl net.ipv6.conf.all.accept_ra
在两个 VMS 上运行显示不同的行为。
操作系统7
$ sysctl net.ipv6.conf.all.accept_ra
net.ipv6.conf.all.accept_ra = 1
RHEL7
# sysctl net.ipv6.conf.all.accept_ra
sysctl: cannot stat /proc/sys/net/ipv6/conf/all/accept_ra: No such file or directory
然而,这个参数net.ipv6.conf.all.accept_ra
存在于/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).
fs.suid_dumpable = 0
kernel.randomize_va_space = 2
net.ipv4.ip_forward = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.log_martians = 1
pv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_syncookies = 1
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
net.core.somaxconn=511
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
RHEL 7 中出现错误的原因可能是什么?
更新
后来发现里面没有ipv6
目录/proc/sys/net/
。原因可能是什么?
答案1
IPv6已被禁用启动时在您的系统上。当这样做完成后,就根本没有可用的 IPv6 痕迹了。
通常这是通过在 中添加一个选项来完成的/etc/default/grub
。
如果是这种情况,您可以通过编辑和删除应该出现在以 开头然后运行的行中的/etc/default/grub
选项来恢复此设置:ipv6.disable=1
GRUB_CMDLINE_LINUX
grub2-mkconfig -o /boot/grub2/grub.cfg
根据您的更改重新生成 GRUB 选项。
然后需要重新启动。