在 CentOS 7 中运行“sysctl -p”时出现错误

在 CentOS 7 中运行“sysctl -p”时出现错误

当我sysctl -p在 CentOS 7 中运行时,出现错误:

:sysctl: cannot stat /proc/sys/net/ipv4/conf/eth0/rp_filter: No such file or directory

我的/etc/sysctl.conf是:

vm.overcommit_memory = 1
net.ipv4.tcp_max_syn_backlog = 20480
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.core.rmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
sysctl: setting key "net.core.somaxconn": Invalid argument
net.core.somaxconn = 262144
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.lo.rp_filter = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_tw_buckets = 1200000
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 65536 8388608
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
kernel.panic = 5
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.lo.rp_filter = 0

我究竟做错了什么?

答案1

net.ipv4.conf.all.rp_filter要通过 procfs启用,请执行以下操作。

echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter

然后运行sysctl -p,请在配置的第 9 行中删除它sysctl: setting key "net.core.somaxconn": Invalid argument

相关内容