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

第一种解决方案:

修改/etc/sysconfig/iptables 这个文件,增加一个8080端口

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

重启linux防火墙服务即可

/etc/init.d/iptables restart

第二种解决方案:

这种方法相当于linux端口全部开放,这样如果只是本地创建的vm只为学习使用,推荐使用这种方式,比较简单粗暴,如果是服务器运维的话,这样会降低服务器的安全性

如果是CentOs 7 以前的版本直接执行如下命名即可

service iptables stop  关闭防火墙

service iptables start  重新开启防火墙

如果你的linux是CentOS7的话启用上面的命令会报出 Unit iptables.service failed to load: No such file or directory.异常

centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可:

systemctl stop firewalld.service && systemctl disable firewalld.service

systemctl start firewalld.service && systemctl enable firewalld.service

如果想要改用iptables的话,则需要安装

yum install iptables-services

systemctl stop iptables && systemctl disable iptables
systemctl start iptables && systemctl enable iptables

这些命令结束请参考我下一篇博文(CentOS7使用firewalld打开关闭防火墙与端口)

CentOS7关闭/开启防火墙出现 Unit iptables.service failed to load的更多相关文章

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

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

  2. 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 ...

  3. 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 ...

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

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

  5. 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 ...

  6. 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 ...

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

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

  8. 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 (不写邀请码,没有现金送)国内私 ...

  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. Mybatis问题:There is no getter for property named 'unitId' in 'class java.lang.String'

    Mybatis遇到的问题 问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.re ...

  2. Python-Blog2-编写Web app 骨架

    撸代码之前让我们先来看几个概念: 什么是协程(Coroutine)? 假设现在有两个子程序,子程序A和子程序B: def A(): print('1') print('2') print('3') d ...

  3. 国家语言,语言代码,locale id对应表

    国家语言,语言代码,locale id对应表.比如 en_US对应的id为1033, 中文的locale=zh_CN,id=2052. Locale Languagecode LCIDstring L ...

  4. maven核心概念--插件和目标

    maven的核心概念有很多,我们这里先来看Plugins和Goals. 在上一篇博客中,我们用两种类型的命令行参数运行了Maven. 第一条命令,create.这是一条单个的插件目标,Archetyp ...

  5. 无废话XML--XML约束(DTD)

    基本术语     一.序言Prolog:包括XML声明(XML Declaration)和文档类型声明(Document Type Declaration).     二.良构(well-formed ...

  6. 华人开创NTP网络授时服务器成功投运世界级超大工程港珠澳大桥

    华人开创NTP网络授时服务器成功投运世界级超大工程港珠澳大桥 本文由北京华人开创公司提供请勿转载 2017年12月中旬,我华人开创生产研发的NTP网络授时服务器成功投运世界级超大工程港珠澳大桥,为这个 ...

  7. jenkins构建自由风格项目[四]

    标签(linux): jenkins 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 构建一个php项目 创建一个新的项目 选择从git获取源码 配置gitlab ...

  8. jquery +/-小样式

    <script>部分 var num = 0; $(document).on('click','#add',function(){ _this = $(this); div = _this ...

  9. 隐藏C语言黑窗口

    隐藏C语言程序运行的黑窗口,加入预编译命令: (预编译,Linker链接,windows模式,黑窗口是dos模式) #pragma comment(linker,"/subsystem:\& ...

  10. FBReader阅读引擎支持的功能

    "三十年河东,三十年河西"是一句民间谚语,它的来源是:从前黄河河道不固定,经常会改道(历史上无数次发生).某个地方原来在河的东面,若干年后,因黄河水流改道,这个地方会变为在河的西面 ...