URL过滤的实现一般分为以下三个步骤。
1 .建立类图,标识流量;
创建策略图并将其与类图相关联;
将policy-map应用于接口。
创建类映射以标识通信
asa(config ) # access-list 100 permit TCP 192.168.1.0255.255.255.0 anye qwww
asa(config ) # class-map 100
#创建类映射
配置图(asa ) #匹配访问列表100
在类映射中定义可接受的通信量
asa(config ) regexURL1((.kkgame(.com) )。
定义名为url1的正则表达式,表示URL扩展名为“. kkgame.com”
asa(config ) # class-maptyperegexmatch-any URL _ class 1
创建名为url_class1的class-map。 类型为regex
配置图(asa ) # match regex url1
#关键字match-any表示与某一个一致
asa(config ) # class-maptypeinspecthttphttp _ URL _ class 1
创建名为http_url_class1的class-map。 类型为inspect http (检查http通信)
asa(config-cmap ) # matchrequestheaderhostregexclassurl _ class 1
与http请求消息的host域的URL扩展名" kkgame.com "一致,
url_class1表示调用名为url_class1的class-map
创建策略-映射并将其与类-映射相关联
asa(config ) # policy-maptypeinspecthttphttp _ URL _ policy 1
创建名为http_url_policy1的policy-map和inspect http类型(检查http通信)
asa(config-pmap ) # class http_url_class1
#调用以前创建的class-map
配置映射- c (asa ) # drop-connection log
发送#drop数据包关闭连接,发送系统日志
asa(config ) # policy-map inside _ http _ URL _ policy
#创建一个名为inside_http_url_policy的policy-map以应用于接口
配置映射(asa ) # class 100
#调用以前创建的class-map
asa(config-pmap-c ) # inspect http http_url_policy1
检查http通信量
将策略映射应用于接口
asa(config ) # service-policy inside _ http _ URL _ policyinterfaceinside
将策略映射应用于inside区域
这个安排有点麻烦,所以整理了文档
access-list TCP _ filter1permit TCP 192.168.1.0255.255.255.0 anye qwww
class-map tcp_filter_class1
match access-list tcp_filter1
退出
regex url1 '.kkgame.com '
class-maptyperegexmatch-any URL _ class 1
匹配regex URL 1
退出
class-maptypeinspecthttphttp _ URL _ class 1
matchrequestheaderhostregexclassurl _ class 1
退出
policy-maptypeinspecthttphttp _ URL _ policy 1
class http_url_class1
连接日志
退出
policy-map inside _ http _ URL _ policy
class tcp_filter_class1
inspect http http_url_policy1
退出
service-policy inside _ http _ URL _ policyinterfaceinside
大体上知道就好了,稍微修改一下就可以满足自己的基本需求