思科ASA防火墙命令

ASA配置命令

(config)#hostname asa802 配置主机名 (config)#domain-name asadomain.com 配置域名 (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)从网站www.sun.com下载安装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

应用到接口(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后缀是.out.com 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

保存配置

#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

IPSec VPN

ISAKMP/IKE阶段1的配置命令 建立ISAKMP管理连接策略

Router(config))#crypto isakmp policy {1-10000} 指定管理连接建立的最后两个数据报文采用何种加密方式 Router (config-isakmp)#crypto {des | 3des | aea} HASH命令指定验证过程采用HMAC的功能 Router (config-isakmp)#hash {sha|md5} 指定设备身份验证的方式

Router (config-isakmp)#euthentication {pre-share | rea-encr | rsa-sig} 指定DH密匙组,默认使用DH1 Router (config-isakmp)#group {1 | 2 | 5}

指定管理连接的生存周期,默认为86400s(24小时) (Router config-isakmp)#lifetime seconds 查看上述配置

#show crypto isakmp policy 配置预共享密钥

Router(config))#crypto isakmp key {0 | 6} keystring address peer-address {subnet_mask} 0表示密钥为明文,6表示密钥被加密

Peer-address表示对端与之共享密钥的对等体设备地址

显示密钥是明文还是密文 #Show crypto isakmp key 加密预共享密钥

Router(config))#key config-key password-encrypt

New key: (最少为8为字母) Confirm key: Router(config))#password encryption aes 使用show run可以看到加密后的效果 ISAKMP/IKE阶段2的配置命令

(1) 配置crypto ACL (通常两端对端设备上的crypto ACL互为镜像) Router(config))#access-list access-list-number { deny | permit } protocol source source-wildcard destination destination-wildcard (2) 配置阶段2的传输集

Router(config))#crypto ipsec transform-set transform_set_name transform1[transform2 [transform3]

Router (cfg-crypto-tran)#mode { tunnel | transport }

查看路由器上的传输集,show crypto ipsec transform-set 清除连接的生存周期

Clear crypto sa 或 clear crypto ipsec sa

(3) 配置crypto map

Router(config))# crypto map map_name seq_num ipsec-isakmp Map-name:crypto map的名称

Seq_num:crypto map的序列号,其范围是1-65535,数值越小,优先级越高 调用crypto ACL的名字或编号

Router(config)-crypto-m)# match address ACL_name_or_num 指定IPsec的对等体设备,即配置的设备应该与谁建立连接 Router(config)-crypto-m)# set peer { hostname | IP_address } 指定传输集的名称,这里最多可以列出6个传输集的名称 Router(config)-crypto-m)# set transform-set transform_set_name1

PFS(perfect forward secrecy)完美转发保密,保证两个阶段中的密钥只能使用一次 启用PFS并指定使用哪个DH密钥组(可选命令)

Router(config)-crypto-m)# set pfs [ group1 | group2 | group5 ]

指定SA的生存周期,默认数据连接的生存周期为3600s或4608000KB

Router(config)-crypto-m)#set security-association lifetime {seconds seconds | kilobytes kilobytes} 设定空闲超时计时器,范围60~86400s (默认关闭)

Router(config)-crypto-m)# set security-association idle-time seconds 查看管理连接所处的状态 show crypto isakmp policy show crypto isakmp sa

show crypto ipsec transform-set

show crypto ipsec security-association lifetime show crypto ipsec sa show crypto map

在ASA上配置实现IPSec VPN

分公司网关ASA1的配置

基本配置

ASA1(config)#route outside 0 0 100.0.0.2 ASA1(config)#nat-control

ASA1(config)#nat (inside) 1 0 0

ASA1(config)#global (outside) 1 int

配置NAT豁免

ASA1(config)#access-list nonat extended permit ip 172.16.10.0 255.255.255.0 10.10.33.0 255.255.255.0

ASA1(config)#nat (inside) 0 access-list nonat

启用ISAKMP

ASA1(config)#crypto isakmp enable outside

配置ISAKMP策略

ASA1(config)#crypto isakmp policy 1

ASA1(config-isakmp-policy)#encryption aes ASA1(config-isakmp-policy)#hash sha

ASA1(config-isakmp-policy)#authentication pre-share ASA1(config-isakmp-policy)#group 1

配置预共享密钥

ASA1(config)#isakmp key benet address 200.0.0.1 ASA从7.0版本开始一般使用隧道组来配置 ASA1(config)#tunnel-group 200.0.0.1 type ipsec-l2l ASA1(config)#tunnel-group 200.0.0.1 ipsec-attributes

ASA1(config-ipsec)#pre-shared-key benet

配置crypto ACL

ASA1(config)#access-list yfvpn extended permit ip 172.16.10.0 255.255.255.0 10.10.33.0 255.255.255.0

