centos7如何安装和配置iptables

2024-11-03 19:25:31

1、首先要确认操作系统的版本和位数[root@localhost ~]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core)[root@localhost ~]# uname -aLinux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux[root@localhost ~]#

centos7如何安装和配置iptables

3、使用yum install iptables-services命令安装防火墙,输入y继续

centos7如何安装和配置iptables

5、启动iptables.service,并查看规则[root@localhost ~]# systemctl start iptables.service[root@localhost ~]# iptables -L Chain INPUT (policy ACCEPT)target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHEDACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:sshREJECT all -- anywhere anywhere reject-with icmp-host-prohibitedChain FORWARD (policy ACCEPT)target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibitedChain OUTPUT (policy ACCEPT)target prot opt source destination [root@localhost ~]#

centos7如何安装和配置iptables
猜你喜欢