关闭防火墙

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. [LeetCode] 73. Set Matrix Zeroes 矩阵赋零

    Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Exampl ...

  2. 删除Win10自动下载的更新安装包

    当我们禁止了系统的自动更新后,会感觉还有什么东西没做,没错,你还没有删除系统自动下载好的安装包,如果不删除的话会白白浪费磁盘空间!那么系统自动下载的安装包在哪里呢? C盘Windows—Softwar ...

  3. (CSDN迁移) 输入一个链表,从尾到头打印链表每个节点的值

    题目描述 输入一个链表,从尾到头打印链表每个节点的值. 思路1. 翻转链表,使用java自带的翻转函数或者从头到尾依次改变链表的节点指针 /** * public class ListNode { * ...

  4. Centos安装nodejs,并运行项目

    不建议编译安装,对gcc要求比较高 安装nodejs yum install nodejs nodejs升级 npm i -g n --force n stable npm升级 npm install ...

  5. 如何在一个文件中写多个Vue组件(译-有删改)

    原文地址 Writing multiple Vue components in a single file 在一个文件中编写多个组件是React的模式,其中一些文件包含多个组件. 走开发过程中,有些组 ...

  6. LeetCode 131. 分割回文串(Palindrome Partitioning)

    131. 分割回文串 131. Palindrome Partitioning 题目描述 给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串. 返回 s 所有可能的分割方案. LeetC ...

  7. LeetCode 13. 罗马数字转整数(Roman to Integer)

    13. 罗马数字转整数 13. Roman to Integer 题目描述 罗马数字包含以下七种字符: I,V,X,L,C,D 和 M. 字符        数值  I           1  V  ...

  8. Java开发笔记(一百一十七)AWT窗口

    前面介绍的所有Java代码,都只能通过日志观察运行情况,就算编译成class文件,也必须在命令行下面运行,这样的程序无疑只能给开发者做调试用,不能拿给一般人使用.因为普通用户早已习惯在窗口界面上操作, ...

  9. 基于Hexo搭建自己的博客主页

    搭建自己博客分为两类,一种是托管到github上的,以hexo为代表,另一种是需要自己购买服务器,主要使用wordpress框架.有不花钱的效果也很不错,就没必要自己再购买服务器了,下边主要介绍下使用 ...

  10. 40 多线程(十二)——ReentrantLock 可重入锁

    我们使用的synchronized加的锁是可以延续使用的,如下: public void test() { //第一次获得锁 synchronized(this) { while(true) { // ...