在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. sass和compass实战 读书笔记(一)

    sass优势: 不做重复的工作 一  消除样式表冗余(通过变量赋值的方式) 1. 通过变量来复用属性值 2. 使用嵌套来快速写出多层级的选择器 3. 通过混合器来复用一段样式 4. 使用选择器继承来避 ...

  2. scss 初学笔记 三 继承

    //继承 .btn{ padding: 4px 10px; font-size: 14px; } .primary{ background:red; @extend .btn; } //%placeh ...

  3. linux_NFS

    NFS是什么? 网络文件系统,又叫共享存储,通过网络连接让不同主机之间实现共享存储. 应用于存放图片.附件.视频等用户上传文件 相关同类应用:大型网站nfs有压力,使用moosefs(mfs),Ghu ...

  4. Linux指令--wc

    Linux系统中的wc(Word Count)命令的功能为统计指定文件中的字节数.字数.行数,并将统计结果显示输出. 1.命令格式: wc [选项]文件... 2.命令功能: 统计指定文件中的字节数. ...

  5. MS SQL 事物日志传送能否跨数据库版本吗?

    SQL SERVER的事物日志传送(log shipping)功能,相信很多人都使用过或正在应用,这是MS SQL提供的一个非常强大的功能,一般需要一个主数据库服务器(primary/producti ...

  6. Linux下MongoDB安装和配置详解

    1.下载安装包 将解压到/usr/local/mongodb 文件夹下 # mkdir /usr/local/mongodb # tar zxvf mongodb-linux-x86_64-3.2.9 ...

  7. 【nginx】nginx解决跨域详解

    使用场景:本地运行一个项目,但是要访问外域的api接口,存在跨域问题,解决方式有很多,但我尝试用nginx解决,搜索了网上文章后再加上尝试终于成功, 其中一些注意事项和大家分享一下. 一.window ...

  8. 【ASP.NET Core】MVC中自定义视图的查找位置

    .NET Core 的内容处处可见,刷爆全球各大社区,所以,老周相信各位大伙伴已经看得不少了,故而,老周不考虑一个个知识点地去写,那样会成为年度最大的屁话,何况官方文档也很详尽.老周主要扯一下大伙伴们 ...

  9. mysql数据库在windows下安装与配置

      mysql是一种开源源代码的关系型数据库系统(RDBMS),使用最常用的数据库管理语言--结构化查询语句(SQL)进行数据库管理. MySQL是开放源代码的,因此任何人都可以在General Pu ...

  10. fscanf和fprintf

    fscanf和fprintf fscanf的字符串是在键盘的缓冲区,fprintf是在显示器的缓冲区. 1.函数原型: int fprintf(FILE *fp, const char *format ...