Linux防火墙设置-开放端口

来源:互联网 发布:mac加速的视频播放器 编辑:程序博客网 时间:2024/06/05 22:50

防火墙基本操作指令

//查询防火墙状态:[root@localhost ~]# service iptables status//停止防火墙:[root@localhost ~]# service iptables stop //启动防火墙:[root@localhost ~]# service iptables start //重启防火墙:[root@localhost ~]# service iptables restart //永久关闭防火墙:[root@localhost ~]# chkconfig iptables off //永久关闭后启用:[root@localhost ~]# chkconfig iptables on

开放端口

1.编辑 /etc/sysconfig/iptables

[root@localhost ~]# vim /etc/sysconfig/iptables在尾行添加-A INPUT -m state --state NEW -m tcp -p tcp --dport 8084 -j ACCEPT

2.保存文件,终端执行重启防火墙

[root@localhost ~]# service iptables restart 

重启防火墙

3.查看防火墙状态

[root@localhost ~]# service iptables status

查看端口

原创粉丝点击