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 ...
随机推荐
- Jenkins通过完全复制快速创建新项目
- 解决Python模块报错:ModuleNotFoundError: No module name 'StringIO'
下面是我在学习中遇到的问题,给大家分享一下: ''' 这里是测试代码 '''# coding = utf-8from selenium import webdriverfrom selenium. ...
- hashMap常见问题
[解析hashMap的源码实现] 点击进入hashMap的源码实现 0.谈谈对hashMap的理解? 从底层结构.存取.扩容.冲突.实现原理.源码等方面说明. 1.你知道哪些常用的Map集合 ...
- Delphi 将视频 Base64 字符串转换为视频二进制文件
var Bytes: TBytes; Stream: TBytesStream; begin with System.NetEncoding.TBase64Encoding.Create do try ...
- python 之 Django框架(路由系统、include、命名URL和URL反向解析、命名空间模式)
12.36 Django的路由系统 基本格式: from django.conf.urls import url urlpatterns = [ url(正则表达式, views视图函数,参数,别名) ...
- Python-11-生成器
一.定义 可以理解为一种数据类型,这种数据类型自动实现了迭代器协议(其他数据类型需要调用__iter__方法),所以生成器就是一种迭代器. 二.生成器的两种形式 1. 生成器函数 使用yield代替r ...
- 百度云服务接口错误:Parameter invalid, the key input with filter parameter is not searchfilter column key
百度LBS云服务接口: 地址:http://lbsyun.baidu.com/index.php?title=lbscloud/api/geosearch 访问接口:http://api.map.ba ...
- kafka和zookeeper安装部署(版本弄不好就是坑)
yum install -y unzip zip 配置host vi /etc/host172.19.68.10 zk1 1. zookeeper zookeeper下载地址 http://mirro ...
- Hadoop 系列(五)—— Hadoop 集群环境搭建
一.集群规划 这里搭建一个 3 节点的 Hadoop 集群,其中三台主机均部署 DataNode 和 NodeManager 服务,但只有 hadoop001 上部署 NameNode 和 Resou ...
- 主机与虚拟机ping不通问题
在win10 上利用vm安装linux虚拟机,物理机与虚拟机之间不能ping通,除了检查物理机与虚拟机防火墙状态外,还要注意物理机设置的ip与虚拟机设置的ip,要在同一个ip段