CentOS7中执行

  1. service iptables start/stop

会报错Failed to start iptables.service: Unit iptables.service failed to load: No such file or directory.

在CentOS 7或RHEL 7或Fedora中防火墙由firewalld来管理,

如果要添加范围例外端口 如 1000-2000
语法命令如下:启用区域端口和协议组合
firewall-cmd [--zone=<zone>] --add-port=<port>[-<port>]/<protocol> [--timeout=<seconds>]
此举将启用端口和协议的组合。端口可以是一个单独的端口 <port> 或者是一个端口范围 <port>-<port> 。协议可以是 tcp 或 udp。
实际命令如下:
firewall-cmd --permanent --add-port=1000-2000/tcp
执行可以成功
用该命令查询firewall-cmd --permanent --query-port=1000/tcp

当然你可以还原传统的管理方式。

执行一下命令:

  1. systemctl stop firewalld
  2. systemctl mask firewalld

并且安装iptables-services:

  1. yum install iptables-services

设置开机启动:

  1. systemctl enable iptables
  1. systemctl stop iptables
  2. systemctl start iptables
  3. systemctl restart iptables
  4. systemctl reload iptables

保存设置:

  1. service iptables save

OK,再试一下应该就好使了

开放某个端口 在/etc/sysconfig/iptables里添加

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

解决CentOS7关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory.的更多相关文章

  1. CentOS 7.x关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory问题解决

    一直用CentOS 6.x,今天用CentOS7.3版本时,防火墙配置后执行service iptables start出现”Failed to restart iptables.service: U ...

  2. CentOS7关闭/开启防火墙出现 Unit iptables.service failed to load

    在vm中安装好tomcat,而且在liunx中使用nc命令可以返回成功,但是更换到window中访问不到tomcat的情况,是由于linux防火墙的问题造成的,传统的解决方式有2中 第一种解决方案: ...

  3. Failed to issue method call: Unit mysql.service failed to load: No such file or directory解决的方式

    Failed to issue method call: Unit mysql.service failed to load: No such file or directory解决的方式 作者:ch ...

  4. Failed to issue method call: Unit httpd.service failed to load: No such file or directory.

    centos7修改httpd.service后运行systemctl restart httpd.service提示 Failed to issue method call: Unit httpd.s ...

  5. Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  6. CentOS 7 防火墙 出现Failed to start iptables.service: Unit iptables.service failed to load

    错误信息如下: [root]# service iptables start Redirecting to /bin/systemctl start iptables.service Failed t ...

  7. 解决 RHEL 7/ CentOS 7/Fedora 出现Unit iptables.service failed to load

    一直用CentOS 6 习惯了,一下没适应过来.防火墙配置后执行service iptables save 出现”Failed to restart iptables.service: Unit ip ...

  8. Centos7 网络报错Job for iptables.service failed because the control process exited with error code.

    今天在进行项目联系的时候,启动在待机的虚拟机,发现虚拟机的网络设置又出现了问题. 我以为像往常一样重启网卡服务就能成功,但是它却报了Job for iptables.service failed be ...

  9. Failed to stop iptables.service: Unit iptables.service not loaded.解决方法

    CentOS7中执行 service iptables start/stop 会报错Failed to start iptables.service: Unit iptables.service fa ...

随机推荐

  1. Spring 源码学习(4) —— 动态AOP使用示例

    在实际工作中, 此bean可能是满足业务需要的核心逻辑, 例如test()方法中可能会封装着某个核心业务, 如果在test()方法前后加入日志来跟踪调试, 直接修改源码并不符合面向对象的设计模式, 而 ...

  2. c++数组遍历十种方式

    int ia[3][4] = {1,2,3,4,5,6,7,8}; //下标 for (int i = 0; i < 3; i++) {     for (int j = 0; j < 4 ...

  3. LightOJ 1239 - Convex Fence 凸包周长

    LINK 题意:类似POJ的宫殿围墙那道,只不过这道题数据稍微强了一点,有共线的情况 思路:求凸包周长加一个圆周长 /** @Date : 2017-07-20 15:46:44 * @FileNam ...

  4. POJ 3348 Cows 凸包 求面积

    LINK 题意:给出点集,求凸包的面积 思路:主要是求面积的考察,固定一个点顺序枚举两个点叉积求三角形面积和除2即可 /** @Date : 2017-07-19 16:07:11 * @FileNa ...

  5. 5 Techniques To Understand Machine Learning Algorithms Without the Background in Mathematics

    5 Techniques To Understand Machine Learning Algorithms Without the Background in Mathematics Where d ...

  6. PHP扩展开发--01.编写一个helloWorld扩展

    为什么要用C扩展 C是静态编译的,执行效率比PHP代码高很多.同样的运算代码,使用C来开发,性能会比PHP要提升数百倍. 另外C扩展是在进程启动时加载的,PHP代码只能操作Request生命周期的数据 ...

  7. SpringCloud入门系列(一)

    https://www.cnblogs.com/edisonchou/p/java_spring_cloud_foundation_sample_list.html

  8. 使用CSS3+JQuery打造自定义视频播放器

    简介 HTML5的<video>标签已经被目前大多数主流浏览器所支持,包括还未正式发布的IE9也声明将支持<video>标签,利用浏览器原生特性嵌入视频有很多好处,所以很多开发 ...

  9. 【SRM20】数学场

    第一题 n个m位二进制,求异或值域总和. [题解]异或值域--->使用线性基,解决去重问题. m位二进制--->拆位,每位根据01数量可以用组合数快速统计总和. #include<c ...

  10. WebStorm 2016激活

    最近在网上找到一个激活webStorm 的好东西.博主说对jetbrains下的所有产品都是可以用这种方式激活的...如:PhpStorm,IntelliJ JDEA等. 但别的产品我没有试过.对于w ...