配置数据连接的传输集

ASA1(config)#crypto ipsec transform-set benet-set esp-aes esp-sha-hmac

配置crypto map并应用到outside接口上

ASA1(config)#crypto map benet-map 1 match address yfvpn ASA1(config)#crypto map benet-map 1 set peer 200.0.0.1

ASA1(config)#crypto map benet-map 1 set transform-set benet-set ASA1(config)#crypto map benet-map interface outside

接口安全级别对于IPSec流量的影响

流量无法通过具有相同安全级别的两个不同的接口

流量无法从同一接口进入后再流出

ASA(config)#same-security-traffic permit {intra-interface | inter-interface}

路由器实现NAT-T

Router(config)#ip nat inside source list access-list-number interface f0/1 overload Router(config)#ip nat inside source static udp local-ip 500 interface f0/1 500 Router(config)#ip nat inside source static udp local-ip 4500 interface f0/1 4500

debug crypto isakmp

初始状态

阶段1策略协商

生成随机数(用于验证) 身份验证

阶段1连接建立 阶段2参数协商

创建数据连接的SA

debug crypto ipsec

协商阶段2的传输集 匹配crypto ACL SA建立 协商完成

show crypto isakmp sa

路由器搭建Easy VPN服务器

定义AAA

R1(config)#aaa new-model

R1(config)#aaa authentication login vpn_authen local R1(config)#aaa authorization network vpn_author local R1(config)#username cisco password cisco

定义阶段1的SA参数 R1(config)#crypto isakmp policy 10 R1(config-isakmp)#encryption aes 128 R1(config-isakmp)#hash sha

R1(config-isakmp)#authentication pre-share R1(config-isakmp)#group 2 R1(config-isakmp)#exit

定义IP地址池

R1(config)#ip local pool vpn_pool 192.168.1.1 192.168.1.200

定义ACL用于分离隧道

R1(config)#access-list 101 permit ip 10.10.1.0 0.0.0.255 any

定义Easy VPN组及参数

R1(config)#crypto isakmp client configuration group vpn_group R1(config-isakmp-group)#key groupkey R1(config-isakmp-group)#pool vpn_pool R1(config-isakmp-group)#acl 101 R1(config-isakmp-group)#exit

定义传输集

R1(config)#crypto ipsec transform-set vpn_transform esp-aes esp-sha-hmac

定义动态的Crypto Map条目

R1(config)#crypto dynamic-map vpn_dymap 10

R1(config-crypto-map)#set transform-set vpn_transform

定义静态的Crypto Map条目和XAUTH

R1(config)#crypto map mymap client authentication list vpn_authen R1(config)#crypto map mymap isakmp authorization list vpn_author R1(config)#crypto map mymap client configuration address respond R1(config)#crypto map mymap 1000 ipsec-isakmp dynamic vpn_dymap

将Crypto Map应用到接口 R1(config)#int S1/0

R1(config-if)#crypto map mymap

路由器与硬件客户端之间的配置

Easy VPN硬件客户端R2的配置

建立Easy VPN远端配置

R2(config)#crypto ipsec client ezvpn myeasyvpn R2(config-crypto-ezvpn)#connect auto

R2(config-crypto-ezvpn)#group vpn_group key groupkey R2(config-crypto-ezvpn)#mode network-extension R2(config-crypto-ezvpn)#peer 200.1.1.1

R2(config-crypto-ezvpn)#username cisco password cisco R2(config)#int f0/0

R2(config-if)#crypto ipsec client ezvpn myeasyvpn inside R2(config-if)#int s1/1

R2(config-if)#crypto ipsec client ezvpn myeasyvpn outside R2(config-if)#End

crypto isakmp client ezvpn xauth

配置服务器端允许硬件客户端存储XAUTH认证信息

R1(config)#crypto isakmp client configuration group vpn_group

R1(config-isakmp-group)#save-password

配置路由器R2对VPN流量不做NAT转换

R2(config)#no access-list 1 permit 10.20.1.0 0.0.0.255

R2(config)#no ip nat inside source list 1 interface Serial1/1 overload

R2(config)# access-list 110 deny ip 10.20.1.0 0.0.0.255 10.10.1.0 0.0.0.255 R2(config)# access-list 110 permit ip any any

R2(config)#ip nat inside source list 110 interface Serial1/1 overload

使用命令R2#sh crypto ipsec client ezvpn检验Easy VPN的配置

Easy VPN基于ASA的配置

定义XAUTH(用户)验证

asa802(config)#username cisco password cisco

定义阶段1的SA参数

asa802(config)#crypto isakmp enable outside asa802(config)#crypto isakmp policy 10

asa802(config-isakmp-policy)#encryption aes asa802(config-isakmp-policy)#hash sha

asa802(config-isakmp-policy)#authentication pre-share asa802(config-isakmp-policy)#group 2 asa802(config-isakmp-policy)#exit

