(192.168.2.1)R1(<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.10.1.1)-----(10.10.1.2)R2(10.10.2.1)---------(10.10.2.2)R3(172.16.1.1)/24<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

一、 R1

1 crypto isakmp enable               启用 ISAKMP/IKE

    Crypto isakmp identity address        定义发送的身份为 IP 地址

     Crypto isakmp policy  1             定义策略,即用于管理连接的策略

    Authentication pre-share

    Encryption des

Hash md5

Group 1

Lifetime 86400

Exit

 

2 crypto isakmp key 0 123 address 10.10.2.2 255.255.255.255 no-xauth    定义共享密钥

 

3 ip access-list extended ***acl

    Permit ip 192.168.2.0 0.0.0.255 172.16.1.0 0.0.0.255        定义需要保护的数据量

 

4 ip route 0.0.0.0 0.0.0.0 10.10.1.2 因为不管隧道是否建立,出口处均要用外接口地址

5 crypto ipsec transform-set r3 esp-md5-hmac esp-des    定义变换集即为保护方法

 

6 crypto map tor3 100 ipsec-isakmp          定义保护流量应该转发给谁

    Set peer 10.10.2.2

    Set transform-set r3

    Match address ***acl

    Mode tunnel

7 、如果在出站接口上有 ACL ,则一定要为 IPSEC 协商过程中的未保护流量定义 ACL

 

    Access-list 102 permit udp host 10.10.2.2 host 10.10.1.1 eq 500

    Access-list 102 permit esp host 10.10.2.2 host 10.10.1.1

Access-list 102 ip 172.16.1.0 0.0.0.255 192.168.2.0 0.0.0.255

    Deny ip any any

 

8 、在外部接口激活 ACL MAP

    Int s1/0

    Ip access-group 102  in

    Crypto map tor3

 

二、 R3 上只需改变以下对应项即可

2 crypto isakmp key 123 address 10.10.1.1 255.255.255.255 no-xauth

ip access-list extended ***acl

   Permit ip 172.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

4        ip route 0.0.0.0 0.0.0.0 10.10.2.1

5        crypto ipsec transform-set r1 esp-md5-hmac esp-des

6        crypto map tor1 100 ipsec-isakmp

set peer 10.10.1.1

set transform-set r1

7        access-list 102 permit ip 192.168.2.0 0.0.0.255 172.16.1.0 0.0.0.255

access-list 102 permit udp host 10.10.1.1 host 10.10.2.2 eq 500

access-list 102 permit esp host 10.10.1.1 host 10.10.2.2

 

8        int s1/0

ip access-group 102 in

crypto map tor1