Linux中防火墙centos
一般的防火墙用下面这些简单的配置都能达到目的
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的更多相关文章
- Linux中防火墙命令
#启动 systemctl start firewalld #开机启动 systemctl enable firewalld #停止 systemctl stop firewalld #禁 ...
- Linux中的CentOS 7克隆之后修改
1.VMware Workstation软件查看克隆完成后的虚拟机网卡mac地址,记录下来 2.输入[cd /etc/sysconfig/network-scripts/]命令后,再执行[ip add ...
- Linux中的CentOS 6克隆之后修改
Centos6 克隆后的简单的网络配置 第一步:修改主机名 $ vi /etc/sysconfig/network 第二步: $ vi /etc/udev/rules.d/70-persis ...
- linux中的防火墙netfilter iptables
目录 一.Linux防火墙基础 1.1 ptables的表.链结构 1.2 数据包控制的匹配流程 二.编写防火墙规则 1.iptables的安装 2.1 基本语法.控制类型 一般在生产环境中设置网络型 ...
- Linux中CentOS 7版本安装JDK、Tomcat、MySQL、lezsz、maven软件详解
软件安装 在Linux系统中,安装软件的方式主要有四种,这四种安装方式的特点如下: 安装方式 特点 二进制发布包安装 软件已经针对具体平台编译打包发布,只要解压,修改配置即可 rpm安装 软件已经按照 ...
- centos linux中怎么查看和修改计算机名/etc/sysconfig/network
centos linux中怎么查看和修改计算机名 查看计算机名:在终端输入hostname 修改的话 hostname +计算机名(重启后失效)要永久修改的话要修改配置文件/etc/sysconfig ...
- Centos安装自定义布局才能自己划分各个区的大小ctrl+z ,fg ,route -n ,cat !$ ,!cat ,XShell 设置, ifconfig CentOS远程连接 Linux中的输入流 第一节课
Centos安装自定义布局才能自己划分各个区的大小ctrl+z ,fg ,route -n ,cat !$ ,!cat ,XShell 设置, ifconfig CentOS远程连接 Linux中 ...
- LINUX中IPTABLES防火墙使用
对于有公网IP的生产环境VPS,仅仅开放需要的端口,即采用ACL来控制IP和端口(Access Control List). 这里可以使用Linux防火墙netfilter的用户态工具 iptable ...
- CentOS中防火墙相关的命令(CentOS7中演示)
CentOS中防火墙程序主要是firewall和iptables,CentOS7中firewall服务已经默认安装好了,而iptables服务需要自己用yum install iptabes-se ...
随机推荐
- PDO对象
<?php //造DSN:驱动名:dbname=数据库名;host=服务器地址 $dsn = "mysql:dbname=mydb;host=localhost"; //造P ...
- ASP.NET中的Excel操作(OLEDB方式)
一:OLEDB方式操作Excel的个人理解 就是把要操作的Excel当作一个数据库,所有对Excel的操作,就变成了对“数据库”的操作.那么这时就需要有一个数据库的连接字符串. 代码如下: connS ...
- 关于oracle数据库(5)增删改查
添加.修改.删除.查询都叫SQL语言(结构化查询语言) 添加数据(注意事项:列的顺序和值的顺序要相同.数量也要相同:字符串要加单引号,数字可以加或不加) insert into 表名(列名,列名,列名 ...
- 域名、网站名、url的定义
网址:http://jingyan.baidu.com/article/2c8c281df0afd00008252aa7.html
- Linux通过XAMPP集成软件包搭建LAMPP环境
前面介绍过一篇“Linux手动搭建LAMP环境”,今天再来整理一篇“Linux通过XAMPP集成软件包搭建LAMPP环境”. 其实当初整理通过XAMPP集成软件包搭建LAMPP环境的原因是这样的: 自 ...
- JavaScript(7)——事件2.0
事件 [事件类型] 不同的事件类型具有不同的信息. [UI事件] 指的是那些不一定与用户操作有关的事件.当用户与页面上的元素交互时触发. load事件:当页面完全加载后,就会 触发window 上面的 ...
- java基础算法题
为了提高自己的代码能力和算法能力,我决定每天学习一道算法题,吸收前辈思想. [程序1] TestRabbit.java 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三 ...
- js实现url链接encode加密
function urlencode(clearString) { var output = ''; var x = 0; clearString = utf16to8(clearString.toS ...
- 用Visual Studio 2015 编写第一个UMDF驱动遇到的问题!!
前提:Visual Studio 2015已经成功安装了驱动环境,WDK都已经完全正常安装了,在Visual Studio 2015的菜单可以看到"Driver"菜单项了.这说明已 ...
- Chapter 1 First Sight——31
I took notes carefully anyway, always looking down. 不论怎么样我都仔细的记着笔记,一直低着头. I couldn't stop myself fro ...