定义IP地址池

asa802(config)#ip local pool vpn_pool 192.168.1.1-192.168.1.200

定义ACL用于分离隧道

asa802(config)# access-list split_tunnel permit ip 10.10.1.0 255.255.255.0 any

定义组策略

asa802(config)# group-policy vpn_group_policy internal

asa802(config)# group-policy vpn_group_policy attributes

asa802(config-group-policy)# split-tunnel-policy tunnelspecified

asa802(config-group-policy)# split-tunnel-network-list value split_tunnel

asa802(config-group-policy)# exit

建立隧道组

asa802(config)# tunnel-group vpn_group type ipsec-ra

asa802(config)# tunnel-group vpn_group general-attributes

asa802(config-tunnel-general)# address-pool vpn_pool

asa802(config-tunnel-general)# default-group-policy vpn_group_policy

asa802(config-tunnel-general)# exit

asa802(config)# tunnel-group vpn_group ipsec-attributes

asa802(config-tunnel-ipsec)# pre-shared-key groupkey

asa802(config-tunnel-ipsec)# exit

定义传输集

asa802(config)#crypto ipsec transform-set vpn_transform esp-aes esp-sha-hmac

定义动态的Crypto Map条目

asa802(config)#crypto dynamic-map vpn_dymap 10 set transform-set vpn_transform

定义静态的Crypto Map条目

asa802(config)#crypto map mymap 1000 ipsec-isakmp dynamic vpn_dymap

将Crypto Map应用到接口

asa802(config)# crypto map mymap interface outside

SSL VPN基于ASA的配置

定义XAUTH(用户)验证

asa802(config)#username cisco password cisco

在outside口启用WebVPN和SSLVPN

asa802(config)#webvpn

asa802(config-webvpn)#enable outside

asa802(config-webvpn)#svc image disk0:/sslclient-win-1.1.3.173.pkg

asa802(config-webvpn)#svc enable

asa802(config-webvpn)#exit

定义IP地址池

asa802(config)#ip local pool vpn_pool 192.168.1.1-192.168.1.200

定义ACL用于分离隧道

asa802(config)# access-list split_tunnel permit ip 10.10.1.0 255.255.255.0 any

定义组策略

asa802(config)# group-policy vpn_group_policy internal

asa802(config)# group-policy vpn_group_policy attributes

asa802(config-group-policy)#vpn-tunnel-protocol webvpn svc

asa802(config-group-policy)# split-tunnel-policy tunnelspecified

asa802(config-group-policy)# split-tunnel-network-list value split_tunnel

asa802(config-group-policy)#webvpn

asa802(config-group-webvpn)#svc ask enable

asa802(config-group-webvpn)#exit

asa802(config-group-policy)# exit

建立隧道组

asa802(config)# tunnel-group vpn_group type webvpn

asa802(config)# tunnel-group vpn_group general-attributes

asa802(config-tunnel-general)# address-pool vpn_pool

asa802(config-tunnel-general)# default-group-policy vpn_group_policy

asa802(config-tunnel-general)# exit

asa802(config)# tunnel-group vpn_group webvpn-attributes

asa802(config-tunnel-webvpn)#group-alias groups enable

asa802(config-tunnel-webvpn)#exit

asa802(config)#webvpn

asa802(config-webvpn)#tunnel-group-list enable

asa802(config-webvpn)#exit

SSL VPN基于IOS路由器的配置

安装SVC软件

R1(config)#webvpn install svc flash:/sslclient-win-1.1.3.173.pkg

定义AAA,创建SSL VPN用户

R1(config)#aaa new-model

R1(config)#aaa authentication login vpn_authen local

R1(config)#username cisco password cisco

启用WebVPN,产生自签名证书

R1(config)#webvpn gateway vpn_gateway

R1(config-webvpn-gateway)#ip address 200.1.1.1 port 443

R1(config-webvpn-gateway)#inservice

R1(config-webvpn-gateway)#exit

定义IP地址池

R1(config)#ip local pool vpn_pool 192.168.1.1 192.168.1.200

R1(config)#int lo0

R1(config-if)#ip address 192.168.1.254 255.255.255.0

R1(config-if)#exit

建立WebVPN环境

R1(config)#webvpn context vpn_context

R1(config-webvpn-context)#gateway vpn_gateway domain group1

R1(config-webvpn-context)#aaa authentication list vpn_authen

R1(config-webvpn-context)#inservice

R1(config-webvpn-context)#exit

定义组策略

R1(config)#webvpn context vpn_context

R1(config-webvpn-context)#policy group vpn_group_policy

R1(config-webvpn-group)#functions svc-enabled

R1(config-webvpn-group)#svc address-pool vpn_pool

R1(config-webvpn-group)#svc split include 10.10.1.0 255.255.255.0

