「sysctl net.ipv6.conf.all.accept_ra」在 CentOS 7 和 RHEL 7 中的行為不同

「sysctl net.ipv6.conf.all.accept_ra」在 CentOS 7 和 RHEL 7 中的行為不同

我有兩台虛擬機器;一個使用 RHEL 7,另一個使用 CentOS 7 sysctl net.ipv6.conf.all.accept_ra

作業系統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=1GRUB_CMDLINE_LINUX

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

根據您的變更重新產生 GRUB 選項。

然後需要重新啟動。

相關內容