sysctl -p /etc/sysctl.conf返回错误

在运行sysctl -p /etc/sysctl.conf后,在VPS中重新安装了CenotOS 6,我得到了这个错误:

 error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key error: "net.bridge.bridge-nf-call-iptables" is an unknown key error: "net.bridge.bridge-nf-call-arptables" is an unknown key 

解决这个错误的出发点是什么?

你在你的问题中提到你正在使用VPS。 什么样的VPS? 这听起来像你在一个OpenVZ VPS。 如果是OpenVZ,它将像许多容器一样共享内核,您不能直接在主机上更改每个容器的内核configuration。 我实际上构build了一个litlle OpenVZ centos容器,我尝试着应用内核configurationnet.bridge.bridge-nf-call-ip6tables = 0然后是sysctl -p ,我得到了和你一样的错误。 如果您确实需要这个function,那意味着您可能需要考虑更改所使用的虚拟化types,或者尝试联系您的VPS提供商并要求他启用此设置。

最好。

尝试:

 modprobe bridge lsmod | grep bridge 

你不会把这些模块加载到内核中。

在Red Hat Bugzilla上有几个bugreports,例如这里和这里 。

只要删除行或运行sysctl -e -p而不是sysctl -p

你得到错误,因为你没有加载bridge内核模块。 三个select:

  1. 如果需要,加载模块
  2. /etc/sysctl.conf注释掉这些行
  3. sysctl通过给它加上-e标志来忽略错误。

这已经在红帽勘误表中得到修复:RHBA-2015:1289 (可能paywall)。

总之 – 解决方法是将configuration从sysctl.conf移到modprobe.d/dist.conf

删除/etc/sysctl.conf的违规行

 sed -i '/net.bridge.bridge-nf-call-/d' /etc/sysctl.conf 

并将行为添加到/etc/modprobe.d/dist.conf

 cat <<EOF>>/etc/modprobe.d/dist.conf # Disable netfilter on bridges when the bridge module is loaded install bridge /sbin/modprobe --ignore-install bridge && /sbin/sysctl -q -w net.bridge.bridge-nf-call-arptables=0 net.bridge.bridge-nf-call-iptables=0 net.bridge.bridge-nf-call-ip6tables=0 EOF 

在桥接模块加载时,它将正确地设置值,或者直接更新您的rpms版本

 module-init-tools-3.9-25.el6 initscripts-9.03.53-1.el6 

两者都默认存在于RHEL 6.8中

如果有人对这个背后的历史感兴趣的话, 这里 就有一个解释。