R1(config-webvpn-group)#exit

R1(config-webvpn-context)#default-group-policy vpn_group_policy

R1(config-webvpn-context)#exit

SSL VPN客户端的配置

输入 https://200.1.1.1/group1

自动安装客户端软件

安装证书

测试

通过show webvpn session context all查看会话信息

搭建RADIUS服务器

安装Cisco ACS软件

设置ACS管理员账号

配置RADIUS服务器,添加AAA客户端SW2

添加用户

配置用户组RADIUS属性

在交换机上配置802.1x认证

配置AAA

SW2(config)#aaa new-model

SW2(config)#radius-server host 10.0.0.203 auth-port 1812 acct-port 1813 key cisco

认证、统计端口和共享密钥必须与服务器配置相同

配置802.1x认证

SW2(config)#aaa authentication dot1x default group radius

配置802.1x授权

SW2(config)#radius-server vsa send authentication

SW2(config)# aaa authorization network default group radius

服务器要动态分配VLAN需要使用VSA属性

启用802.1x

SW2(config)# dot1x system-auth-control

SW2(config)#interface fastethernet 0/2

SW2(config-if)#switchport mode access

SW2(config-if)#dot1x port-control auto

命令dot1x port-control有3个参数

☐ force-authorized:端口始终处于授权状态(端口默认状态)

☐ force-unauthorized:端口始终处于非授权状态

☐ auto:根据认证结果决定端口的授权或非授权状态

查看802.1x的相关配置

SW2#show dot1x all

Sysauthcontrol Enabled

Dot1x Protocol Version 2

Critical Recovery Delay 100

Critical EAPOL Disabled

Dot1x Info for FastEthernet0/2

-----------------------------------

PAE = AUTHENTICATOR

PortControl = AUTO

ControlDirection = Both

HostMode = SINGLE_HOST

ReAuthentication = Disabled

QuietPeriod = 60

ServerTimeout = 30

…省略…

802.1x常见故障排查

一般处理流程

判断是单点故障,还是全局故障

☐ 个别故障,一般情况下认证服务器应该工作正常

– 检查用户名和密码

– 检查交换机端口配置等

☐ 全局故障,一般情况是认证服务器出现故障

– 检查服务器网络连通是否正常

– 检查服务器是否死机

– 检查服务器配置是否有变动

– 检查DHCP地址池是否用完

– 检查服务器认证端口是否访问正常

根据不同的现象逐步排查

ASA穿越代理的配置

定义触发认证的流量

ASA(config)# access-list http extended permit tcp any 192.168.100.0 255.255.255.0 eq 80

配置AAA服务器

ASA(config)# aaa-server server_group protocol { RADIUS | TACACS+ }

ASA(config)# aaa-server server_group (interface_name) host server_ipaddress

ASA(config-aaa-server-host)# key keyword

ASA(config-aaa-server-host)# authentication-port port

ASA(config-aaa-server-host)# accounting-port port

AAA认证配置

ASA(config)# aaa authentication match acl_name

AAA认证配置实例

ASA(config)# aaa authentication match http inside acs

AAA授权配置

ASA(config)# aaa authorization match acl_name interface_name server_group

配置AAA认证超时时间

ASA(config)# timeout uauth 0:05:00 absolute

ASA(config)# timeout uauth 0:05:00 inactivity

本地ACL在端口应用配置

ASA(config)#access-group acl_name in interface inside [per-user-override]

配置per-user-override参数

☐ 只有动态下发的ACL有效

不配置per-user-override参数

☐ 本地ACL和动态下发的ACL同时有效

ASA配置命令

(config)#hostname asa802 配置主机名 (config)#domain-name asadomain.com 配置域名 (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)从网站www.sun.com下载安装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

应用到接口(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后缀是.out.com 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

保存配置

#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

IPSec VPN

ISAKMP/IKE阶段1的配置命令 建立ISAKMP管理连接策略

Router(config))#crypto isakmp policy {1-10000} 指定管理连接建立的最后两个数据报文采用何种加密方式 Router (config-isakmp)#crypto {des | 3des | aea} HASH命令指定验证过程采用HMAC的功能 Router (config-isakmp)#hash {sha|md5} 指定设备身份验证的方式

Router (config-isakmp)#euthentication {pre-share | rea-encr | rsa-sig} 指定DH密匙组,默认使用DH1 Router (config-isakmp)#group {1 | 2 | 5}

指定管理连接的生存周期,默认为86400s(24小时) (Router config-isakmp)#lifetime seconds 查看上述配置

#show crypto isakmp policy 配置预共享密钥

Router(config))#crypto isakmp key {0 | 6} keystring address peer-address {subnet_mask} 0表示密钥为明文,6表示密钥被加密

Peer-address表示对端与之共享密钥的对等体设备地址

