使用iptable实现: 放行ssh,telnet, ftp, web服务80端口,其他端口服务全部拒绝
服务端口:
Ssh:22
Telnet: tcp 23
ftp:tcp 20 21
Web: 80 443
[root@centos7 ~]# iptables -A INPUT -p tcp -m multiport –dport 21,22,23,80,443 -j ACCEPT
[root@centos7 ~]# iptables -A INPUT -j REJECT
[root@centos7 ~]#
[root@centos7 ~]# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
116 6768 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
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 20 packets, 2384 bytes)
pkts bytes target prot opt in out source destination
[root@centos7 ~]#
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/276723.html