在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. RAC某节点v$asm_disk查询hang分析处理

    主题:RAC某节点v$asm_disk查询hang分析处理 环境:Oracle 11.2.0.3 RAC 故障描述:RAC环境2个节点,节点1查询v$asm_disk正常返回结果,节点2查询v$asm ...

  2. Ring3句柄表的枚举

    由于windows并没有给出枚举所有句柄所用到的API,要获得句柄,我们必须使用未公开的Native API才可以,使用如下函数: NTSTATUS WINAPI NtQuerySystemInfor ...

  3. vi使用手册

    VI是unix上最常用的文本编辑工具,我自己电脑上面也装了VIM编辑器,这个据称是程序员码字神器我实在没觉得那里舒服了,所以又用回了自己的Sublime.这里整理下vi常用操作,如果以后直接在Linu ...

  4. SQL Server错误严重性级别和异常处理

    关于SQL Server的错误严重性级别的说明,强烈认真看一下下面的两个链接 脱机帮助 ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.zh-CHS/sqlerrm9/html/ ...

  5. CSS样式中常用的字体名称

    css中引入字体: @font-face { font-family: "AncientWar"; src: url('style/css/fonts/AncientWar.ttf ...

  6. java_多线程4种实现方式

    为了34月份回学校春招,不得不复习一下线程的四种实现方式,希望春招时能找到更好的公司,加油! 1.继承Thread类 class MyThread extends Thread{ private in ...

  7. Android webView包装WebAPP

    前言 Android webView 兼容体验真的差到了极点!! 前一阵子,老板要讲 WebAPP 放到 Android 和 iOS 里面,而我因为以前做过安卓,所以这方面就由我来打包, 原理是很简单 ...

  8. Ubantu搭建FTP

    1.安装并启动 FTP 服务 安装 VSFTPD 使用 apt-get 安装 vsftpd kylin@kylin:~$ sudo apt-get install vsftpd -y [sudo] p ...

  9. gulp压缩文件最简示例

    安装gulp-uglify 作为项目的开发依赖即可 $ npm gulp-uglify --save-dev 压缩js文件 gulpfile.js const gulp = require('gulp ...

  10. springboot(二十):使用spring-boot-admin对spring-boot服务进行监控

    上一篇文章<springboot(十九):使用Spring Boot Actuator监控应用>介绍了Spring Boot Actuator的使用,Spring Boot Actuato ...