我正在尝试iptables
在启动时为我的 VPN 服务添加一些规则rc.local
。
我的rc.local
文件是:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source #######
exit 0
它是可执行的:
-rwxr-xr-x 1 root root 529 Nov 24 06:01 /etc/rc.local
但它不会在启动时运行!(没有添加任何规则!)
有什么问题?
如何让它在启动时运行?