centos6 防火墙iptables操作整理
使用语句
前言: iptables的启动文件位置再: /etc/init.d/iptables , srevice iptables调用的就是这里的执行文件
- 查看防火墙状态 service iptables status
- 开启防火墙 service iptables start
- 关闭防火墙 service iptables stop
- 永久关闭防火墙(开机不启动) chkconfig iptables off 附:chkconfig使用方法
- 永久开启防火墙(开机启动) chkconfig iptables on
- 查看防火墙状态 chkconfig --list iptables
- 等级0表示:表示关机
- 等级1表示:单用户模式
- 等级2表示:无网络连接的多用户命令行模式
- 等级3表示:有网络连接的多用户命令行模式
- 等级4表示:不可用
- 等级5表示:带图形界面的多用户模式
- 等级6表示:重新启动
- 防火墙开放某个接口 附: 详细说明文档
- 查看防火墙当前设置,具体开发的端口号信息 /etc/init.d/iptables status
- 配置防火墙策略 vi /etc/sysconfig/iptables
- 例如我要开22,80,3306端口,4500到4600的所有端口
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT -A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT -A INPUT -m state –state NEW -m tcp -p tcp –dport 4500:4600 -j ACCEPT-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT保存退出
- 重启防火墙 service iptables restart
- 例如我要开22,80,3306端口,4500到4600的所有端口
填坑笔记
- 启动防火墙时"iptables"no config file"错误 --- 未找到配置文件iptables。
- 新建一条规则 iptables -P OUTPUT ACCEPT
- 保存 service iptables save
- 再次启动防火墙 service iptables start
centos6 防火墙iptables操作整理的更多相关文章
- CentOS7防火墙firewalld 和 CentOS6防火墙iptables的一些配置命令
CentOS7 防火墙 一.防火墙的开启.关闭.禁用.查看状态命令 (1)启动防火墙:systemctl start firewalld (2)关闭防火墙:systemctl stop firewal ...
- CentOS7 防火墙firewalld 和 CentOS6 防火墙iptables 开放zabbix-agent端口的方法
我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉.最近安装zabbix ,由于公司服务器既有centos 7又有centos 6,遇到了一些防火墙的问题,现在正好把centos防 ...
- centos6和centos7的防火墙的操作
1:centos6的两种方式 1.1:service方式 查看防火墙状态: [root@centos6 ~]# service iptables status iptables:未运行防火墙. 开启防 ...
- Centos7防火墙关闭和启用iptables操作
https://yq.aliyun.com/ziliao/33590前序 还是docker惹得最近做的系统都是上的centos7的系统带来的一系列的新环境的适应 补记下:在使用oracle vmbox ...
- Linux命令(六)之防火墙iptables的相关操作以及端口的开放
.personSunflowerP { background: rgba(51, 153, 0, 0.66); border-bottom: 1px solid rgba(0, 102, 0, 1); ...
- CentOS防火墙iptables使用
1.1 企业安全优化配置原则 尽可能不给服务器配置外网ip ,可以通过代理转发或者通过防火墙映射.并发不是特别大情况有外网ip,可以开启防火墙服务高并发的情况,不能开iptables,会影响性能,利用 ...
- CentOS6.5 – Iptables配置文件
编辑防火墙配置文件: vi /etc/sysconfig/iptables 防火墙启动: service iptables restart 如果提示不存在配置文件,那就手动添加一个. 主要配置如下: ...
- [转] Linux下防火墙iptables用法规则详及其防火墙配置
from: http://www.cnblogs.com/yi-meng/p/3213925.html 备注: 排版还不错,建议看以上的链接. iptables规则 规则--顾名思义就是规矩和原则,和 ...
- Linux防火墙(Iptables)的开启与关闭
Linux防火墙(iptables)的开启与关闭 Linux中的防火墙主要是对iptables的设置和管理. 1. Linux防火墙(Iptables)重启系统生效 开启: chkconfig ipt ...
随机推荐
- mysql 与linux ~ 内存分析与调优
一 简介:linux内存和mysql二 分类 1 用户空间和内核空间 用户空间内存,从低到高分别是五种不同的内存段 1 只读段 包含代码和常量等 2 数据段 包含全局 ...
- VMware 11安装Mac和Linux
VMware 11安装Mac OS X 10.10_百度经验 https://jingyan.baidu.com/article/ff411625b9011212e48237b4.html?qq-pf ...
- SpringBoot文件上传大小设置(yml中配置)
#文件大小 MB必须大写 # maxFileSize 是单个文件大小 # maxRequestSize是设置总上传的数据大小 spring: servlet: multipart: enabled: ...
- Spring3.2+mybatis3.2+Struts2.3整合
1.Spring3.2不能用于JDK1.8,只能用于JDK1.7.JDK1.8用spring4.0. 2.导入的jar包 3.目录结构: 4.配置Spring 配置数据库信息: <?xml ve ...
- Fragment和FragmentActivity的使用方法
认识:首先我们知道Fragment是我们在单个Activity上要切换多个UI界面,显示不同内容.模块化这些UI面板以便提供给其他Acitivity使用便利.同时我们显示的Fragment也会受到当前 ...
- C++ 仿函数
先考虑一个简单的例子:假设有一个vector<string>,你的任务是统计长度小于5的string的个数,如果使用count_if函数的话,你的代码可能长成这样: 1 bool Leng ...
- zookeeper安装教程
zookeeper 一.单机安装 1.1 下载 1.2 安装 1.3 配置 1.4 启动和停止 二.伪集群模式 2.1 zookeeper1配置 2.2 zookeeper2配置 2.3 zooke ...
- Windows PowerShell 入門(5)-制御構文
Windows PowerShellにおける制御構文について学びます.数ある制御構文の中でもSwitch文は.他の言語に比べ豊富な機能が用意されています. 対象読者 Windows PowerShel ...
- css3时钟
参考资料: 奇舞团: http://www.75team.com/archives/851 DEMO:demo 截图: 代码: <!DOCTYPE html> <html lang= ...
- 前端----css的继承性和层叠性
css有两大特性; 继承性和层叠性 继承性 继承:给父级设置一些属性,子级继承了父级的该属性, 这就是我们的css中的继承, 需要注意的是 有一些属性是可以继承下来的: color , font ...