ISP配置
1 2 3 4 5
| inter g0/0 ip add 1.1.1.1 255.255.255.248 inter g0/1 ip add 2.1.1.1 255.255.255.248
|
AF1配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| 公网接口配置 inter g0/0 nameif outside ip add 1.1.1.1 255.255.255.248 内网接口配置 inter g0/1 nameif inside ip add 10.1.1.1 255.255.255.248 内网网络对象配置 object network user_network subnet 10.2.1.0 255.255.255.0 nat (inside,outside) dynamic interface //对此网段地址做源地址转换,转换地址为出接口地址 策略配置(ACL) access-list InToOut extended permit ip object user_network any access-list InToOut extended permit icmp any any 将策略应用在接口 access-group InToOut in interface outside 路由配置 route outside 0.0.0.0 0.0.0.0 1.1.1.1 route inside 10.2.1.0 255.255.255.0 10.1.1.2 \\\\\\以上为基本上网配置
IPSEC配置 1. 配置ISAKMP-IKEV1 创建IKE策略 crypto ikev1 policy 10 \\策略值越搞,调用优先级越高 encryption 3des \\指定加密算法 authentication pre-share \\指定身份验证方法,此处为预共享密钥 hash md5 \\指定散列算法 哈希算法双方保持一致,用作签名,确保数据一致性 group 2 \\ 指定Diffie-Hellman 群标识符 lifetime 14400 \\指定 SA 寿命 2. 创建隧道组 tunnel-group 2.1.1.2 type ipsec-l2l \\隧道类型为LAN TO LAN tunnel-group 2.1.1.2 ipsec-attributes \\配置ipsec属性 ikev1 pre-shared-key cisco1234 3. 配置本地和对端需通讯的内网对象 object network ipsec-LocalNetwork subnet 10.2.1.0 255.255.255.0 object network ipsec-RemoteNetwork subnet 20.2.1.0 255.255.255.0 4. 配置ACL,用于匹配ipsec隧道数据流 access-list ipsec10 extended permit ip ipsec-LocalNetwork ipsec-RemoteNetwork 5. 配置ikev1策略(转换集) crypto ipsec ikev1 transform-set ESP-AES-SHA esp-aes esp-sha-hmac \\下方加密映射集中调用 6. 配置加密映射集 crypto map 2.1.1.2map 10 match address ipsec10 \\匹配ipsec acl crypto map 2.1.1.2map 10 set peer 2.1.1.2 \\配置对端ipsec设备地址 crypto map 2.1.1.2map 10 set ikev1 transform-set ESP-AES-SHA \\调用ikev1转换集,用来保护流量 7. 将加密映射集应用在接口 crypto map 2.1.1.2map interface outside 8. 在接口启用ikev1密钥管理协议 crypto ikeve1 enable outside 9.配置NAT豁免 nat (inside,outside) source static ipsec-LocalNetwork ipsec-LocalNetwork destination static ipsec-RemoteNetwork ipsec-RemoteNetwork
|
SW1配置
1 2 3 4 5 6 7 8 9
| 上联接口配置 int g0/0 ip add 10.1.1.2 255.255.255.248 本地网络配置 inter lookbacp ip add 10.2.1.254 255.255.255.0 上网验证 ping 1.1.1.1 source 10.2.1.254 echo !!!!!
|
此处只展示了AF1的配置,AF2的配置按照相同的方式配置,并修改相应细节即可
Debug
1 2 3 4
| debug crypto ipsec 255 debug crypto ikev1 255 ter log ter mon
|