当前位置:网站首页>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
边栏推荐
猜你喜欢
Arcgis小工具_实现重叠分析
(二)软件测试理论(*重点用例方法编写)
CLUSTER DAY01 (Introduction to cluster and LVS, LVS-NAT cluster, LVS-DR cluster)
arcgis填坑_3
CLUSTER DAY02( Keepalived热备 、 Keepalived+LVS 、 HAProxy服务器 )
MySQl进阶之索引结构
buildroot设置dhcp
(3) Software testing theory (understanding the knowledge of software defects)
mysql数据库安装教程(超级超级详细)
VMware workstation 16 installation and configuration
随机推荐
cloudreve使用体验
ramdisk实践1:将根文件系统集成到内核中
Login error in mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)ERROR
空间点模式方法_一阶效应和二阶效应
无胁科技-TVD每日漏洞情报-2022-7-30
TCP 三次握手、四次断开
SECURITY DAY01 (Monitoring Overview, Zabbix Basics, Zabbix Monitoring Services)
ssh中的密码登录和密钥登录
升级到Window11体验
buildroot设置dhcp
SECURITY DAY02 (Zabbix alarm mechanism, Zabbix advanced operation and monitoring case)
Numpy_备注
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-3
arcgis填坑_4
SECURITY DAY05(Kali系统 、 扫描与抓包 、 SSH基本防护、服务安全 )
Solve the problem that port 8080 is occupied
解决8080端口被占用问题
Deep Learning Matlab Toolbox Code Comments
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-29
无胁科技-TVD每日漏洞情报-2022-7-22