centos 7 防火墙和端口配置
--解决 RHEL 7/ CentOS 7/Fedora 出现Unit iptables.service failed to load # 第一步,关闭firewall:
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
systemctl stop firewalld.service     #停止firewall
systemctl disable firewalld.service   #禁止firewall开机启动
# 第二步,安装iptables-services:
yum install iptables-services
# 第三步,启用iptables-services:
root@vm-xiluhua ~# systemctl enable iptables   #启用
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
root@vm-xiluhua ~# service iptables status    #查看状态
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: inactive (dead)
root@vm-xiluhua ~# service iptables start     #启动
Redirecting to /bin/systemctl start iptables.service
root@vm-xiluhua ~# service iptables status
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: active (exited) since 一 -- :: CST; 8s ago
Process: ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=/SUCCESS)
Main PID: (code=exited, status=/SUCCESS) 10月 :: vm-xiluhua systemd[]: Starting IPv4 firewall with iptables...
10月 :: vm-xiluhua iptables.init[]: iptables: Applying firewall rules: [ 确定 ]
10月 :: vm-xiluhua systemd[]: Started IPv4 firewall with iptables.
# 第4步,执行iptables命令开启或关闭端口
# 开启
iptables -A INPUT -p tcp --dport 3690 -j ACCEPT;
# 关闭
iptables -A INPUT -p tcp --dport 3690 -j DROP
# 查看是否有端口3690的配置,并显示行号
iptables -L -n --line-number | grep 3690
# 按行号删除,开启或关闭
iptables -D INPUT 1 #保存规则到iptables,重启配置依然有效
root@vm-xiluhua ~# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]

CentOS 7 防火墙和端口配置的更多相关文章

  1. CentOS 7防火墙开放端口快速方法

    这篇文章主要为大家详细介绍了Centos7.1防火墙开放端口的快速方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下   例如安装Nagios后,要开放5666端口与服务器连接,命令如下: [ro ...

  2. Centos7和Centos6防火墙开放端口配置方法(避坑教学)

    ▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...

  3. centos 6 防火墙开启端口无效问题

    昨天尝试redis在centos的安装,配置文件都检查了,外网就是不能访问 #添加端口开启 $ iptables -A INPUT -p tcp --dport 6379 -j ACCEPT #保存配 ...

  4. CentOS 7 防火墙,端口开启命令

    1.  查看已打开的端口  # netstat -anp 2. 查看想开的端口是否已开 # firewall-cmd --query-port=8003/tcp   若此提示 FirewallD is ...

  5. Linux CentOS 7 防火墙与端口设置操作

    CentOS升级到7之后用firewall代替了iptables来设置Linux端口, 下面是具体的设置方法: []:选填 <>:必填 [<zone>]:作用域(block.d ...

  6. CentOS设置防火墙开放端口

    1. iptables是linux下的防火墙,同时也是服务的名称. service iptables status service iptables start service iptables st ...

  7. Linux:CentOS7防火墙 开放端口配置

    查看已开放的端口 firewall-cmd --list-ports 开放端口(开放后需要要重启防火墙才生效) firewall-cmd --zone=public --add-port=3338/t ...

  8. CentOS 7 防火墙端口配置

    CentOS 7 防火墙端口配置查看防火墙是否开启systemctl status firewalld 若没有开启则开启systemctl start firewalld 查看所有开启的端口firew ...

  9. CentOS防火墙iptables的配置方法详解

    CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...

随机推荐

  1. Eclipse设置注释模板

    设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元 ...

  2. HDU 2546

    饭卡 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  3. spring security动态管理资源结合自定义登录页面

    如果想将动态管理资源与自定义登录页面一起使用,最简单的办法就是在数据库中将登录页面对应的权限设置为IS_AUTHENTICATED_ANONYMOUSLY. 因此在数据库中添加一条资源信息. INSE ...

  4. ASM文件系统

    1.确认数据库版本 2.个人理解的存储解决方案的发展趋势 2.1图示说明 2.2图示描述 如上图我们描述了在不同时期的IT行业(数据库)出现的存储文件系统,下面我们将分别说明: ü  裸设备:所谓裸设 ...

  5. SSH框架中 Spring设置定时器 Quartz

    一,首先下载quartz-1.6.0.jar架包,到lib目录下 二,写你自己定时器业务方法 package com.lbnet.lzx.timing; import org.quartz.JobEx ...

  6. 【HDU4612】 双连通分量求桥

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4612 题目大意:给你一个无向图,问你加一条边后最少还剩下多少多少割边. 解题思路:好水的一道模板题.先 ...

  7. ss命令

    看到好的博文,所以记录一下.本文出自转载. ss是Socket Statistics的缩写.顾名思义,ss命令可以用来获取socket统计信息,它可以显示和netstat类似的内容.但ss的优势在于它 ...

  8. 运行WampServer时,提示Exception Exception in module wampmanager.exe at 000F15A0.解决办法

    出现问题:运行WampServer时,提示Exception Exception in module wampmanager.exe at 000F15A0.解决办法 出现问题原因: ①:缺少Visu ...

  9. A trip through the Graphics Pipeline 2011_06_(Triangle) rasterization and setup

    Welcome back. This time we’re actually gonna see triangles being rasterized – finally! But before we ...

  10. mvc 扩展htmlhelper

    using System.Web.Mvc; namespace System.Web.Mvc{    public static class HtmlExtend    {        public ...