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 ...
随机推荐
- LODOP打印项水平居中
LODOP控制打印项水平居中,可以用如下语句,该语句控制的是打印项本身在纸张中水平居中.LODOP.SET_PRINT_STYLEA(0,"Horient",2);这个根据大的打印 ...
- [LeetCode] 106. Construct Binary Tree from Inorder and Postorder Traversal 由中序和后序遍历建立二叉树
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that ...
- Linux 上安装 appium
在linux 环境下安装需要以下几步:1.安装node.js, 通过 uname -a 命令查看到我的Linux系统位数是64位(备注:x86_64表示64位系统, i686 i386表示32位系 ...
- 微信小程序获取位置
获取位置 getLocation wx.getLocation({ type: 'wgs84', success (res) { const latitude = res.latitude const ...
- 小程序常用操作,if,for,跳转,弹出提示
if <block wx:if="{{result.child_items}}"> ... </block> <block wx:else> . ...
- layui 监听switch事件
<input type="checkbox" lay-filter="common_change_status" name="switch&qu ...
- RDP Error: The Identity Of The Remote Computer Cannot Be Verified
As i always need to remote to 20 servers at the same time, so i use a tool called Remote Desktop Con ...
- lambda表达式笔记
前几天一位好友分享了一篇文章,其中讲到了lambda表达式,正好最近看了一些内容,就做做笔记吧... lambda表达式服务于函数式接口,如果需要一个函数式接口的对象时,就可以用lambda表达式代替 ...
- 数组中重复的数字(Golang)
使用哈希表 package main import "fmt" func main() { a := [...]int{2,3,1,0,2,5,3} num := make(map ...
- 常用的MySQL命令
1.新建数据库: create database person; 2.使用数据库 use person: 3.创建一个表格 create table student ( id int(10) not ...