Ubuntu安装使用iptables
sudo apt-get install iptables-persistent
iptables-save > /etc/iptables.up.rules
接着修改 /etc/network/interfaces 脚本自动应用这些规则(末行是添加的)
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.up.rules
你也可以准备一组规则并自动应用它
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.up.rules
post-down iptables-restore < /etc/iptables.down.rules