显示密钥是明文还是密文 #Show crypto isakmp key 加密预共享密钥

Router(config))#key config-key password-encrypt

New key: (最少为8为字母) Confirm key: Router(config))#password encryption aes 使用show run可以看到加密后的效果 ISAKMP/IKE阶段2的配置命令

(1) 配置crypto ACL (通常两端对端设备上的crypto ACL互为镜像) Router(config))#access-list access-list-number { deny | permit } protocol source source-wildcard destination destination-wildcard (2) 配置阶段2的传输集

Router(config))#crypto ipsec transform-set transform_set_name transform1[transform2 [transform3]

Router (cfg-crypto-tran)#mode { tunnel | transport }

查看路由器上的传输集,show crypto ipsec transform-set 清除连接的生存周期

Clear crypto sa 或 clear crypto ipsec sa

(3) 配置crypto map

Router(config))# crypto map map_name seq_num ipsec-isakmp Map-name:crypto map的名称

Seq_num:crypto map的序列号,其范围是1-65535,数值越小,优先级越高 调用crypto ACL的名字或编号

Router(config)-crypto-m)# match address ACL_name_or_num 指定IPsec的对等体设备,即配置的设备应该与谁建立连接 Router(config)-crypto-m)# set peer { hostname | IP_address } 指定传输集的名称,这里最多可以列出6个传输集的名称 Router(config)-crypto-m)# set transform-set transform_set_name1

PFS(perfect forward secrecy)完美转发保密,保证两个阶段中的密钥只能使用一次 启用PFS并指定使用哪个DH密钥组(可选命令)

Router(config)-crypto-m)# set pfs [ group1 | group2 | group5 ]

指定SA的生存周期,默认数据连接的生存周期为3600s或4608000KB

Router(config)-crypto-m)#set security-association lifetime {seconds seconds | kilobytes kilobytes} 设定空闲超时计时器,范围60~86400s (默认关闭)

Router(config)-crypto-m)# set security-association idle-time seconds 查看管理连接所处的状态 show crypto isakmp policy show crypto isakmp sa

show crypto ipsec transform-set

show crypto ipsec security-association lifetime show crypto ipsec sa show crypto map

在ASA上配置实现IPSec VPN

分公司网关ASA1的配置

基本配置

ASA1(config)#route outside 0 0 100.0.0.2 ASA1(config)#nat-control

ASA1(config)#nat (inside) 1 0 0

ASA1(config)#global (outside) 1 int

配置NAT豁免

ASA1(config)#access-list nonat extended permit ip 172.16.10.0 255.255.255.0 10.10.33.0 255.255.255.0

ASA1(config)#nat (inside) 0 access-list nonat

启用ISAKMP

ASA1(config)#crypto isakmp enable outside

配置ISAKMP策略

ASA1(config)#crypto isakmp policy 1

ASA1(config-isakmp-policy)#encryption aes ASA1(config-isakmp-policy)#hash sha

ASA1(config-isakmp-policy)#authentication pre-share ASA1(config-isakmp-policy)#group 1

配置预共享密钥

ASA1(config)#isakmp key benet address 200.0.0.1 ASA从7.0版本开始一般使用隧道组来配置 ASA1(config)#tunnel-group 200.0.0.1 type ipsec-l2l ASA1(config)#tunnel-group 200.0.0.1 ipsec-attributes

ASA1(config-ipsec)#pre-shared-key benet

配置crypto ACL

ASA1(config)#access-list yfvpn extended permit ip 172.16.10.0 255.255.255.0 10.10.33.0 255.255.255.0

配置数据连接的传输集

ASA1(config)#crypto ipsec transform-set benet-set esp-aes esp-sha-hmac

配置crypto map并应用到outside接口上

ASA1(config)#crypto map benet-map 1 match address yfvpn ASA1(config)#crypto map benet-map 1 set peer 200.0.0.1

ASA1(config)#crypto map benet-map 1 set transform-set benet-set ASA1(config)#crypto map benet-map interface outside

接口安全级别对于IPSec流量的影响

流量无法通过具有相同安全级别的两个不同的接口

流量无法从同一接口进入后再流出

ASA(config)#same-security-traffic permit {intra-interface | inter-interface}

路由器实现NAT-T

Router(config)#ip nat inside source list access-list-number interface f0/1 overload Router(config)#ip nat inside source static udp local-ip 500 interface f0/1 500 Router(config)#ip nat inside source static udp local-ip 4500 interface f0/1 4500

debug crypto isakmp

初始状态

阶段1策略协商

生成随机数(用于验证) 身份验证

阶段1连接建立 阶段2参数协商

创建数据连接的SA

debug crypto ipsec

协商阶段2的传输集 匹配crypto ACL SA建立 协商完成

show crypto isakmp sa

路由器搭建Easy VPN服务器

