在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. linux ubuntu 远程ssh登录

    当我们有一个Linux系统的时候,可能用到远程ssh登录,当你是没有界面的系统的时候也会用到,远程操作起来比较方便. 首先我们的电脑默认是不安装ssh的,就是无法通过ssh远程连接,所以要安装shh. ...

  2. 底部粘连(stiky footer)布局

    前面的话 在网页设计中,Sticky footers设计是最古老和最常见的效果之一,大多数人都曾经经历过.它可以概括如下:如果页面内容不够长的时候,页脚块粘贴在视窗底部:如果内容足够长时,页脚块会被内 ...

  3. linux mysql 忽略大小写

    修改/etc/my.cnf 2)在[mysqld]下加入一行:lower_case_table_names=1 3)重新启动数据库即可.

  4. JS正则表达式的基础用法

    RegExp(正则表达式)对象 正则表达式是一个描述字符模式的对象,可以处理更复杂的字符串.进行匹配替换. 常用的修饰符: i/m/g 使用方法: [声明方法一: new RegExp(value)] ...

  5. Ceph,TFS,FastDFS,MogileFS,MooseFS,GlusterFS 对比

    系统整体对比 对比说明 /文件系统 TFS FastDFS MogileFS MooseFS GlusterFS Ceph 开发语言 C++ C Perl C C C++ 开源协议 GPL V2 GP ...

  6. Linux 修改环境变量报错

    报错如下: -bash: export: `=': not a valid identifier -bash: export: `/usr/local/sbin:/usr/local/bin:/sbi ...

  7. 我的运维之旅-查找文本的linux命令

    小伙伴们肯定都遇到这么尴尬场景,线上服务出问题了,老大一直在问什么问题导致的,而你由于对查找文本的命令不太熟,鼓捣了半天才找到那条 异常日志,而这时可能半个小时都已经过去了.老大可能对你失望透顶了.讲 ...

  8. ssh密钥分发与ansible

    笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 当我们公司的服务器达到几十台或几百台或更高的时候,利用批量管理工具管理系统是我们要做的 常用的批量管理工具有ans ...

  9. 已知有两个水杯,一个11L一个7L,水可以任意使用,求怎么得到2L 的详细解法

    问题:有两个水杯,一个是11L一个是7L,水可以随便用,怎么得到2L 1.了解问题的本质 问题中给出了两个杯子,只有这两个杯子有量度,所以只能让杯中的水满进满出才能确定杯子中最后有多少水. 现在问题要 ...

  10. mongodb- Java API 查询操作

    package com.x.mongodb; import java.net.UnknownHostException;import java.util.Collection;import java. ...