br_netfilter 模塊開機自動方法

環境bash

cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)spa

 

在/etc/sysctl.conf中添加:code

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1 
執行sysctl -p 時出現:
[root@localhost ~]# sysctl -p
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory

解決方法:blog

[root@localhost ~]# modprobe br_netfilter
[root@localhost ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

重啓後模塊失效,下面是開機自動加載模塊的腳本ip

在/etc/新建rc.sysinit 文件it

cat /etc/rc.sysinit table

#!/bin/bash
for file in /etc/sysconfig/modules/*.modules ; do
[ -x $file ] && $file
done

在/etc/sysconfig/modules/目錄下新建文件以下class

cat /etc/sysconfig/modules/br_netfilter.modules
modprobe br_netfilter

增長權限module

chmod 755 br_netfilter.modules

重啓後 模塊自動加載file

[root@localhost ~]# lsmod |grep br_netfilter
br_netfilter           22209  0
bridge                136173  1 br_netfilter
相關文章
相關標籤/搜索