在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. Java ASM介绍

    一.什么是ASM 首先看下官方中的说明 ASM a very small and fast Java bytecode manipulation framework. ASM是一个JAVA字节码分析. ...

  2. 怎样用PS对照片进行美白?

    摘录自:http://product.pconline.com.cn/itbk/software/ps/1408/5336118.html 步骤1.打开需要美白肤色的照片.本教程为防止侵犯他人肖像权, ...

  3. php中session_start()函数的作用

    php中session_start()函数的作用 用$_SESION之前必须要session_start()----其中之一的功能,$_SESSION是服务器端的cookie,相当一个大数组(浏览器关 ...

  4. eclipse怎么修改工作空间路径

    1.打开eclipse,在eclipse界面中的菜单栏中点击“文件”,如果您的eclipse是英文版,那么应该是file,打开后点击“切换工作空间" 2.如果您的eclipsehi英文版,则 ...

  5. shell实例练习+详解

    想着将Shell与Python和Java等脚本比较比较,当一有这个念头我就放弃了.这太侮辱Shell了.(哭笑脸!) 作为一个程序员,Linux那是最基本要求.而shell脚本有时候也会显示它在Lin ...

  6. 【备忘】MVC5 布署在windows2008 IIS7.5 出现的问题解决

    MVC5布署到 windows2008 IIS7.5上,发现打不开(404),估计是URL重定向有问题... 本地开发环境是,win8+vs2013,MVC5是vs2013安装好后自带的... 好像记 ...

  7. 2017-06-24(chgrp umask alias unalias)

    chgrp chgrp  组名  文件名 chgrp root newfile   将newfile的所属组修改为root umask umask 查看默认权限 0 022 文件的特殊权限 文件的默认 ...

  8. Rhel-Server 5.5 安装ORACLE10

    VMWARE + REDHAT + ORA10 先说一下环境,操作系统为Microsoft Windows Server 2003,安装的是虚拟机VMware Workstation Version ...

  9. awkOFS问题

    awk改变了OFS,$0却没变化一个文件1.txt,内容如下 a b c d e 目的把列变行,输出为: a b c d e 脚本如下: awk 'BEGIN{RS="";FS=& ...

  10. CentOS 下做端口映射/端口转发

    CentOS 下做端口映射/端口转发==[实现目标]==================[服务器A]有2块网卡,一块接内网,一块接外网,[服务器B]只有一块内网网卡:访问[服务器A]的7890端口跳转 ...