centos7中的使用

  

CentOS 7.0默认使用的是firewall作为防火墙

查看防火墙状态------->firewall-cmd --state

停止firewall------->systemctl stop firewalld.service

禁止firewall开机启动------>systemctl disable firewalld.service 

-------------------------------------------------------------------------
setenforce 0 表示关闭selinux防火墙
getenforce 可查看selinux的状态
2、安装并启动 iptables service,以及设置开机自启

yum -y install iptables-services;#安装iptables

systemctl start iptables;#启动iptables

systemctl enable iptables;#自启动iptables

systemctl start ip6tables;#启动ip6tables(不需要可以跳过)

systemctl enable ip6tables;#自启动ip6tables(不需要可以跳过)

3、重启 iptables service,

systemctl restart iptables.service #重启防火墙使配置生效

4、最后重启系统使设置生效即可
reboot;

1.永久有效


开启: chkconfig iptables on
关闭: chkconfig iptables off

2.即刻生效


开启: service iptables start
关闭: service iptables stop

3.开启部分端口


vim /etc/sysconfig/iptables

添加想要开启的相关端口


-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart 
 

liunx防火墙的基本操作的更多相关文章

  1. liunx 防火墙开放端口的设置

    今天在liunx 服务器上遇到一个问题,tomcat服务启动后怎么也访问不到项目,找了好久的原因,终于发现原来是liunx服务防火墙限制服务端口的访问,也就不多说了,看下面解决方法. 1.查看防火墙的 ...

  2. (转)CentOS7中防火墙的基本操作

    目录 1.firewalld简介 2.安装firewalld 3.运行.停止.禁用firewalld 4.配置firewalld 5 打开端口 学习apache安装的时候需要打开80端口,由于cent ...

  3. Linux 防火墙 iptables基本操作

    1:临时性关闭开启防火墙,重启后失效开启service iptables start关闭service iptables stop/etc/rc.d/init.d/iptables stop 2:永久 ...

  4. Linux的防火墙--IP Tables

    导读 IP Table已经集成在Linux 2.4及以上版本的内核中,同Windows下的众多“傻瓜”防火墙不同的是,IP Table需要用户自己定制相关规则.下面我就给大家简单介绍一下关于防火墙的基 ...

  5. (转)浅谈AIX下IPFilter防火墙

    1    序言 AIX操作系统发行至今,经历数个版本,功能不断增强,就安全方面IP Security也变化不少,如动作中增加了If等功能,但这次暂且讨论配置防火墙策略及防火墙的基本操作,其他高级功能待 ...

  6. Linux的防火墙–Iptables

    导读 Iptable已经集成在Linux 2.4及以上版本的内核中,同Windows下的众多“傻瓜”防火墙不同的是,Iptables需要用户自己定制相关规则.下面我就给大家简单介绍一下关于防火墙的基本 ...

  7. Centos7_防火墙的常用配置(杂记)

    Centos6和Centos7防火墙的区别 使用的工具不一样,Centos6使用的是Iptables而Centos7使用的则是Firewall Iptables,用于过滤数据包,属于网络层防火墙 Fi ...

  8. 测试面试题集锦----liunx与网络

    国庆完后就回深圳了,所以也要参加面试了,我大概收集了一些感觉可能会面试到的一些笔试题,给大家参考,答案不一定全对,分为liunx ,网络,mysql,编程题,我分别按分类补充,以后在继续补充 liun ...

  9. Centos7 iptables firewalld防火墙与selinux配置

    一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...

随机推荐

  1. mack pro常用快捷键

    fn + left / right / up / down 相当于 home/end/page up /page down delete 删除光标前一个字符 fn + delete 删除当前光标后一个 ...

  2. 【前端】CentOS 7 系列教程之三: 搭建 git 服务器

    转载请注明出处:http://www.cnblogs.com/shamoyuu/p/linux_3.html 上一篇我们安装好了git,这一篇我们搭建git服务器 创建一个用户组 groupadd g ...

  3. 虚拟机bridged, NAT and host-only网络区别

    In Linux, a network of each type is created when running vmware-config.pl. In Windows, they are auto ...

  4. centos7 编译安装新版LNMP环境

    centos7 编译安装新版LNMP环境 环境版本如下: 1.系统环境:Centos 7 x86_64 2.NGINX:nginx-1.11.3.tar.gz 3.数据库:mariadb-10.0.2 ...

  5. Java调用未被Static修饰的本类方法

    public class Dy { public static void main(String[] args){ int a=6; int b=5; int result=0; Dy dy=new ...

  6. Java:String之间通过==比较的情况

    大家都知道在String之间的内容比较的时候,是通过equals函数比较的. 但是在在许多的面试题中,总是出现一堆的判断两个String对象通过==比较的结果,实际上是考的Java内存分配机制. Ja ...

  7. UVaLive 7461 Separating Pebbles (暴力)

    题意:给出平面上的两类点,判断是否能画一条直线将两类点完全分割开来. 析:用暴力去枚举任意两点当作直线即可. 代码如下: #pragma comment(linker, "/STACK:10 ...

  8. Linux ubuntu 下寻找 texlive 缺失包 texlive 缺失包(转载)

    转自:http://blog.sina.com.cn/s/blog_87315ca60101d4d1.html 在Linux下用 latex 编译 ××.tex 文件有时候时会提示:  ! LaTeX ...

  9. shell脚本只提供整数算术运算(三种方式)—((表达式))、let "表达式"、value=`expr 表达式右边` (转载)

    转自:http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201131055455754/ 数值运算: 在bash中只提供了整数运算,一 ...

  10. 基于 Algebird 谈一谈代数数据类型在数据聚合中的应用

    此文已由作者肖乃同授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 代数数据类型是指满足一定数学特性的数据类型, 这些特性使得计算能够很方便的并行化,在Scalding和  S ...