定义AAA

R1(config)#aaa new-model

R1(config)#aaa authentication login vpn_authen local R1(config)#aaa authorization network vpn_author local R1(config)#username cisco password cisco

定义阶段1的SA参数 R1(config)#crypto isakmp policy 10 R1(config-isakmp)#encryption aes 128 R1(config-isakmp)#hash sha

R1(config-isakmp)#authentication pre-share R1(config-isakmp)#group 2 R1(config-isakmp)#exit

定义IP地址池

R1(config)#ip local pool vpn_pool 192.168.1.1 192.168.1.200

定义ACL用于分离隧道

R1(config)#access-list 101 permit ip 10.10.1.0 0.0.0.255 any

定义Easy VPN组及参数

R1(config)#crypto isakmp client configuration group vpn_group R1(config-isakmp-group)#key groupkey R1(config-isakmp-group)#pool vpn_pool R1(config-isakmp-group)#acl 101 R1(config-isakmp-group)#exit

定义传输集

R1(config)#crypto ipsec transform-set vpn_transform esp-aes esp-sha-hmac

定义动态的Crypto Map条目

R1(config)#crypto dynamic-map vpn_dymap 10

R1(config-crypto-map)#set transform-set vpn_transform

定义静态的Crypto Map条目和XAUTH

R1(config)#crypto map mymap client authentication list vpn_authen R1(config)#crypto map mymap isakmp authorization list vpn_author R1(config)#crypto map mymap client configuration address respond R1(config)#crypto map mymap 1000 ipsec-isakmp dynamic vpn_dymap

将Crypto Map应用到接口 R1(config)#int S1/0

R1(config-if)#crypto map mymap

路由器与硬件客户端之间的配置

Easy VPN硬件客户端R2的配置

建立Easy VPN远端配置

R2(config)#crypto ipsec client ezvpn myeasyvpn R2(config-crypto-ezvpn)#connect auto

R2(config-crypto-ezvpn)#group vpn_group key groupkey R2(config-crypto-ezvpn)#mode network-extension R2(config-crypto-ezvpn)#peer 200.1.1.1

R2(config-crypto-ezvpn)#username cisco password cisco R2(config)#int f0/0

R2(config-if)#crypto ipsec client ezvpn myeasyvpn inside R2(config-if)#int s1/1

R2(config-if)#crypto ipsec client ezvpn myeasyvpn outside R2(config-if)#End

crypto isakmp client ezvpn xauth

配置服务器端允许硬件客户端存储XAUTH认证信息

R1(config)#crypto isakmp client configuration group vpn_group

R1(config-isakmp-group)#save-password

配置路由器R2对VPN流量不做NAT转换

R2(config)#no access-list 1 permit 10.20.1.0 0.0.0.255

R2(config)#no ip nat inside source list 1 interface Serial1/1 overload

R2(config)# access-list 110 deny ip 10.20.1.0 0.0.0.255 10.10.1.0 0.0.0.255 R2(config)# access-list 110 permit ip any any

R2(config)#ip nat inside source list 110 interface Serial1/1 overload

使用命令R2#sh crypto ipsec client ezvpn检验Easy VPN的配置

Easy VPN基于ASA的配置

定义XAUTH(用户)验证

asa802(config)#username cisco password cisco

定义阶段1的SA参数

asa802(config)#crypto isakmp enable outside asa802(config)#crypto isakmp policy 10

asa802(config-isakmp-policy)#encryption aes asa802(config-isakmp-policy)#hash sha

asa802(config-isakmp-policy)#authentication pre-share asa802(config-isakmp-policy)#group 2 asa802(config-isakmp-policy)#exit

定义IP地址池

asa802(config)#ip local pool vpn_pool 192.168.1.1-192.168.1.200

定义ACL用于分离隧道

asa802(config)# access-list split_tunnel permit ip 10.10.1.0 255.255.255.0 any

定义组策略

asa802(config)# group-policy vpn_group_policy internal

asa802(config)# group-policy vpn_group_policy attributes

asa802(config-group-policy)# split-tunnel-policy tunnelspecified

asa802(config-group-policy)# split-tunnel-network-list value split_tunnel

asa802(config-group-policy)# exit

建立隧道组

asa802(config)# tunnel-group vpn_group type ipsec-ra

asa802(config)# tunnel-group vpn_group general-attributes

asa802(config-tunnel-general)# address-pool vpn_pool

asa802(config-tunnel-general)# default-group-policy vpn_group_policy

asa802(config-tunnel-general)# exit

asa802(config)# tunnel-group vpn_group ipsec-attributes

asa802(config-tunnel-ipsec)# pre-shared-key groupkey

asa802(config-tunnel-ipsec)# exit

定义传输集

asa802(config)#crypto ipsec transform-set vpn_transform esp-aes esp-sha-hmac

