最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Centos6防火墙iptables配置
时间:2022-06-30 20:53:16 编辑:袖梨 来源:一聚教程网
配置Centos6.x系列的防火墙iptables的配置参数:
系统环境:
[root@hk service]# uname -m
x86_64
[root@hk service]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@hk service]# uname -a
Linux www.111com.net 2.6.32-042stab113.11 #1 SMP Fri Dec 18 17:32:04 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux
配置过程:
[root@hk /]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT #允许ssh管理员访问
[root@hk /]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT #允许http客户访问
[root@hk /]# iptables -A INPUT -s x.x.x.x/32 -j ACCEPT #运行X.X.X.Xip访问
[root@hk /]# iptables -A INPUT -s 10.0.0.0/24 -p all -j ACCEPT #允许内网10.0.0.0访问
[root@hk /]# iptables -A INPUT -i lo -j ACCEPT #运行本地环回接口
[root@hk /]# iptables -A OUTPUT -o lo -j ACCEPT #运行本地环回接口
[root@hk /]# iptables -P INPUT DROP #进入默认drop
[root@hk /]# iptables -P FORWARD DROP #默认drop
[root@hk /]# iptables -P OUTPUT ACCEPT @默认accept
[root@hk /]# iptables -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
[root@hk /]# iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
[root@hk /]# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@hk /]# iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@hk /]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@hk /]# iptables -L INPUT --line-numbers
[root@hk /]# iptables -D INPUT 2
相关文章
- 英雄联盟手游芮尔怎么连招-熔铁少女连招技巧 09-18
- 禁闭求生2怎么做蝴蝶长袍 蝴蝶长袍制作方法 09-18
- 地狱即我们无人机怎么升级 模块安装与技能解锁指南 09-18
- 无主之地4圣城终点区玉米卷饼在哪 圣城终点区玉米卷饼收集攻略 09-18
- 禁闭求生2蝴蝶头箍怎么做 蝴蝶头箍制作攻略 09-18
- 我的休闲时光1月优家风尚新衣服有哪些-1月优家风尚新增服饰一览 09-18