Linux关闭防火墙,开放端口
Centos/redhat系统:
开启防火墙
#systemctl start firewalld.service
停止firewall
#systemctl stop firewalld.service
禁止firewall开机启动
#systemctl disable firewalld.service
查看默认防火墙状态(关闭后显示not running,开启后显示running)
#firewall-cmd --state
配置iptables,首先需要安装iptables服务
#yum install iptables-services
编辑防火墙配置文件
#vim /etc/sysconfig/iptables
加入下面的几行,22是默认存在的
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -jACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080-j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
22端口是供ssh访问的,80,8080端口是http服务访问的,以后用到https,也需要打开443端口的访问权限。
保存,重启iptables服务
最后重启防火墙使配置生效
#systemctl restart iptables.service
设置防火墙开机启动
#systemctl enable iptables.service
重启之后firewall又被打开,所以我们要设置禁止firewall开机自启动
禁止firewall开机自启动
停止firewall
#systemctl stop firewalld.service
禁止firewall开机启动
#systemctl disable firewalld.service
Linux关闭防火墙,开放端口的更多相关文章
- CentOS7 firewalld打开关闭防火墙 开放端口
firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...
- Linux上防火墙开放对应的端口
在Linux上防火墙开放对应的端口的命令如下: 方式一: [root@localhost sbin]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACC ...
- Centos7和Centos6防火墙开放端口配置方法(避坑教学)
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...
- CentOS 7防火墙开放端口快速方法
这篇文章主要为大家详细介绍了Centos7.1防火墙开放端口的快速方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 例如安装Nagios后,要开放5666端口与服务器连接,命令如下: [ro ...
- Centos7 防火墙开放端口,查看状态,查看开放端口
CentOS7 端口的开放关闭查看都是用防火墙来控制的,具体命令如下: 查看防火墙状态:(active (running) 即是开启状态) [root@WSS bin]# systemctl fire ...
- CentOS7使用firewalld打开关闭防火墙与端口(转载)
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- linux关闭防火墙
查看防火墙状态: sudo service iptables status linux关闭防火墙命令: sudo service iptables stop linux启动防火墙命令: sudo se ...
- Linux关闭防火墙、SELinux
使用root权限: Linux关闭防火墙: 1. chkconfig –list|grep iptables 2. chkconfig iptables off 永久关闭防火墙 3. chkconfi ...
- 关于学习CentOS7使用firewalld打开关闭防火墙和端口
1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...
- CentOS7使用firewalld打开关闭防火墙与端口(转)
CentOS7使用firewalld打开关闭防火墙与端口 1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...
随机推荐
- A1085. Perfect Sequence
Given a sequence of positive integers and another positive integer p. The sequence is said to be a & ...
- A1090. Highest Price in Supply Chain
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone invo ...
- 增加swap分区,文件形式
查看swap a: sudo swapon -s b: free -m 文件方式: 1. 生成 生成一个1Gb(bs*count)的文件 [root@localhost ~]# dd if=/dev/ ...
- 【已解决】Microsoft visual c++ 14.0 is required问题解决办法
装 识别图形验证码库tesserocr的时候,出现了Microsoft visual c++ 14.0 is required的问题,用离线安装还是没有用. 就只能乖乖装Microsoft visua ...
- springboot-24-restTemplate的使用
项目中使用的是HttpClient, 后来改成springboot, 偶然间发现restTemplate { "Author": "tomcat and jerry&qu ...
- UML类关系(依赖,关联,聚合,组合,泛化,实现)
转自https://blog.csdn.net/k346k346/article/details/59582926 在学习面向对象设计时,类关系涉及依赖.关联.聚合.组合和泛化这五种关系,耦合度依 ...
- 搭建Telnet服务器
搭建Telnet服务器 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 可能大家都知道现在已经很少有人用TELNET服务器, 因为它传输数据是以明文的方式,我们很容易通过抓包软件讲数 ...
- vue常用UI组件
Mint UI 项目主页:http://mint-ui.github.io/#!/zh-cn demo:http://elemefe.github.io/mint-ui/#/ github地址:htt ...
- DIV仿textarea文本域,contenteditable如何只能输入纯文本
对于支持HTML5浏览器有2种方法: 1. HTML5 <div contenteditable="plaintext-only"></div> 2. C ...
- springboot(七)邮件服务
简单使用 发送邮件应该是网站的必备功能之一,什么注册验证,忘记密码或者是给用户发送营销信息.最早期的时候我们会使用JavaMail相关api来写发送邮件的相关代码,后来spring退出了JavaMai ...