Linux关闭防火墙、设置端口
关闭防火墙
1)重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
验证防火墙是否关闭:chkconfig --list |grep iptables
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
centos 7:
systemctl stop firewalld.service #停止
systemctl disable firewalld.service #禁用
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
之前的版本:
service iptables stop #停止
chkconfig iptables off #禁用
需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
在开启了防火墙时,做如下设置,开启相关端口,
修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
端口设置
在防火墙中打开要用到的端口
第一步打开防火墙
chkconfig iptables on
第二步启动防火墙
service iptables start
第三步编辑防火墙
先查看防火墙信息 service iptables status
然后编辑 vi /etc/sysconfig/iptables
2181,2888,3888三行信息是拷贝上面22的信息

第四部重启防火墙
service iptables restart
然后查看防火墙信息 service iptables status
关闭selinux
vi /etc/selinux/config
SELINUX=disabled
Linux关闭防火墙、设置端口的更多相关文章
- Linux关闭防火墙、SELinux
使用root权限: Linux关闭防火墙: 1. chkconfig –list|grep iptables 2. chkconfig iptables off 永久关闭防火墙 3. chkconfi ...
- 关于学习CentOS7使用firewalld打开关闭防火墙和端口
1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...
- 转:linux关闭防火墙iptables
ref:https://jingyan.baidu.com/article/066074d64f433ec3c21cb000.html Linux系统下面自带了防火墙iptables,iptables ...
- 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 ...
- CentOS7使用firewalld打开关闭防火墙与端口(转)
CentOS7使用firewalld打开关闭防火墙与端口 1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...
- LINUX关闭防火墙、开放特定端口等常用操作
1. 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2. 即时生效,重启后失效: 开启:service iptables s ...
- Linux 基本防火墙设置和开放端口命令
关闭防火墙 CentOS 7.RedHat 7 之前的 Linux 发行版防火墙开启和关闭( iptables ): 即时生效,重启失效 #开启 service iptables start #关闭 ...
- LINUX关闭防火墙(转载)
(1) 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off (2) 即时生效,重启后失效: 开启:service iptables ...
随机推荐
- babelrc笔记
Babel默认只是转换新的语法(简单转换语法糖),如箭头函数等,但不会转换新的API,如Iterator.Generator.Set.Maps.Proxy.Reflect.Symbol.Promise ...
- MySQL二进制快速安装升级(待验证)
适合小版本的升级. 即 关闭当前的MySQL,替换当前的二进制文件或包,在现有的数据目录上重启MySQL,并运行mysql_upgrade. 特点:不改变数据文件,升级速度快:但,不可以跨操作系统,不 ...
- ingress Whitelisting白名单机制
Whitelisting To restrict the service in a way that only a list of IPs can access it, modify the ingr ...
- 【VS开发】【视频开发】利用ffmpeg+opencv实现画中画
需求:把两路视频合成一路,即一个画面同时显示两路视频,其中一路缩小成小视频叠在大视频上面,和电视机的画中画效果类似. 思路:用h264编码的视频举例,文件中存储的es流是h264,经过解码成yuv,y ...
- Jenkins通过完全复制快速创建新项目
- python3 turtle
一.turtle 1.操控画笔画图,turtle相当于笔头(x头?),有方向 2.https://docs.python.org/3.6/library/turtle.html 二.移动和绘制 imp ...
- Fiddler抓包工具如何可以抓取HTTPS
- PB 计算公式算出结果赋值给另外一列
在数据窗口中添加一个公式列 --在itmchanged事件中写的计算赋值代码 String ls_gs,ls_sqldecimal{2} ls_gsjg if dwo.name='gs1' then ...
- warning: LF will be replaced by CRLF in application.yml. The file will have its origina解决方法
环境: windows提交时报错如图所示: 原因是存在符号转义问题 windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示,解决办法: git con ...
- Asp.netMVC中Ajax.BeginForm上传文件
做一个上传并解压的功能,解压完了回调,解压多少文件.搞了半天用Ajax.BeginForm.各种坑,后来直接放弃 @using (Ajax.BeginForm("UploadFile&quo ...