eve-ng ubuntu 20.04 设置iptables
eve-ng ubuntu 20.04 设置iptables
一、设置方法
1、建立iptables规则开机加载脚本
sudo vi /etc/network/if-pre-up.d/iptablesload
写入以下内容
#!/bin/bash
iptables-restore < /etc/iptables.rules
exit 0

2、建立iptables规则关机/重启保存脚本
sudo vi /etc/network/if-post-down.d/iptablessave
写入以下内容
#!/bin/bash
iptables-save > /etc/iptables.rules
exit 0

3、添加可执行权限
chmod u+x /etc/network/if-pre-up.d/iptablesload
chmod u+x /etc/network/if-post-down.d/iptablessave
4、保存当前iptables规则到配置文件
sudo iptables-save > /etc/iptables.rules
二、命令解释
执行脚本加入到网卡up down自动执行脚本的目录中,在网卡up前加载iptables规则配置文件,在网卡down后保存当前iptables规则到iptables规则配置文件。

时光如水,总是无言。若你安好,便是晴天。
本文来自博客园,作者:OceanWaves,转载请注明原文链接:https://www.cnblogs.com/OceanWaves/p/17312442.html

浙公网安备 33010602011771号