使用iptable实现: 放行ssh,telnet, ftp, web服务80端口,其他端口服务全部拒绝
发布时间 2023-10-07 14:58:42作者: 小糊涂90
[root@centos8 ~]#iptables -I INPUT -p tcp -m multiport --dport 21,22,23,80 -j ACCEPT
[root@centos8 ~]#iptables -I INPUT -A INPUT -j REJECT
[root@centos8 ~]#
[root@centos8 ~]#iptables -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
70 4480 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 21,22,23,80
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable