防火墙分类:

  1. 包过滤防火墙

  2. 代理防火墙

  3. 应用网关防火墙

  4. 状态检测防火墙

内外网络隔离

截取IP包,根据安全策略控制其进/出

双向网络地址转换(NAT)

基于一次性口令对移动访问进行身份识别和控制

IPMAC捆绑,防止IP地址的滥用。


安全记录

通信事件

操作事件

违规事件

异常事件


内部专用网 、DMZ 、Internet

防火墙_standard

分支机构防火墙

防火墙_安全相关_02

双机热备(防火墙)

防火墙_Internet_03

安全公理、定理、推理

公理:所有的程序都有缺陷(摩菲定理)

大程序定律:大程序的缺陷甚至比它包含的内容还多

推理:一个安全相关程序有安全性缺陷

定理:只要不运行这个程序,那么这个程序有也无关紧要


包过滤防火墙

对于每个进来的包,适用一组规则,然后决定转发或者丢弃该包,配置成双向的

优点

实现简单

对用户透明

效率高

缺点

正确制定规则并不容易

不可能引入认证机制


访问控制列表

应用在路由器接口的指令列表

指定哪些数据包可以接收,哪一些拒绝。


ACL

  1. 限制网络流量、提高网络性能;

  2. 提供对通信流量的控制手段

  3. 提供网络访问的基本安全手段

  4. 在路由器(交换机)接口处,决定哪种类型的通信流量被转发、哪种被阻塞。

IP  standard 1-99

    extended 100-199,1300-1999,2000-2699

access-list 101 permit tcp 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255

ip access group 101 out

no ip access-list 101


在靠近源地址的网络接口上设置扩展ACL

在靠近目的地址的网络接口上设置标准ACL

show ip interface eth0/0

show access-lists


VTY访问控制示例(只能用标准访问列表)

access-list 12 permit 192.89.55.0 0.0.0.255

line vty 0 4

ip access-class 12 in


config t

host R6

no ip domain-lookup

int fa2/0

ip addr 61.0.0.100 255.255.255.0

no shut

int s1/2

ip addr 211.0.0.2 255.255.255.0

no shut

exit

router rip

version 2

network 61.0.0.0

network 211.0.0.0

end

show ip route


config t

ip access-list extended wan21lan

permit tcp any any eq 20 21 22 25 53 80 110 143 554 1755

permit tcp any any eq 7070

permit udp any any eq 20 21 22 25 53 80 110 143 554 1755

permit udp any any eq 7070

exit

end

config t

int s1/2

ip access-group wan21lan in

end

show ip access-lists


no ip access-list extended wan2lan


特殊ACL使用

int s0

ip access-group 107

access-list 107 remark allow traffic to tom's pc

access-list 107 ip any host 198.78.46.8

access-list 107 remark allow only web traffic to webserver

access-list 107 tcp any host 198.78.46.12 eq 80

access-list 107 remark block everthing else

access-list 107 deny any any


access-list 101 permit tcp any host 198.78.46.8 established

只用于TCP建立,判断TCP连接是否建立。


time-range softer 定义时间段名称为softer

periodic weekend 00:00 to 23:59 定义具体时间范围,为每周周末(六、日的0点到23:59分。当然可以使用periodic weekdays 定义工作日或跟星期几定义具体的周几)

access-list 101 deny tcp any 172.16.4.13 0.0.0.0 eq ftp time-range softer

设置ACL禁止在时间段softer范围内访问172.16.4.13的FTP服务。

access-list 101 permit ip any any

设置ACL允许其它时间段和其他条件下的正常访问。

int e1 进入E1端口。

ip access-group 101 out


用于控制blaster蠕虫的扫描和攻击

access-list 110 deny udp any any eq 1434

access-list 110 deny tcp any any eq 135

access-list 110 deny udp any any eq 135

access-list 110 deny tcp any any eq 139

access-list 110 deny udp any any eq 139

access-list 110 deny tcp any any eq 445

access-list 110 deny udp any any eq 445

access-list 110 deny tcp any any eq 593

access-list 110 deny udp any any eq 593



硬件与软件防火墙


1.注意品牌的选择

2.要有较为灵活的安全策略

3.具备高效的性能和高可靠性


中小企业:小怡数宽procon5

 网盾御天使

大 netscreen-100


3com secpath f100-A/E/S防火墙


cisco 


pix(PC架构) :501.506(小型).515.525.535(大型)(50w并发链接)


ASA 5500系统(ASIC芯片):5505 5510(小型) 5520 5540(中型) 5550 5580(大型)


ASA5550 并发65w


ASA基本配置一般包括:


配置主机名

hostname asa5550


配置域名

domian-name baidu.com



配置特权密码

enable passwrod asa5520


配置远程登录密码

passwd cisco


配置接口名字

(config-if)#nameif name


配置接口的安全级别

security-level 1-100

inside 默认安全级别为100

outside默认安全级别为0

inside<DMZ<outside


配置实例

int eth0/1

nameif inside

security-level 100

ip add 192.168.201.1 255.255.255.0

no shutdown

exit


show interface ip brief

show interface e0/0



配置路由

配置缺省路由

route interface-name network mask next-hop-address

route outside 0.0.0.0 0.0.0.0 210.10.10.1


查看路由表

show route




配置远程管理接入

telnet 192.168.201.0 255.255.255.0 inside

telnet 192.168.201.1 255.255.255.255 inside

telnet timeout 30


配置ssh接入

1.生成密钥对

crypto key generate rsa modulus 1024


2.配置防火墙允许ssh接入

ssh 192.168.201.0 255.255.255.0 inside

ssh 0 0 outside


配置空闲超时时间与版本

ssh timeout 30

ssh version 2


配置ASDM(自适应安全设备管理器功能)接入

启用防火墙HTTPS服务器功能

(config)#http server enable 62200


配置防墙允许HTTPS接入

http{network|ip-address} mask interface_name

http 0 0 outside


指定ASDM映像的位置

asdm p_w_picpath disk0:/asdmfile

asdm p_w_picpath disk0:/asdm-615.bin


配置客户端登录使用的用户名和密码

username user password password privilege 15

username zhangsan password zhangsan123 privilege 15


在客户端主机client1 上使用ASDM 下载并安装JRE

访问:https://ip:

asdm 客户端软件



为出站的流量配置网络地址转换

指定什么流量需要被转换

ASA5520(config)#nat (interface_name) nat_id local -ip mask


定义一个全局地址池

ASA5520(config)#global(interface_name) nat_id {global-ip[global-ip]|interface


本案例的配置

ASA5520(config)#nat-control

ASA5520(config)#nat(inside)1 0 0  (192.168.10.0 255.255.255.0)

ASA5520(config)#global(outside) 1 interface

ASA5520(config)#global(dmz) 1 192.168.202.100-192.168.202.110


配置ACL

access-list in_to_out extended deny ip 192.168.201.0 255.255.255.240 any

access-list in_to_out extended permit ip any any

access-group in_to_out in int inside


Static NAT(静态NAT)


static(real_interface,mapped_interface) mapped_ip real_ip


static(dmz,outside)210.10.10.253 192.168.20.1

access-list out_to_dmz extended permit tcp any host 210.10.10.253 eq www

access-group out_to_dmz in int outside


ICMP协议

access-list 111 permit icmp any any echo-reply

access-list 111 permit icmp any any unreachable

access-list 111 permit icmp any any time-exceeded

access-group 111 in int outside


保存配置

write memory 或 copy running-config startup-config

清除配置

clear configure all

清除部分配置

clear configure command[level2command]


dns server ---------------(outside)asa-firewall(inside)-----------------DMZ

                                      |

lan client


IP地址分配

外网:210.10.10.0/30

内网:192.168.201.0/24

DMZ:  192.168.202.0/24


ASA基本配置:

enable

conf t

hostname asa5220

domain-name xapc.com.cn

enable password asa

passwd cisco


config t

interface ethernet0/0

nameif outside

security-level 0

ip address 210.10.10.2.255.255.255.0

no shutdown

exit


interface eth0/1

nameif inside

security-level 100

ip address 192.168.201.1 255.255.255.0

no shutdown

exit


interface eth0/2

nameif dmz

security-level 50

ip address 192.168.202.1 255.255.255.0

no shutdown

exit


route outside 0.0.0.0 0.0.0.0 210.10.10.1

end

show route


config t

telnet 192.168.201.0 255.255.255.0 inside

telnet timeout 15


crypto key generate rsa modulus 1024

ssh 192.168.201.0 255.255.255.0 inside

ssh 0.0 outside

ssh timeout 30

ssh version 2


http sever enable 8008

http 192.168.201.0 255.255.255.0 inside

http 0 0 outside

http 0 0 inside

asdm p_w_picpath disk0:/asdm-615.bin

username xapc password xapccomcn privilege 15


access-list 111 extended permit icmp any any

access-list 111 permit ip any any 

access-group 111 in int outside

access-group 111 in int inside

access-group 111 in int dmz


access-list testacl deny ip 192.168.201.33 255.255.255.255 any

access-list testacl permit ip any any 


access-group testacl in interface inside


nat-control

nat(inside) 1 0 0

global(outside) 1 interface

global(dmz) 1 192.168.202.100-192.168.202.110


static (dmz.outside) 210.10.10.2 192.168.202.2 

access-list out_to_dmz permit tcp any host 210.10.10.2 eq 80

access-group out_to_dmz in interface outside


end

write memory

copy running-config startup-config


ASA高级扩展功能


URL地址过滤

3步骤

创建类映射class-map,识别传输流量。

access-list tcp_filter1 permit tcp 192.168.201.0 255.255.255.240 any eq www


class-map tcp_filter_class1

match access-list tcp_filter1(调用)

exit


regex url1 \.sina\.com(正则匹配)


class-map type regex match-any url_class1

match regex url1(调用)

exit


map type inspect(查看) http http_url_class1

match no request header host regex class url_class1

exit



创建策略映射policy-map,关联class-map

policy-map type inspect http http_url_policy1

class http_url_class1

drop-connetction log

exit

exit


policy-map inside_http_url_policy

class tcp_filter_class1

inspect http http_url_policy1

exit 


exit


应用策略映射policy-map到接口上

service-policy inside_http_url_policy (策略名)interface inside(接口名)



防火墙日志管理


clear config all


启用防火墙安全功能