当前位置:网站首页>iptables 使用脚本来管理规则
iptables 使用脚本来管理规则
2022-08-11 05:33:00 【macob】
使用变量来存储和改变ip地址等参数
例:ipt.sh
#!/bin/bash
IPT=/sbin/iptables
SERVER=10.1.1.1,10.1.1.2
ADMIN=192.168.1.1
iptables -t filter -F
iptables -X
iptables -Z
$IPT -A INPUT -p tcp -m state --state INVALID -j DROP
$IPT -A INPUT -p tcp -d $SERVER --dport 80 -j ACCEPT
$IPT -A INPUT -p tcp -s $ADMIN -d $SERVER --dport 22 -j ACCEPT
vi /etc/rc.d/rc.local
添加
/root/ipt.sh
chmod u+x /etc/rc.d/rc.local
边栏推荐
猜你喜欢
SECURITY DAY04( Prometheus服务器 、 Prometheus被监控端 、 Grafana 、 监控数据库)
slurm cluster construction
逐步揭示makop.mkp勒索病毒中毒防范恢复解密
buildroot setup dhcp
推荐一个好用的IDEA插件---Translation—中英互译
SSH服务详解
Solve the problem that port 8080 is occupied
【LeetCode】851.喧闹与富有(思路+题解)
FusionCompute8.0.0 实验(2)虚拟机创建
CLUSTER DAY02( Keepalived热备 、 Keepalived+LVS 、 HAProxy服务器 )
随机推荐
arcgis填坑_4
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-5
CLUSTER DAY01(集群及LVS简介 、 LVS-NAT集群 、 LVS-DR集群)
Es常用操作和经典case整理
SECURITY DAY03 (one-click deployment of zabbix)
mysql 中登录报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)ERROR
查看CPU和其他硬件温度的软件
No threat of science and technology - TVD vulnerability information daily - 2022-8-4
(1) Software testing theory (0 basic understanding of basic knowledge)
处理eking.Devos勒索病毒防范解密恢复操作攻略
China Mobile Communications Group Co., Ltd.: Business Power of Attorney
uboot code analysis 1: find the main line according to the purpose
VMware workstation 16 安装与配置
CLUSTER DAY04 (Block Storage Use Cases, Distributed File Systems, Object Storage)
文本三剑客——grep过滤
【LeetCode】1036. 逃离大迷宫(思路+题解)压缩矩阵+BFS
消息中间件
逐步揭示makop.mkp勒索病毒中毒防范恢复解密
ansible batch install zabbix-agent
Apache Flink jobmanager/logs 目录穿越漏洞复现