当前位置:网站首页>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
边栏推荐
- ansible批量安装zabbix-agent
- 无胁科技-TVD每日漏洞情报-2022-7-28
- Local yum source build
- FusionCompute8.0.0实验(0)CNA及VRM安装(2280v2)
- VMware workstation 16 安装与配置
- 树莓派设置静态IP地址
- slurm cluster construction
- Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-5
- 无胁科技-TVD每日漏洞情报-2022-7-29
- uboot code analysis 1: find the main line according to the purpose
猜你喜欢
随机推荐
What should I do if I forget the user password in MySQL?
mysql数据库安装教程(超级超级详细)
No threat of science and technology - TVD vulnerability information daily - 2022-8-4
SECURITY DAY04 (Prometheus server, Prometheus monitored terminal, Grafana, monitoring database)
VMware workstation 16 安装与配置
从mask-rcnn到shp
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-5
升级到Window11体验
(1) Software testing theory (0 basic understanding of basic knowledge)
空间点模式方法_一阶效应和二阶效应
ETCD cluster fault emergency recovery - to recover from the snapshot
CLUSTER DAY03( Ceph概述 、 部署Ceph集群 、 Ceph块存储)
deepin v20.6+cuda+cudnn+anaconda(miniconda)
无胁科技-TVD每日漏洞情报-2022-7-21
逐步揭示makop.mkp勒索病毒中毒防范恢复解密
Arcgis小工具_实现重叠分析
华为防火墙-5-NAT
树莓派设置静态IP地址
SECURITY DAY06( iptables防火墙 、 filter表控制 、 扩展匹配、nat表典型应用 )
无胁科技-TVD每日漏洞情报-2022-7-29