关闭防火墙

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] 93. Restore IP Addresses 复原IP地址

    Given a string containing only digits, restore it by returning all possible valid IP address combina ...

  2. [LeetCode] 117. Populating Next Right Pointers in Each Node II 每个节点的右向指针 II

    Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tre ...

  3. CentOS的vsftp修改默认配置路径方法

    修改ftp的根目录只要修改/etc/vsftpd/vsftpd.conf文件即可: 加入如下几行: local_root=/var/www/htmlchroot_local_user=YESanon_ ...

  4. 8、1 周末总结+Mongdb

    都说加一个Id 注解就行了,其实还要加一条数据测试表是否生成 这里我们探讨  数据库是谁,表是谁 数据库在mongo启动的时候就指定了,这个无需我们关心 表根据实体类自动生成, 1.pom.xml & ...

  5. JavaScript有用的代码片段和trick

    浮点数取整 const x = 123.4545; x >> 0; ~~x; x | 0; Math.floor(x); 注意:前三种方法只适用于32个位整数,对于负数的处理上和Math. ...

  6. VS2015如何在同一个解决方案下建立多个项目

    1.先按照常规的方法建一个项目: 2.点击解决方案:右键=>添加=>新建项目 注:本文链接:https://blog.csdn.net/weixin_43081805/article/de ...

  7. Centos 安装mysql8

    Centos 安装mysql ,转载 https://www.cnblogs.com/funbin/p/11154784.html 1.下载mysql wget -i -c https://repo. ...

  8. 利用Matlab实现PID控制仿真

    该文转自博客园: https://www.cnblogs.com/kui-sdu/p/9048534.html %PID Controller clear, clc, close all; ts=0. ...

  9. Python中的条件判断、循环以及循环的终止

    条件判断 条件语句是用来判断给定条件是否满足,并根据判断所得结果从而决定所要执行的操作,通常的逻辑思路如下图: 单次判断 形式 if <判断条件>: <执行> else: &l ...

  10. Navicat12下载、激活工具、激活教程

    Navicat12的下载地址如下:链接: https://pan.baidu.com/s/11CHIWO74M4-P6UG0aWsF7Q 提取码: bayk 打开激活工具Navicat_Keygen_ ...