Ta có mô hình mạng cho bài Lab như sau:
- Trong sơ đồ Router 2 đóng vai trò NTP Server để đồng bộ thời gian.
- Router 2 sẽ kết nối đến Window Server 2003, trên máy này install Certificate Authority, Add on Simple Certificate Enrollment Protocol để hỗ trợ cung cấp cerfiticate cho device Cisco.
- Một số việc cần chú ý khi triển khai certificate để xác thực
+ Gán hostname, domain name, tạo cặp public private key theo thuật toán RSA.
+ Yêu cầu đồng bộ thời gian giữa các thiết bị.
+ Tạo ra crypto isakmp profile với các thuật toán đủ mạnh.
1. Các bước cấu hình chuẩn bị tại các router
- Cấu hình tại router 1
R1>enable
R1#conf t
R1(config)#clock timezone GMT +7
R1(config)#hostname R1
R1(config)#ip host CA-SERVER 192.1.34.1
R1(config)#int s 0/0
R1(config-if)#ip add 192.1.12.1 255.255.255.252
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int fa 0/0
R1(config-if)#ip add 192.168.1.254 255.255.255.0
R1(config-if)#no sh
R1(config-if)#no kee
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 192.1.12.2
R1(config)#ntp server 4.4.4.4
- Cấu hình tại router đóng vai trò ISP
R2>enable
R2#conf t
R2(config)#clock timezone GMT +7
R2(config)#hostname ISP
ISP(config)#ntp master 3
ISP(config)#no ntp authenticate
ISP(config)#int s 0/0
ISP(config-if)#ip add 192.1.12.2 255.255.255.252
ISP(config-if)#no sh
ISP(config-if)#exit
ISP(config-if)#int s 0/1
ISP(config-if)#ip add 192.1.23.2 255.255.255.252
ISP(config-if)#no sh
ISP(config-if)#exit
ISP(config)#int fa 0/0
ISP(config-if)#ip add 192.1.34.2 255.255.255.0
ISP(config-if)#no sh
ISP(config-if)#description Ketnoi_CA_CA-SERVER
ISP(config-if)#exit
ISP(config)#int lo 0
ISP(config-if)#ip add 4.4.4.4 255.255.255.0
ISP(config-if)#description IP_Dong_Bo_Time
ISP(config)#exit
- Cấu hình tại Router 3
R3>enable
R3#conf t
R3(config)#clock timezone GMT +7
R3(config)#ip host CA-SERVER 192.1.34.1
R3(config)#hostname R2
R2(config)#int s 0/0
R2(config-if)#ip add 192.1.23.1 255.255.255.252
R2(config-if)#no sh
R2(config)#exit
R2(config)#int fa 0/0
R2(config-if)#ip add 192.168.2.254 255.255.255.0
R2(config-if)#no sh
R2(config-if)#no kee
R2(config)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 192.1.23.2
R2(config)#ntp server 4.4.4.4
- Tại PC ta cũng cấu hình update time đến NTP Server mang IP là 4.4.4.4
2. Cấu hình VPN IPSEC Site to Site tại Router 1 và Router 3
- Tại Router 1 ta cấu hình như sau:
R1(config)#crypto isakmp policy 10
R1(config-isakmp)#encrypt 3des
R1(config-isakmp)#hash sha
R1(config-isakmp)#authentication rsa-sig
R1(config-isakmp)#group 2
R1(config-isakmp)#exit
R1(config)#crypto ipsec transform-set trans esp-3des
R1(cfg-crypto-trans)#exit
R1(config)#access-list 115 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
R1(config)#crypto map vpn 10 ipsec-isakmp
R1(config-crypto-map)#match address 115
R1(config-crypto-map)#set peer 192.1.23.1
R1(config-crypto-map)#set transform-set trans
R1(config-crypto-map)#exit
R1(config)#interface serial 0/0
R1(config-if)#crypto map vpn
R1(config-if)#exit
- Tại Router 3 ta cấu hình như sau
R2(config)#crypto isakmp policy 10
R2(config-isakmp)#encrypt 3des
R2(config-isakmp)#hash sha
R2(config-isakmp)#authentication rsa-sig
R2(config-isakmp)#group 2
R2(config-isakmp)#exit
R2(config)#crypto ipsec transform-set trans esp-3des
R2(cfg-crypto-trans)#exit
R2(config)#access-list 115 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
R2(config)#crypto map vpn 10 ipsec-isakmp
R2(config-crypto-map)#match address 115
R2(config-crypto-map)#set peer 192.1.12.1
R2(config-crypto-map)#set transform-set trans
R2(config-crypto-map)#exit
R2(config)#interface serial 0/0
R2(config-if)#crypto map vpn
R2(config-if)#exit
3. Cấu hình Certificate Authority Server
- Ta sẽ sử dụng Window Server 2003 để cấp certificate. Đầu tiên ta thay đổi Computer Name thành CA-SERVER
- Cấu hình thành Certifcate Authority Server và install thêm Add on SCEPCác bạn có thể tham khảo cách làm chi tiết tại bài viết này
4. Cấu hình Trusted Point tại Router 1 và Router 3
- Tại router 1 ta cấu hình như sau:
Code:
R1#hostname R1
R1(config)#ip domain name athena.edu.vn
R1(config)#crypto key generate rsa general-key modulus 1024
R1(config)#crypto ca trustpoint CA-SERVER
R1(ca-trustpoint)#enrollment url
http://CA-SERVER/certsrv/mscep/mscep.dllR1(ca-trustpoint)#subject-name cn=nhanld1@athenavn.com
R1(ca-trustpoint)#crypto ca authenticate CA-SERVER
==> Click Yes để chấp nhận Finger Print được cung cấp từ CA Server
R1(config)#crypto ca enroll CA-SERVER
==> Cấu hình xin certificate từ CA Server. Sau đó, ta phải đi vào phần quản trị CA server và issue certificate
- Tại Router 3 ta cũng thực hiện tương tự
Code:
R2#hostname R1
R2(config)#ip domain name athena.edu.vn
R2(config)#crypto key generate rsa general-key modulus 1024
R2(config)#crypto ca trustpoint CA-SERVER
R2(ca-trustpoint)#enrollment url
http://CA-SERVER/certsrv/mscep/mscep.dllR2(ca-trustpoint)#subject-name cn=nhanld2@athenavn.com
R2(ca-trustpoint)#crypto ca authenticate CA-SERVER
R1(config)#crypto ca enroll CA-SERVER
5. Kiểm tra cấu hình
- Tại router ta dùng lệnh show crypto ca certificate và lệnh dir nvram: để kiểm tra certificate đã được issue từ CA Server
- Cuối cùng ở Router 1 ta dùng lệnh ping 192.168.2.254 source 192.168.1.254 để kiểm tra quá trình hoạt động của VPN