标签:动态 range stat 共享上网 put type 冒号 man roo
[root@web1 ~]# iptables -R INPUT 7 -p tcp -m multiport --sports 80,443 -m state --state RELATED,ESTABLISHED -j ACCEPT
[root@web1 ~]# iptables -I INPUT 8 -p tcp -m multiport --sports 445,139 -m state --state RELATED,ESTABLISHED -j ACCEPT
[root@web1 ~]# iptables -I INPUT 9 -p udp -m multiport --sports 137,138 -m state --state RELATED,ESTABLISHED -j ACCEPT
[root@web1 ~]# iptables -I OUTPUT 5 -p tcp -m multiport --dports 80,443 -j ACCEPT
[root@web1 ~]# iptables -I INPUT -d 192.168.1.11 -p tcp -m multiport --dports 80,443 -j ACCEPT
[root@web1 ~]# iptables -I OUTPUT 7 -d 192.168.1.3 -p tcp -m multiport --dports 445,139 -j ACCEPT
[root@web1 ~]# iptables -I OUTPUT 8 -d 192.168.1.3 -p udp -m multiport --dports 137,138 -j ACCEPT
-m iprange --dst-range --src-range
-m time --timestart --timstop --weekdays --monthdays --kerneltz
-m string --algo kmp --string "gay"
-m connlimit --connlimit-upto(above)
[root@web1 ~]# iptables -R INPUT 1 -d 192.168.1.11 -p tcp -m multiport --dports 80,443 -m connlimit --connlimit-upto 100 -j ACCEPT
[root@web1 ~]# iptables -R INPUT 2 -p icmp --icmp-type 8 -m limit --limit 120/m --limit-burst 30 -j ACCEPT
[root@web1 ~]# iptables -I INPUT 3 -syn -m limit --limit 5000/s --limit-burst 200 -j ACCEPT
ftp: 内核模块装载modprobe nf_conntrack_ftp ,入站允许ESTABLIESHED和RELATED
-N 新建自定义链,在INPUT等链上 -j自定义链,-X删除自定义链
重启后恢复 iptables-restore < /etc/sysconfig/iptables
dns服务器
iptables -A INPUT -s 192.168.1.3 -d 192.168.1.10 -p tcp --dport 37777 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp0s3 -j REJECT
iptables -P FORWARD DROP
iptables -A OUTPUT -s 192.168.1.10 -d 192.168.1.3 -p tcp --sport 37777 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o enp0s3 -j REJECT
iptables -I INPUT -s 192.168.1.0/24 -d 192.168.1.10 -p tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -s 192.168.1.10 -d 192.168.1.0/24 -p tcp --sport 53 -m state --state ESTABLISHED -j ACCEPT
iptables -I INPUT -s 192.168.1.0/24 -d 192.168.1.10 -p udp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -s 192.168.1.10 -d 192.168.1.0/24 -p udp --sport 53 -m state --state ESTABLISHED -j ACCEPT
iptables -I OUTPUT 4 -s 192.168.1.10 -p udp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -d 192.168.1.10 -p udp --sport 53 -m state --state ESTABLISHED -j ACCEPT
iptables -I OUTPUT 5 -s 192.168.1.10 -p tcp -m multiport --dports 80,443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -d 192.168.1.10 -p tcp -m multiport --sports 80,443 -m state --state ESTABLISHED -j ACCEPT
iptables -I INPUT 6 -p icmp --icmp-type 8 -m limit --limit 120/m --limit-burst 30 -j ACCEPT
iptables -I INPUT 7 -p icmp --icmp-type 0 -j ACCEPT
iptables -I OUTPUT 6 -p icmp --icmp-type 0 -j ACCEPT
iptables -I OUTPUT 7 -p icmp --icmp-type 8 -j ACCEPT
iptables -I OUTPUT 5 -s 192.168.1.10 -p tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -d 192.168.1.10 -p tcp --sport 53 -m state --state ESTABLISHED -j ACCEPT
web服务器
iptables -A INPUT -s 192.168.1.3 -d 192.168.1.11 -p tcp --dport 37777 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp0s3 -j REJECT
iptables -P FORWARD DROP
iptables -A OUTPUT -s 192.168.1.11 -d 192.168.1.3 -p tcp --sport 37777 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o enp0s3 -j REJECT
iptables -I INPUT -d 192.168.1.11 -p tcp -m multiport --dports 80,443 -m state --state NEW,ESTABLISHED -m connlimit --connlimit-upto 100 -j ACCEPT
iptables -I OUTPUT -s 192.168.1.11 -p tcp -m multiport --sports 80,443 -m state --state ESTABLISHED -j ACCEPT
iptables -I OUTPUT 3 -s 192.168.1.11 -p udp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 3 -d 192.168.1.11 -p udp --sport 53 -m state --state ESTABLISHED -j ACCEPT
iptables -I OUTPUT 4 -s 192.168.1.11 -p tcp -m multiport --dports 80,443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -d 192.168.1.11 -p tcp -m multiport --sports 80,443 -m state --state ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -p icmp --icmp-type 8 -m limit --limit 120/m --limit-burst 30 -j ACCEPT
iptables -I INPUT 6 -p icmp --icmp-type 0 -j ACCEPT
iptables -I OUTPUT 5 -p icmp --icmp-type 0 -j ACCEPT
iptables -I OUTPUT 6 -p icmp --icmp-type 8 -j ACCEPT
iptables -I INPUT 5 -s 192.168.1.3 -d 192.168.1.11 -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT 5 -s 192.168.1.11 -d 192.168.1.3 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
iptables -I OUTPUT 4 -s 192.168.1.11 -p tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -d 192.168.1.11 -p tcp --sport 53 -m state --state ESTABLISHED -j ACCEPT
REDIRECT 端口映射
SNAT规则
[root@center ~]# iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -j SNAT --to-source 192.168.1.9
[root@center ~]# iptables -t nat -A PREROUTING -d 192.168.1.9 -p tcp --dport 443 -j DNAT --to-destination 192.168.10.11:443
[root@center ~]# iptables -t nat -A PREROUTING -d 192.168.1.9 -p tcp --dport 80 -j DNAT --to-destination 192.168.10.11:80
PASSWD: 需要输入密码
visudo加入
xlc ALL=(ALL) NOPASSWD: /usr/bin/rsync
标签:动态 range stat 共享上网 put type 冒号 man roo
原文地址:https://www.cnblogs.com/xuluchuan/p/9465404.html