一般的防火墙用下面这些简单的配置都能达到目的

1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
在开启了防火墙时,做如下设置,开启相关端口,
修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

但是这次我遇到的防火墙不一样,是因为CentOS版本高的问题吧。

只能用下面的的命令关闭防火墙

Centos7中的防火墙调整为firewalld,试一下systemctl stop firewalld关闭防火墙。

以下转载自:http://linux.it.net.cn/CentOS/fast/2014/1102/7635.html

新安装的centos 7 发现有些程序端口是关闭的,想到了防火墙和selinux

selinx 好关闭 /etc/sysconfig/selinux 中 追加 SELINUX=disabled

防火墙以为也是很好弄,按照以前的老规矩,service iptables stop 或者 chkconfig --level 35 iptables off

重启后 运行 systemctl list-unit-files | grep ip  发现还有个ip6tables 没关  chkconfig --level 35 ip6tables off

再运行 systemctl list-unit-files | grep ip 发现全部都disables 还是不通

没办法,只有添加规则了,tptables -I INPUT 1 -p tcp --dport 6259 -j ACCEPT

然后service iptables save  端口通了

我想这个是不是个BUG , 也许我没有找到方法,请告知

Centos7中的防火墙调整为firewalld,试一下systemctl stop firewalld关闭防火墙。
I installed CentOS 7 with minimal configuration (os + dev tools). I am trying to open 80 port for httpdservice, but something wrong with my iptables service ... what's wrong with it? What am I doing wrong?

# ifconfig/sbin/service iptables save
bash: ifconfig/sbin/service: No such file or directory # /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl. # sudo service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead) # /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl. # sudo service iptables start
Redirecting to /bin/systemctl start iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.

With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.

It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:

systemctl stop firewalld
systemctl mask firewalld

Then, install the iptables-services package:

yum install iptables-services

Enable the service at boot-time:

systemctl enable iptables

Managing the service

systemctl [stop|start|restart] iptables

Saving your firewall rules can be done as follows:

service iptables save

or

/usr/libexec/iptables/iptables.init save

Linux中防火墙centos的更多相关文章

  1. Linux中防火墙命令

    #启动   systemctl start firewalld #开机启动   systemctl enable firewalld #停止   systemctl stop firewalld #禁 ...

  2. Linux中的CentOS 7克隆之后修改

    1.VMware Workstation软件查看克隆完成后的虚拟机网卡mac地址,记录下来 2.输入[cd /etc/sysconfig/network-scripts/]命令后,再执行[ip add ...

  3. Linux中的CentOS 6克隆之后修改

    Centos6 克隆后的简单的网络配置 第一步:修改主机名 $ vi /etc/sysconfig/network     第二步: $ vi  /etc/udev/rules.d/70-persis ...

  4. linux中的防火墙netfilter iptables

    目录 一.Linux防火墙基础 1.1 ptables的表.链结构 1.2 数据包控制的匹配流程 二.编写防火墙规则 1.iptables的安装 2.1 基本语法.控制类型 一般在生产环境中设置网络型 ...

  5. Linux中CentOS 7版本安装JDK、Tomcat、MySQL、lezsz、maven软件详解

    软件安装 在Linux系统中,安装软件的方式主要有四种,这四种安装方式的特点如下: 安装方式 特点 二进制发布包安装 软件已经针对具体平台编译打包发布,只要解压,修改配置即可 rpm安装 软件已经按照 ...

  6. centos linux中怎么查看和修改计算机名/etc/sysconfig/network

    centos linux中怎么查看和修改计算机名 查看计算机名:在终端输入hostname 修改的话 hostname +计算机名(重启后失效)要永久修改的话要修改配置文件/etc/sysconfig ...

  7. Centos安装自定义布局才能自己划分各个区的大小ctrl+z ,fg ,route -n ,cat !$ ,!cat ,XShell 设置, ifconfig CentOS远程连接 Linux中的输入流 第一节课

    Centos安装自定义布局才能自己划分各个区的大小ctrl+z ,fg ,route -n ,cat !$ ,!cat ,XShell 设置, ifconfig  CentOS远程连接  Linux中 ...

  8. LINUX中IPTABLES防火墙使用

    对于有公网IP的生产环境VPS,仅仅开放需要的端口,即采用ACL来控制IP和端口(Access Control List). 这里可以使用Linux防火墙netfilter的用户态工具 iptable ...

  9. CentOS中防火墙相关的命令(CentOS7中演示)

    CentOS中防火墙程序主要是firewall和iptables,CentOS7中firewall服务已经默认安装好了,而iptables服务需要自己用yum  install  iptabes-se ...

随机推荐

  1. ASP.NETwindows身份验证详细步骤-域验证登录

    Windows身份验证相比于form身份验证要方便的多,而且会有更好的安全保障. 我个人觉得windows身份验证写法有两种: 第一种非代码方式进行windows身份验证: 第二种是用代码访问活动目录 ...

  2. python基础(三)--列表、元组、字典

    一.列表: 有序序列,支持索引.切片.循环(for,while) 元素可以被修改: 元素可以是任何数据类型(数字,字符串,列表,布尔值...),可以嵌套: ##增 1.append(object)   ...

  3. php 过滤emoji表情

    function yz_expression() { foreach ($_POST as $key => &$value) { $value = preg_replace_callba ...

  4. android 线程池的使用

    转自http://www.trinea.cn/android/java-android-thread-pool/ Java(Android)线程池 介绍new Thread的弊端及Java四种线程池的 ...

  5. Chapter 2 Open Book——10

    I sent that, and began again. 我发送了它,然后又一次重新开始写了. Mom,Everything is great. Of course it's raining. I ...

  6. WebViewJavascriptBridge详细使用

    前言 WebViewJavascriptBridge是支持到iOS6之前的版本的,用于支持native的iOS与javascript交互.如果需要支持到iOS6之前的app,使用它是很不错的.本篇讲讲 ...

  7. 模拟post请求-->测试api是否可用-->再交给ios开发

    提交给iso开发前.先模拟post提交,测试返回是否正确 =============post.php文件 ios每次最少要提交5个数据, 加密串 seqno , 请求验证码 source, 设备唯一标 ...

  8. Linq第二讲

    这一讲,来说说集合.因为linq主要用于对数据源进行查询,集合是最常见的数据源. 集合 形式: 数组,列表List<T> Arraylist等. 特点: 可通过索引或键访问.可进行fore ...

  9. 关于C++中虚函数表存放位置的思考

    其实这是我前一段时间思考过的一个问题,是在看<深入探索C++对象模型>这本书的时候我产生的一个疑问,最近在网上又看到类似的帖子,贴出来看看: 我看到了很多有意思的答案,都回答的比较好,下面 ...

  10. spring xsd

    http://ljhzzyx.blog.163.com/blog/static/3838031220132239471608/ spring配置文件报找不到xsd文件错误 2013-03-23 10: ...