思科ASA防火墙命令
- 格式:doc
- 大小:531.50 KB
- 文档页数:16
1 ASA配置命令
(config)#hostname asa802 配置主机名
(config)#domain-name 配置域名
(config)#enable password asa802 配置特权密码
(config)#passwd cisco 配置远程登录密码(TELNET,SSH)
(config-if)#nameif inside 配置接口名字
(config-if)#security-level 100 安全级别(0-100)
(config)#route 接口名 目标网段和掩码 下一跳 配置路由
#show route 查看路由表
配置TELNET接入
(config)#telnet (network|ip-address) mask interface-name
例: (config)#telnet 192.168.0.0 255.255.255.0 inside 允许192.168.0.0/24 telnet
(config)#telnet timeout minutes(1~1440分钟默认5分钟) 配置空闲超时时间
配置SSH接入
(1) 为防火墙分配一个主机名和域名,因为生成RSA密匙对需要用到主机名和域名
(2) 生成RSA密匙对(config)#crypto key generate rsa modulus (512 | 768 | 1024 | 2048)
(3) 配置防火墙允许SSH接入 (config)#ssh 192.168.0.0 255.255.255.0 inside
(config)#ssh version (1|2) SSH版本
(config)#ssh timeout 30 配置SSH超时
(config)#show ssh session 查看SSH会话
配置ASDM接入(自适应安全设备管理器)
(1) 启用防火墙HTTPS服务器功能
(config)#http server enable (port) 默认使用443端口
(2) 配置防火墙允许HTTPS接入
(config)#http {network|ip-address} mask interface-name
(3) 指定ASDM映像的位置
(config)#asdm image disk0:/asdmfile
(4) 配置客户端登录使用的用户名和密码
(config)#username user password password privilege 15
客户端使用ASDM步骤
(1)从网站下载安装jiava runtime environment (JRE),这里下载的是jre-6u10-windows-i586-p.exe
(2) 在主机PC1上启动IE浏览器 ,输入ASA的IP地址
NAT网络地址转换
(config)#nat (interface_name) id local_ip mask
(启用nat-control,可以使用nat0 指定不需要被转换的流量)
如:(config)#nat (inside)1 192.168.0.0 255.255.255.0
GLOBAL命令
(config)#global (interface-name) nat-id (global-ip 【-global-ip】)
如: (config)#global (outside) 1 200.1.1.100-200.1.1.150
(config)#global (outside)1 Internet
查看地址转换条目 show xlate
配置ACL
(config)#access-list in_to_out deny ip 192.168.0.0 255.255.255.0 any
2 应用到接口(config)#access-group in_to_out in interface inside
启用nat-control后从低安全级别访问高安全级别要配置NAT规则
Static NAT (config)#static (dmz,outside) 200.1.1.253 192.168.1.1
如要让外网的主机访问DMZ的WEB站点
(config)#static (dmz,outside) 200.1.1.253 192.168.1.1
(config)#access-list out_to_dmz permit tcp any host 200.1.1.253 eq www
(config)#access-group out_to_dmz in interface outside
ICMP协议
(config)#access-list 100 permit icmp any any echo-reply
(config)#access-list 100 permit icmp any any echo-unreachable
(config)#access-list 100 permit icmp any any time-exceeded
(config)#access-group 100 in interface outside
URL过滤
1) 配置ACL
(config)#access-list tcp_filter permit tcp 192.168.0.0 255.255.255.0 any eq www
2) 定义类关联到ACL
(config)#class-map tcp_filter_class
(config-cmap)#match access-list tcp_filter
(config-cmap)#exit
3) 正则表达式
(config)#regex url1 “\.out\.com” 定义名为url1的正则表达式URL后缀是
4) 类,关联正则表达式
(config)#class-map type regex match-any url_class
(config-camp)#match regex url1
(config-camp)#exit
5) 类检查
(config)#class-map type inspect http http_url_class
(config-camp)#match not request header host regex class url_class
(config-camp)#exit
6) 创建策略检查项
(config)#policy-map type inspect http http_url_policy
(config-pmap)#class http_url_class
(config-pmap-c)#drop-connection log drop数据包并关闭连接,并发送系统日志
(config-pmap-c)#exit
(config-pmap)#exit
7) 策略关联类
(config)#policy-map inside_http_url_policy
(config-pmap)#class tcp_filter_class
(config-pmap-c)#inspect http http_url_policy
(config-pmap-c)#exit
(config-pmap)#exit
8) 应用到接口
(config)#service-policy inside_http_url_policy interface inside
3 保存配置
#write memory
#copy running-config startup-config
清除所有配置
(config)#clear configure all
清除access-list
(config)#clear configure access-list
配置日志
Log buffer (config)#logging enable
(config)#logging buffered informational (级别)
清除 (config)#clear logging buffer
ASDM日志 (config)#logging enable
(config)#logging asdm informational
清除 (config)#clear longing asdm
配置日志服务器
(config)#logging enable
(config)#logging trap information
(config)#logging host inside 192.168.1.1
ASA基本威胁检测
(config)#threat-detection basic-threat
禁止IP分片通过
(config)#fragment chain 1
启用IDS功能
(config)#ip audit name name (info|attack) {action [alarm] [drop] [reset] }
Alarm对info和attack消息进行警告,信息会出现在syslog服务器上
Reset 丢弃数据包并关闭连接
Action定义策略采取的动作
如:(config)#ip audit name inside_ids_info info action alarm
(config)#ip audit name inside_ids_attack attack action alarm
(config)#ip audit interface inside inside_ids_info
(config)#ip audit interface inside inside_ids_info
关闭ID为2000的签名
(config)#ip audit signature 2000 disable
启用ID为2000的签名
(config)#no ip audit signature 2000 disable