当前位置:网站首页>iptables 基础配置
iptables 基础配置
2022-08-11 05:33:00 【macob】
iptables -L -n --line-number
iptables -t filter -L INPUT -n --line-number
iptables-save > iptables.save
iptables-restore < iptables.save
iptables -D INPUT 1
ptables -R INPUT 3 -s 10.8.9.0/24 --j ACCEPT
iptables -I INPUT 1 -s 192.168.2.0/24 -j ACCEPT
iptables -F
iptables -t filter -P FORWARD DROP
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -R INPUT 5 -m state --state ESTABLISHED,RELATED -j ACCEPT
接口参数
-i -o
-i eth0:匹配从eth0进入的数据包
-o eht0:匹配从eth0离开的数据包
-i ! eth0:匹配不是从eht0进入的数据包
上层协议的匹配参数
参考/etc/protocols文件
-p tcp、-p 6
-p icmp、-p 1
-p ! icmp
匹配来源/目的ip地址
-s 192.168.0.1
-d 172.16.0.0/16
-d www.baidu.com
-s ! 192.168.0.0/24
匹配来源/目的接口
--sport 110
--dport 80
--sport ! 80
匹配端口范围
--sport 22:80
-m multiport --dport 21,22,23,80,3306
iptables -A INPUT -s 10.1.1.0/24,10.1.2.0/24 -j ACCEPT
对22和80端口的请求合成一个:
iptables -I INPUT -d 10.10.10.1 -p tcp -m multiport --destination-ports 22,23,80 -m state --state NEW,ESTABLISHED -j ACCEPT
边栏推荐
- (1) Software testing theory (0 basic understanding of basic knowledge)
- SECURITY DAY01 (Monitoring Overview, Zabbix Basics, Zabbix Monitoring Services)
- 无胁科技-TVD每日漏洞情报-2022-7-28
- VMware workstation 16 安装与配置
- Numpy_备注
- 无胁科技-TVD每日漏洞情报-2022-7-31
- Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-31
- 无胁科技-TVD每日漏洞情报-2022-7-20
- What should I do if I forget the user password in MySQL?
- 无胁科技-TVD每日漏洞情报-2022-8-6
猜你喜欢
随机推荐
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-6
ETCD cluster fault emergency recovery - local data is available
MoreFileRename批量文件改名工具
无胁科技-TVD每日漏洞情报-2022-8-2
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-29
(一)软件测试理论(0基础了解基础知识)
无胁科技-TVD每日漏洞情报-2022-7-19
AUTOMATION DAY06 (Ansible Advanced, Ansible Role)
Project Notes - Random 2
无胁科技-TVD每日漏洞情报-2022-8-8
ETCD cluster fault emergency recovery - to recover from the snapshot
从mask-rcnn到shp
ETCD集群故障应急恢复-本地数据可用
SECURITY DAY06( iptables防火墙 、 filter表控制 、 扩展匹配、nat表典型应用 )
CLUSTER DAY02 (Keepalived Hot Standby, Keepalived+LVS, HAProxy Server)
(三)软件测试理论(了解软件的缺陷知识)
No threat of science and technology - TVD vulnerability information daily - 2022-7-21
无胁科技-TVD每日漏洞情报-2022-7-22
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-19
HPC平台搭建








