关闭防火墙

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. Web服务器、应用程序服务器、web应用服务器、反向代理服务器

    参考链接:https://www.cnblogs.com/zhaoyl/archive/2012/10/10/2718575.html 首先我们来了解什么是服务器(server) 一般来说,serve ...

  2. Deploy != Release(第一部分):部署与发布的区别,以及为什么这很重要

    原文地址:http://ju.outofmemory.cn/entry/351873 翻译自: Deploy != Release (Part 1): The difference between d ...

  3. saltstack配置文件详解

    软件依赖 Python版本大于2.6或版本小于3.0: 对Python版本要求 msgpack-python: SalStack消息交换库 YAML: SaltStack配置解析定义语法 Jinja2 ...

  4. pip修改成国内镜像源

    临时指定镜像源 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple seaborn 永久修改镜像源 linux下,修改 ~/.pip/pip ...

  5. TCP/IP学习笔记5--网络的构成要素

    人的灵魂来自一个完美的家园,那里没有任何污秽和丑陋,只有纯净和美丽.----大鱼海棠 1.通信媒介与数据链路 计算机之间通过各种电缆相互连接. 2.网卡 任何一台计算机接入网络都需要网卡,又称网络适配 ...

  6. vue封装一个简单的div框选时间的组件

    记录一下我前段时间封装的一个vue组件吧.技术需要积累,有时间我把我之前写的还不错的组件都开源出来.并尝试vue和react 两种方式的组件封装.今天简单写下鼠标框选div选中效果的封装吧. div框 ...

  7. linux shell程序常用功能

    一.循环读取文件 循环读取文件方式有多种,推荐下列方法 while read line;do local include=$(echo ${line} | grep "filter" ...

  8. jwt 0.9.0 系列目录

    jwt官网地址:https://jwt.io/ PS: 写此系列的时候,jjwt jar包版本是0.9.0 <dependency>    <groupId>io.jsonwe ...

  9. nginx.conf指令详解

    #redis.conf # Redis configuration file example. # ./redis-server /path/to/redis.conf ############### ...

  10. [LOJ #2833]「JOISC 2018 Day 1」帐篷

    题目大意:有一个$n\times m$的网格图,若一个人的同一行或同一列有人,他就必须面向那个人,若都无人,就可以任意一个方向.若一个人无法确定方向,则方案不合法,问不同的方案数.$n,m\leqsl ...