(五)site to site vpn的配置(采用rsa-encrypted)
实验网络拓扑:
router3662---switch---router1720
3662接口ip:
f0/0:10.130.23.244/28
f0/1:172.16.2.1/24
1720接口ip:
f0:10.130.23.246/28
lo0:172.16.1.1/24
1720的ios为c1700-k93sy7-mz.122-8.T5.bin
3662的ios为c3660-jk9o3s-mz.123-1a.bin
步骤:
以1720为例进行配置
(1)配置静态路由 ####在配置vpn之前,需要保证两方的网络可以互相访问。
ip route 172.16.2.0 255.255.255.0 10.130.23.244
(2)定义加密数据的acl
access 144 permit ip 172.16.1.0 0.0.0.255 172.16.2.0 0.0.0.255
(3)生成rsa key
cry key generate rsa general-keys ####生成General Purpose rsa Key
或者 cry key generate rsa usage-keys ####分别生成rsa signing key和rsa encryption key
这里 统一用general purpose key
(4)复制peer router的public key到本地router中
(A)在3662上生成general purpose key
(B)在3662上show cry key mypubkey rsa,复制其中的General Purpose Key
(C)在1720上,cry key pubkey-chain rsa ####设置public key
addressed-key 10.130.23.244 ####设置关联10.130.23.244ip地址的key
key-string ####定义key串
粘贴从3662上复制的General Purpose Key
#####如果第三步生成了两种key,则这里复制粘贴的,应该是Encryption Key(三个key中的第二个)
(5)定义isakmp policy
cry isa policy 1
authentication rsa-encr ####采用rsa Encryption key进行验证
####authentication参数必须配置,其他参数如group、hash、encr、lifetime等,如果进行配置,需要注意两个路由器上的对应参数配置必须相同。
(6)定义transform-set
cry ipsec transform-set vpn-tfs esp-3des esp-sha-hmac
####其中vpn-tfs为transform-set name,后面两项为加密传输的算法
mode transport/tunnel #####tunnel为默认值,此配置可选
(7)定义crypto map entry
cry map vpn-map 10 ipsec-isakmp
####其中vpn-map为map name,10 是entry 号码,ipsec-isakmp表示采用isakmp进行密钥管理
match address 144 ####定义进行加密传输的数据,与第二步对应
set peer 10.130.23.244 ####定义peer路由器的ip
set transform-set vpn-tfs ####与第五步对应
####如果一个接口上要对应多个vpn peer,可以定义多个entry,每个entry对应一个peer;同样,pubkey
也要对应进行设置。
(7)将crypto map应用到接口上
inter f0 #####vpn通道入口
cry map vpn-map
(8)同样方法配置3662路由器。
1720完整配置:
VPN1720#sh run
Building configuration...
Current configuration : 1490 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname VPN1720
!
logging buffered 4096 debugging
no logging rate-limit
enable password CISCO
!
username vclient1 password 0 vclient1
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
ip subnet-zero
!
!
ip domain-name fjbf.com
!
ip audit notify log
ip audit po max-events 100
!
crypto isakmp policy 1
encr 3des
authentication rsa-encr
group 2
!
!
crypto ipsec transform-set vpn-tfs esp-3des esp-sha-hmac
!
crypto key pubkey-chain rsa
addressed-key 10.130.23.244
address 10.130.23.244
key-string
305C300D 06092A86 4886F70D 01010105 00034B00 30480241 00BF3672 CB4D69EF
D131C023 C93EA4C5 7E09FBDB 23E9F910 EF04344A 2A4D1956 4E49DADC 5FAAE102
DBEDE13D 7911B1AD 23545B13 8EBB4791 E527B259 F87E605F 2D020301 0001
quit
!
crypto map vpn-map 10 ipsec-isakmp
set peer 10.130.23.244
set transform-set vpn-tfs
match address 144
!
!
!
!
interface Loopback0
ip address 172.16.1.1 255.255.255.0
!
interface FastEthernet0
ip address 10.130.23.246 255.255.255.240
speed auto
crypto map vpn-map
!
interface Serial0
no ip address
encapsulation ppp
no keepalive
no fair-queue
!
ip classless
ip route 172.16.2.0 255.255.255.0 10.130.23.244
no ip http server
ip pim bidir-enable
!
!
access-list 144 permit ip 172.16.1.0 0.0.0.255 172.16.2.0 0.0.0.255
!
!
line con 0
exec-timeout 0 0
speed 115200
line aux 0
line vty 0 4
login
!
end
说明:
(1)采用rsa encrypted方式加密传输数据,默认key长度为512字节,最高可设为2048字节。安全性能较高。
(2)100M双工交换网络中,在双向同时ping 15000字节的大包进行测试时,1720的cpu使用率一度高达90%左右,3662的使用率约为25%,两台路由器内存使用率则变化不大。可见用rsa encrypted方式加密,对低端路由器的cpu性能影响很大。
常用调试命令:
show cry ip sa
show cry isa sa
deb cry isa
deb cry ip
clear cry isa
clear cry sa