相关疑难解决方法(0)

Debian '忽略' /etc/network/if-pre-up.d/iptables

我希望我的 iptables 规则在启动时自动加载。根据 Debian 上的 wiki,这可以通过在 /etc/network/if-pre-up.d/ 中放置一个名为 iptables 的脚本来完成,所以我做到了,这就是它的样子:

cat /etc/network/if-pre-up.d/iptables 
#!/bin/sh
/sbin/iptables-restore < /etc/firewall/iptables.rules
/sbin/ip6tables-restore < /etc/firewall/ip6tables.rules
Run Code Online (Sandbox Code Playgroud)

这个脚本有效:如果我以 root 身份运行它,我的防火墙规则就会被应用。但是在重新启动时没有防火墙规则。我究竟做错了什么?

根据要求:/etc/network/interfaces(我没有碰过这个文件)

user@DebianVPS:~$ cat /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
Run Code Online (Sandbox Code Playgroud)

networking debian iptables

15
推荐指数
2
解决办法
2万
查看次数

标签 统计

debian ×1

iptables ×1

networking ×1