定义动态的Crypto Map条目

asa802(config)#crypto dynamic-map vpn_dymap 10 set transform-set vpn_transform

定义静态的Crypto Map条目

asa802(config)#crypto map mymap 1000 ipsec-isakmp dynamic vpn_dymap

将Crypto Map应用到接口

asa802(config)# crypto map mymap interface outside

SSL VPN基于ASA的配置

定义XAUTH(用户)验证

asa802(config)#username cisco password cisco

在outside口启用WebVPN和SSLVPN

asa802(config)#webvpn

asa802(config-webvpn)#enable outside

asa802(config-webvpn)#svc image disk0:/sslclient-win-1.1.3.173.pkg

asa802(config-webvpn)#svc enable

asa802(config-webvpn)#exit

定义IP地址池

asa802(config)#ip local pool vpn_pool 192.168.1.1-192.168.1.200

定义ACL用于分离隧道

asa802(config)# access-list split_tunnel permit ip 10.10.1.0 255.255.255.0 any

定义组策略

asa802(config)# group-policy vpn_group_policy internal

asa802(config)# group-policy vpn_group_policy attributes

asa802(config-group-policy)#vpn-tunnel-protocol webvpn svc

asa802(config-group-policy)# split-tunnel-policy tunnelspecified

asa802(config-group-policy)# split-tunnel-network-list value split_tunnel

asa802(config-group-policy)#webvpn

asa802(config-group-webvpn)#svc ask enable

asa802(config-group-webvpn)#exit

asa802(config-group-policy)# exit

建立隧道组

asa802(config)# tunnel-group vpn_group type webvpn

asa802(config)# tunnel-group vpn_group general-attributes

asa802(config-tunnel-general)# address-pool vpn_pool

asa802(config-tunnel-general)# default-group-policy vpn_group_policy

asa802(config-tunnel-general)# exit

asa802(config)# tunnel-group vpn_group webvpn-attributes

asa802(config-tunnel-webvpn)#group-alias groups enable

asa802(config-tunnel-webvpn)#exit

asa802(config)#webvpn

asa802(config-webvpn)#tunnel-group-list enable

asa802(config-webvpn)#exit

SSL VPN基于IOS路由器的配置

安装SVC软件

R1(config)#webvpn install svc flash:/sslclient-win-1.1.3.173.pkg

定义AAA,创建SSL VPN用户

R1(config)#aaa new-model

R1(config)#aaa authentication login vpn_authen local

R1(config)#username cisco password cisco

启用WebVPN,产生自签名证书

R1(config)#webvpn gateway vpn_gateway

R1(config-webvpn-gateway)#ip address 200.1.1.1 port 443

R1(config-webvpn-gateway)#inservice

R1(config-webvpn-gateway)#exit

定义IP地址池

R1(config)#ip local pool vpn_pool 192.168.1.1 192.168.1.200

R1(config)#int lo0

R1(config-if)#ip address 192.168.1.254 255.255.255.0

R1(config-if)#exit

建立WebVPN环境

R1(config)#webvpn context vpn_context

R1(config-webvpn-context)#gateway vpn_gateway domain group1

R1(config-webvpn-context)#aaa authentication list vpn_authen

R1(config-webvpn-context)#inservice

R1(config-webvpn-context)#exit

定义组策略

R1(config)#webvpn context vpn_context

R1(config-webvpn-context)#policy group vpn_group_policy

R1(config-webvpn-group)#functions svc-enabled

R1(config-webvpn-group)#svc address-pool vpn_pool

R1(config-webvpn-group)#svc split include 10.10.1.0 255.255.255.0

R1(config-webvpn-group)#exit

R1(config-webvpn-context)#default-group-policy vpn_group_policy

R1(config-webvpn-context)#exit

SSL VPN客户端的配置

输入 https://200.1.1.1/group1

自动安装客户端软件

安装证书

测试

通过show webvpn session context all查看会话信息

搭建RADIUS服务器

安装Cisco ACS软件

设置ACS管理员账号

配置RADIUS服务器,添加AAA客户端SW2

添加用户

配置用户组RADIUS属性

在交换机上配置802.1x认证

配置AAA

SW2(config)#aaa new-model

SW2(config)#radius-server host 10.0.0.203 auth-port 1812 acct-port 1813 key cisco

认证、统计端口和共享密钥必须与服务器配置相同

配置802.1x认证

SW2(config)#aaa authentication dot1x default group radius

配置802.1x授权

SW2(config)#radius-server vsa send authentication

SW2(config)# aaa authorization network default group radius

服务器要动态分配VLAN需要使用VSA属性

启用802.1x

SW2(config)# dot1x system-auth-control

SW2(config)#interface fastethernet 0/2

SW2(config-if)#switchport mode access

SW2(config-if)#dot1x port-control auto

命令dot1x port-control有3个参数

