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 ...
随机推荐
- js:如何获取select选中的值
我想获取select选中的value,或者text,或者…… 比如这个: <select id="select"> <option value=" ...
- POJ1166 The Clocks (爆搜 || 高斯消元)
总时间限制: 1000ms,内存限制: 65536kB 描述 |-------| |-------| |-------| | | | | | | | |---O | |---O | | O | | | ...
- vuex 的基本使用
工程目录 主要关注store 文件夹下的文件 store/index.js import Vue from 'vue' import Vuex from 'vuex' // import getter ...
- 【转帖】处理器史话 | 当Power架构的发展之路遭遇“滑铁卢”
处理器史话 | 当Power架构的发展之路遭遇“滑铁卢” https://www.eefocus.com/mcu-dsp/366740 (8)Power8:决定了 Power 平台的未来发展 2014 ...
- 在window10安装Mysql
一:下载 1.1下载地址:https://dev.mysql.com/downloads/mysql/ 1.2解压 D:\InstallSoftWare\MYSQL 2环境变量配置 path里添 ...
- python基础 — 文件操作
读取键盘输入 Python提供了两个内置函数从标准输入读入一行文本,默认的标准输入是键盘.如下: raw_input input raw_input函数 raw_input([prompt]) 函数从 ...
- 爬虫请求库之requests库
一.介绍 介绍:使用requests可以模拟浏览器的请求,比之前的urllib库使用更加方便 注意:requests库发送请求将网页内容下载下来之后,并不会执行js代码,这需要我们自己分析目标站点然后 ...
- 【Linux】一步一步学Linux——Linux系统常用快捷键(12) 待更新...
目录 00. 目录 01. Gnome下的快捷键 02. 其它 03. 参考 00. 目录 @ 参考博客:https://blog.csdn.net/dengjin20104042056/articl ...
- 【LEETCODE】39、第561题 Array Partition I
package y2019.Algorithm.array; /** * @ProjectName: cutter-point * @Package: y2019.Algorithm.array * ...
- SpringCloud之熔断器Hystrix及服务监控Dashboard
目的: 服务雪崩效应 服务熔断服务降级 Hystrix默认超时时间设置 Hystrix服务监控Dashboard 服务雪崩效应 雪崩效应就是一种不稳定的平衡状态也是加密算法的一种特征,它指明文 ...