关闭防火墙

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. 【linux基础】ubuntu16.04 安装后,屏幕分辨率过低且不可调节

    前言 安装CUDA和NVIDIA驱动之后,屏幕分辨率过低且不可调节,尝试了几种方法都没成功解决,特此讲解决方法记录下来. 解决过程 注销进入登录界面,按ctrl+alt+F1进入命令行终端,输入账户名 ...

  2. JIT(just in time)即时编译器

    JIT(just in time) 前端vs后端 在编译原理中,通常将编译分为前端和后端.其中前端会对程序进行词法分析.语法分析.语义分析,然后生成一个中间表达形式(称为IR:Intermediate ...

  3. VS Code 编译C++

    1.安装VS Code 2.安装插件 在左侧插件库 必须: c/c++ 插件 非必需: C++ Intellisense Include Autocomplete 3.安装编译调试环境mingw Mi ...

  4. Tomcat免安装版执行tomcat9.exe闪退

    Tomcat免安装版点击startup.bat可成功启动,但是执行tomcat9.exe时却闪退,这是因为免安装版的tomcat不会自动把tomcat注册到windows服务里,需要手动注册. 解决办 ...

  5. 在ensp上的mstp基础配置

    为什么需要mstp? 因为stp中存在阻塞端口,阻塞后不承载流量,造成了带宽浪费 实验模拟 实验拓扑 相关参数 首先我们在交换机上创建vlan 10,20 设置端口 默认是运行mstp服务看一下

  6. [转帖]Linux教程(12)- linux输入输出重定向

    Linux教程(12)- linux输入输出重定向 2018-08-21 22:57:02 钱婷婷 阅读数 49更多 分类专栏: Linux教程与操作 Linux教程与使用   版权声明:本文为博主原 ...

  7. [CMD] 批处理

    https://www.tutorialspoint.com/batch_script/batch_script_commands.htm

  8. 【C++札记】类的继承

    继承 面向对象的设计思想,类对数据做了封装,并可以加入访问权限,类的继承是面向对象思想的精髓.类的继承可以让新类从以有的类中获得已有的特征.原有类称为基类或父类,新类称为派生类或子类. 语法: cla ...

  9. 下载安装GO,编辑器GOLand和在GOLand上运行项目的几种方式

    下载安装GO 下载GO地址:https://golang.google.cn/dl/,一直下一步下一步的操作. 安装完成之后,会有一个GOPATH(此路径是创建go项目的时候会自动在该文件夹下创建), ...

  10. 当base-package="controller.*"时,可见packageSearchPath为"classpath*:controller/*/**/*.class": 当base-package="controller.**"时,可见packageSearchPath为"classpath*:controller/**/**/*.class":

    今天在配置Spring的component-scan时,发现了一个有趣的问题.就是在指定base-package时,如果使用了星号通配符*,有时会出现类扫描不到的情况.下面研究一下这个问题. 先介绍一 ...