☐ force-authorized:端口始终处于授权状态(端口默认状态)

☐ force-unauthorized:端口始终处于非授权状态

☐ auto:根据认证结果决定端口的授权或非授权状态

查看802.1x的相关配置

SW2#show dot1x all

Sysauthcontrol Enabled

Dot1x Protocol Version 2

Critical Recovery Delay 100

Critical EAPOL Disabled

Dot1x Info for FastEthernet0/2

-----------------------------------

PAE = AUTHENTICATOR

PortControl = AUTO

ControlDirection = Both

HostMode = SINGLE_HOST

ReAuthentication = Disabled

QuietPeriod = 60

ServerTimeout = 30

…省略…

802.1x常见故障排查

一般处理流程

判断是单点故障,还是全局故障

☐ 个别故障,一般情况下认证服务器应该工作正常

– 检查用户名和密码

– 检查交换机端口配置等

☐ 全局故障,一般情况是认证服务器出现故障

– 检查服务器网络连通是否正常

– 检查服务器是否死机

– 检查服务器配置是否有变动

– 检查DHCP地址池是否用完

– 检查服务器认证端口是否访问正常

根据不同的现象逐步排查

ASA穿越代理的配置

定义触发认证的流量

ASA(config)# access-list http extended permit tcp any 192.168.100.0 255.255.255.0 eq 80

配置AAA服务器

ASA(config)# aaa-server server_group protocol { RADIUS | TACACS+ }

ASA(config)# aaa-server server_group (interface_name) host server_ipaddress

ASA(config-aaa-server-host)# key keyword

ASA(config-aaa-server-host)# authentication-port port

ASA(config-aaa-server-host)# accounting-port port

AAA认证配置

ASA(config)# aaa authentication match acl_name

AAA认证配置实例

ASA(config)# aaa authentication match http inside acs

AAA授权配置

ASA(config)# aaa authorization match acl_name interface_name server_group

配置AAA认证超时时间

ASA(config)# timeout uauth 0:05:00 absolute

ASA(config)# timeout uauth 0:05:00 inactivity

本地ACL在端口应用配置

ASA(config)#access-group acl_name in interface inside [per-user-override]

配置per-user-override参数

☐ 只有动态下发的ACL有效

不配置per-user-override参数

☐ 本地ACL和动态下发的ACL同时有效


相关文章

  • 咸阳某五星级酒店网络改造方案
  • 西安思航电子工程有限公司 Xi'an SiHang Electronic Engineering CO.,LTD. 有线方案报价表 销售人员:集成部经理 方案总体优势 高可用,高可靠 1.接入交换机所有的电脑互相不能通信. 2.所有的电脑可 ...查看


  • 校园网建设方案
  • 目 录 一. 用户需求分析 .......................................................................................................... ...查看


  • CISCO5520防火墙配置实例
  • CISCO 5520防火墙配置实例 本人在项目中已经两次接触到思科5500系列防火墙的配置应用了,根据项目的需求不同,详细的配置也不一样,因此汇总了一个通用版本的思科5500系列防火墙的配置,不详之处,请各位大虾给予指点,谢谢! CD-AS ...查看


  • 网络工程类课程设计报告案例
  • 郑州航空工业管理学院 网络工程类课程设计 题 目:郑州航院专家公寓网络设计与实现 学 号: 姓 名: 郭琳琳 指导老师: 赵妍 2013年 5 月 17 日 项目总体分工 项目个人分工 目 录 第1章 需求分析 .............. ...查看


  • 防火墙怎么设置才能发挥最大功效
  • 防火墙怎么设置才能发挥最大功效? 防火墙对于很多用户来说有点鸡肋的感觉,事实上防火墙的功用还是很多的,只是我们平时不懂得如何去设置罢了.防火墙负载过重吗?防火墙负载过重的症状包括CPU占用率高,数据传输慢,应用运行缓慢. 在升级硬件之前,有 ...查看


  • 小型校园网络规划与设计方案毕业论文
  • 校园网络规划与设计方案 班级:计算机网络工程 姓名: XXX 指导老师: XXX 目 录 摘 要 ....................................................................... ...查看


  • 中国DDOS防火墙产品市场研究报告1029
  • 2009年中国DDOS防火墙 市场研究报告 北京立本市场研究有限公司 2010年10月 目录 第一章2009年中国DDOS防火墙市场概况.................................................... ...查看


  • 校园网设计方案项目书
  • 校园网设计方案 项目书 设 计 人:*** 联系电话:138******** 目 录 第一章 项目概要..................................................................... ...查看


  • 配置asa5505防火墙
  • 配置asa 5505防火墙 1.配置防火墙名 ciscoasa> enable ciscoasa# configure terminal ciscoasa(config)# hostname asa5505 2.配置Http.teln ...查看


热门内容