linux 下刚装入centos 防火墙情况。

1:检查是否安装iptables防火墙:

[root@localhost bin]# service iptables status
Redirecting to /bin/systemctl status  iptables.service
iptables.service
   Loaded: not-found (Reason: No such file or directory)

   Active: inactive (dead)

2:没有安装的话默认使用的是firewall作为防火墙,所以把他停掉,安装一个iptables

[root@localhost sysconfig]# systemctl stop firewalld 
[root@localhost sysconfig]# systemctl mask firewalld 
ln -s '/dev/null' '/etc/systemd/system/firewalld.service'
[root@localhost sysconfig]# yum install -y iptables    (安装iptables)
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cn99.com
 * updates: mirrors.njupt.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 iptables.x86_64.0.1.4.21-13.el7 将被 升级

---> 软件包 iptables.x86_64.0.1.4.21-24.1.el7_5 将被 更新

[root@localhost sysconfig]# systemctl start iptables.service
[root@localhost sysconfig]# systemctl enable iptables.service   //设置开机自启
ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants/iptables.service'
[root@localhost sysconfig]# service iptables status  //状态
Redirecting to /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled)
   Active: active (exited) since 四 2018-07-12 23:58:08 CST; 47s ago
 Main PID: 17625 (code=exited, status=0/SUCCESS)


[root@localhost sysconfig]# vi /etc/sysconfig/iptables  //添加开放端口


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值