关闭防火墙

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关闭防火墙、设置端口的更多相关文章

  1. Linux关闭防火墙、SELinux

    使用root权限: Linux关闭防火墙: 1. chkconfig –list|grep iptables 2. chkconfig iptables off 永久关闭防火墙 3. chkconfi ...

  2. 关于学习CentOS7使用firewalld打开关闭防火墙和端口

    1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...

  3. 转:linux关闭防火墙iptables

    ref:https://jingyan.baidu.com/article/066074d64f433ec3c21cb000.html Linux系统下面自带了防火墙iptables,iptables ...

  4. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  5. linux关闭防火墙

    查看防火墙状态: sudo service iptables status linux关闭防火墙命令: sudo service iptables stop linux启动防火墙命令: sudo se ...

  6. CentOS7使用firewalld打开关闭防火墙与端口(转)

    CentOS7使用firewalld打开关闭防火墙与端口       1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...

  7. LINUX关闭防火墙、开放特定端口等常用操作

    1. 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2. 即时生效,重启后失效: 开启:service iptables s ...

  8. Linux 基本防火墙设置和开放端口命令

    关闭防火墙 CentOS 7.RedHat 7 之前的 Linux 发行版防火墙开启和关闭( iptables ): 即时生效,重启失效 #开启 service iptables start #关闭 ...

  9. LINUX关闭防火墙(转载)

    (1) 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off (2) 即时生效,重启后失效: 开启:service iptables ...

随机推荐

  1. 【err】tensorflow.python.framework.errors_impl.OutOfRangeError: RandomShuffleQueue

    problem Traceback (most recent call last): File , in _do_call return fn(*args) File , in _run_fn opt ...

  2. [LeetCode] 324. Wiggle Sort II 摆动排序 II

    Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]... ...

  3. php_mvc实现步骤八

    shop34-10-框架类 框架类(框架初始化类) 将原来入口文件中功能,放在该类中完成,入口文件变得简单,轻量! 将入口文件中的各个功能,由框架类的各个方法,完成: 为了简单化,使用纯静态的类.(看 ...

  4. TCP/IP学习笔记15--IP分割处理与再构成处理,路径MTU发现

           家庭应该是爱.欢乐和笑的殿堂.--日 木村久一        IP属于网络层,下一层时数据链路层,在数据链路层,不同类型的数据链路的最大传输单元(MTU)都不尽相同.例如,连接两个路由器 ...

  5. docker容器中用户自定bridge网络与默认bridge网络之间的区别

    转载 https://blog.csdn.net/dkfajsldfsdfsd/article/details/79959534

  6. (idea maven)mybatis-generator步骤

    1.新建一个maven项目,选择maven-archetype-webapp 点击next 2.项目名称,点击next 3.选择项目存放路径,然后点击finish 4.在main包下 添加包java和 ...

  7. MySQL中 while loop repeat 的用法

    -- MySQL中的三中循环 while . loop .repeat 求 1-n 的和 -- 第一种 while 循环 -- 求 1-n 的和 /* while循环语法: while 条件 DO 循 ...

  8. 题解 P3957 【跳房子】

    对于这题有一个不用单调队列并且不是玄学设置区间最大值的做法 这题校内模拟考的时候打二分+枚举,结果写炸了,跑过来看题解发现为什么他们的区间最大值都是 $ 1005 $ ???特别懵,其实我的代码在dp ...

  9. python中将已有链接的视频进行下载

    使用python爬取视频网站时,会得到一系列的视频链接,比如MP4文件.得到视频文件之后需要对视频进行下载,本文写出下载视频文件的函数. 首先导入requests库,安装库使用pip install ...

  10. kubernetes 实践二:kubectl命令使用

    这里记录kubernetes学习和使用过程中的内容. CentOS7 k8s-1.13 flanneld-0.10 docker-18.06 etcd-3.3 kubectl用法概述 kubectl是 ...