3.使用iptable实现: 放行ssh,telnet, ftp, web服务80端口,其他端口服务全部拒绝

使用iptable实现: 放行ssh,telnet, ftp, web服务80端口,其他端口服务全部拒绝

服务端口:

Ssh22

Telnet: tcp 23

 ftptcp 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 ~]#

 

posted @ 2022-07-24 19:15  惊起千层浪  阅读(222)  评论(0)    收藏  举报