ISCW Chương trình đạo tạo mạng chuyên nghiệp ProNet TÀI LIỆU CẤU HÌNH IPSEC VPN I) Các bước cấu hình Site-to-Site VPN: 1) Cấu hình chính sách ISAKMP/IKE pha 1: a) Enable ISAKMP (mặc định là đã enable): Router(config)# [no] crypto isakmp enable b) Tạo chính sách cho pha 1: Mặc định có sẵn một chính sách mặc định nhưng ta có thể tạo thêm: Router(config)# crypto isakmp policy priority (priority càng nhỏ càng ưu tiên) Router(config-isakmp)# encryption {des | 3des | aes} Router(config-isakmp)# hash {sha | md5} Router(config-isakmp)# authentication {rsa-sig | rsa-encr | pre-share} Router(config-isakmp)# group {1 | 2 | 5} Router(config-isakmp)# lifetime seconds Router(config-isakmp)# exit Đối với các thiết bị cisco, lifetime có thể cấu hình khác nhau ở các peer, trong quá trình thiết lập pha 1, các peer sẽ chọn cho mình lifetime nhỏ hơn. Để xem các chính sách ISAKMP hiện có, dùng lệnh: show crypto isakmp policy Router# show crypto isakmp policy Global IKE policy Protection suite of priority 10 encryption algorithm: AES - Advanced Encryption Standard (128 bit keys). hash algorithm: Message Digest 5 authentication method: Pre-Shared Key Diffie-Hellman group: #2 (1024 bit) lifetime: 86400 seconds, no volume limit Default protection suite encryption algorithm: DES - Data Encryption Standard (56 bit keys). hash algorithm: Secure Hash Standard authentication method: Rivest-Shamir-Adleman Signature Diffie-Hellman group: #1 (768 bit) lifetime: 86400 seconds, no volume limit Mặc định thì có sẵn 1 chính sách mặc định như sau: • Encryption algorithm: DES • HMAC function: SHA-1 • Authentication method: RSA signatures (certificates) • DH group: 1 • Lifetime: 86,400 seconds Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
TÀI LIỆU CẤU HÌNH IPSEC VPN
I) Các bước cấu hình Site-to-Site VPN:
1) Cấu hình chính sách ISAKMP/IKE pha 1:
a) Enable ISAKMP (mặc định là đã enable):
Router(config)# [no] crypto isakmp enable
b) Tạo chính sách cho pha 1:
Mặc định có sẵn một chính sách mặc định nhưng ta có thể tạo thêm:
Đối với các thiết bị cisco, lifetime có thể cấu hình khác nhau ở các peer, trong quá trình thiết lập pha 1, các peer sẽ chọn cho mình lifetime nhỏ hơn.
Để xem các chính sách ISAKMP hiện có, dùng lệnh:
show crypto isakmp policy
Router# show crypto isakmp policyGlobal IKE policyProtection suite of priority 10 encryption algorithm: AES - Advanced Encryption Standard (128 bit keys). hash algorithm: Message Digest 5 authentication method: Pre-Shared Key Diffie-Hellman group: #2 (1024 bit) lifetime: 86400 seconds, no volume limitDefault protection suite encryption algorithm: DES - Data Encryption Standard (56 bit keys). hash algorithm: Secure Hash Standard authentication method: Rivest-Shamir-Adleman Signature Diffie-Hellman group: #1 (768 bit) lifetime: 86400 seconds, no volume limit
Mặc định thì có sẵn 1 chính sách mặc định như sau:
Số ‘0’ cho biết chuỗi khóa chưa được mã hóa, ngược lại là số ‘6’.
Nếu muốn tất cả các peer đều dùng chung 1 khóa thì dùng câu lệnh bên dưới. Tuy nhiên, điều này không nên vì chỉ cần 1 peer bị đánh cắp khóa là tất cả các peer còn lại đều bị lộ khóa. Tốt nhất là mỗi peer một khóa khác nhau (nhiều quá thì hơi khó nhớ nhưng … an toàn là chính :D).
Khi đã bảo vệ theo cách trên thì khi dùng lệnh kiểm tra khóa sẽ không thấy được nội dung khóa:
Router# show crypto isakmp keyKeyring Hostname/Address Preshared Keydefault 192.1.1.1 (encrypted)
Muốn xóa chức năng bảo vệ khóa thì dùng lệnh:
no key config-key password-encrypt
Tuy nhiên, các khóa đã được mã hóa sẽ không tự giải mã ngược lại mà chúng ta phải gỏ lại lệnh.
(ii) RSA encrypted nonces:
Mã hóa khóa đồng bộ bằng khóa bất đồng bộ.
Các tiến trình con gồm:
• Tạo ra cặp khóa.
• Chia sẽ khóa công khai.
• Tạo ra cặp khóa:
Router(config)# hostname <hostname>Router(config)# ip domain-name <tên miền>
2 câu lệnh đầu là bắt buộc vì các tham số được nhập vào sau đó sẽ được sử dụng như tham số đầu vào cho thuật toán tạo khóa ở câu lệnh thứ 3. Lưu ý: hostname không được gỏ mặc định “Router”.
• general-keys (mặc định): tạo ra 1 cặp khóa chung cho chữ kí số và mã hóa.
• usage-keys: tạo 2 cặp khóa riêng biệt cho chữ kí số và mã hóa.
Cấu hình minh họa:
Router(config)# hostname pronetpronet (config)# ip domain-name cisco.compronet(config)# crypto key generate rsaThe name for the keys will be: r3640.cisco.comChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 3
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
How many bits in the modulus [512]: 2048% Generating 2048 bit RSA keys ...[OK]pronet(config)#
Câu lệnh kiểm tra:
show crypto key mypubkey rsa
pronet# show crypto key mypubkey rsa% Key pair was generated at: 06:13:07 UTC Mar 1 2002Key name: pronet.cisco.com Usage: General Purpose Key Key is not exportable. Key Data: 30820122 300D0609 2A864886 F70D0101 01050003 82010F00 3082010A<bỏ qua 1 phần> 23CA4ACE 63F1D296 1B020301 0001% Key pair was generated at: 06:13:10 UTC Mar 1 2005Key name: pronet.cisco.com.server Usage: Encryption Key Key is not exportable. Key Data: 307C300D 06092A86 4886F70D 01010105 00036B00 30680261 00BFB7C0<bỏ qua 1 phần> BAE69169 713DCF99 B1020301 0001
Ta có thể tạo nhiều cặp khóa trên cùng 1 router cho các peer khác nhau. Khi đó chúng sẽ được phân biệt bởi một nhãn duy nhất khi cấu hình, nếu không cấu hình rõ ràng nhãn thì FQDN sẽ được sử dụng làm nhãn.
Router(config-pubkey-c)# named-key peer_name [encryption | signature](dùng cho trường hợp chứng thực sử dụng hostname) HoặcRouter(config-pubkey-c)# addressed-key peer_IP_address [encryption | signature](dùng cho trường hợp chứng thực sử dụng địa chỉ IP của peer)
Router(config-pubkey-k)# key-string key_string !(key_string ở dạng Hecxa)Router(config-pubkey-k)# quit
Ghi chú: Đối với một số IOS thì cấu hình key-string có khác đôi chút:
Router(config-pubkey-k)# key-stringRouter(config-pubkey)# key_string !(nhập key_string ở dạng Hecxa)Router(config-pubkey)# quit
pronet(config)# crypto key pubkey-chain rsapronet(config-pubkey-chain)# no addressed-key 192.1.1.1
hoặc
pronet(config-pubkey-chain)# no named-key hocvienProNet
Xóa cặp khóa trên router cục bộ:
Router(config)# crypto key zeroize rsa [key_pair_label]Nếu không có tham số nhãn thì câu lệnh trên sẽ xóa tất cả các cặp khóa trên router.
(iii) RSA signatures (digital certificates):
Chữ kí số không được chia sẽ trước. Để đảm bảo bảo mật cho chữ kí số. CA được sử dụng để xác định tính hợp lệ của khóa công khai.Có 2 cách chính để lấy certificate (chứng chỉ) từ CA: lấy thủ công và sử dụng giao thức SCEP (Simple Certificate Enrollment Protocol).
Lấy certificate dùng SCEP:
• Cấu hình Router Cisco làm CA:
Có nhiều bước thực hiện, tuy vậy bài viết này chỉ ghi các bước tối thiểu cần thiết để cấu hình router cisco làm CA sử dụng SCEP.
Bước 1: Enable CA.
! Vì SCEP hoạt động dựa trên http nên ta phải enable http.
Router(config)# ip http server
! Cấu hình chức năng CA trên Router
Router(config)# crypto pki server CA_name
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 5
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
! Cấu hình tên Common Name (CN) sẽ xuất hiện trong các chứng nhận (certificate) của CA. Nếu không! cấu hình lệnh này thì mặc định CA_name sẽ được dùng là CN luôn.
! Chỉ rỏ nơi lưu các thông tin certificate, mặc định là lưu trong NVRAM.
Router(cs-server)# database url root_URL
! Bắt buộc phải có lệnh “no shutdown” đển hoàn thành việc enable CA.
Router(cs-server)# no shutdownRouter(cs-server)# exit
Bước 2: Điều khiển việc chấp nhận các yêu cầu xin CA.
! Xem thông tin yêu cầu chứng nhận từ Clients
Router# crypto pki server CA_name info requestsVí dụ:
RouterCA# crypto pki server routerca info requestsEnrollment Request Database:Subordinate CA certificate requests:ReqID State Fingerprint SubjectName--------------------------------------------------------------
output omittedRouter certificates requests:ReqID State Fingerprint SubjectName--------------------------------------------------------------1 pending F089C0A84FC27545E01BE806978D898A hostname=r3620.cisco.com
! Xóa các yêu cầu chứng thực của client, nếu ghi thêm tham số reqID thì chỉ xóa những yêu cầu với reqID tương ứng.
Router# crypto pki server CA_name remove {all | reqID}
! Phê chuẩn các yêu cầu chứng thực của client, nếu ghi thêm tham số reqID thì chỉ phê chuẩn những yêu cầu với reqID tương ứng.
Router# crypto pki server CA_name grant {all | reqID}
! Từ chối không phê chuẩn các yêu cầu chứng thực của client, nếu ghi thêm tham số reqID thì chỉ từ chối phê chuẩn những yêu cầu với reqID tương ứng.
Router# crypto pki server CA_name reject {all | reqID}
R1(config)#crypto key generate rsa The name for the keys will be: R1.pronet.edu.vnChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [512]: % Generating 512 bit RSA keys, keys will be non-exportable...[OK]
R1(config)# crypto ca enroll caserver% Start certificate enrollment ..% Create a challenge password. You will need to verbally provide this password to the CA Administrator in order to revoke your certificate. For security reasons your password will not be saved in the configuration. Please make a note of it.Password: cisco123abcRe-enter password: cisco123abc% The fully-qualified domain name in the certificate will be:
R1.pronet.edu.vn% The subject name in the certificate will be: R1.pronet.edu.vn % Include the router serial number in the subject name? [yes/no]: no% Include an IP address in the subject name? [no]: noRequest certificate from CA? [yes/no]: yes% Certificate request sent to Certificate Authority% The certificate request fingerprint will be displayed.% The 'show crypto pki certificate' command will also show the fingerprint.05:32:29: CRYPTO_PKI: Certificate Request Fingerprint MD5:
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 7
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
F9A3574C 09BAC68D 491D0FDA 1EBCE0BC05:32:29: CRYPTO_PKI: Certificate Request Fingerprint SHA1: 898BDC0B 69F74320 8EECF1FF FD86503F 3DC366BB05:32:34: %PKI-6-CERTRET: Certificate received from Certificate Authority
Bước 6: Lưu chứng nhận định danh của CA.
Dùng lệnh copy running-config startup-config.
II) Một số bài LAB mẫu Site-to-Site VPN:
1) Lab 1: Site-to-site VPN sử dụng chứng thực Preshared-key
Sơ đồ mạng:
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 8
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
R2
ISP
R1
Lo0: 192 .168 .1.1/24 Lo0: 192.168.2.1/24
101 .0.0.0/24102.0.0.0/24
.2.2
.1.1
S0/1
S0/0
S0/0
S0/0
Cấu hình:
Trên R1:
R1#sho runBuilding configuration...!(bỏ qua)!crypto isakmp policy 1 hash md5 authentication pre-share group 2crypto isakmp key pronet address 102.0.0.1!!crypto ipsec transform-set setR1 esp-des esp-md5-hmac !crypto map mapR1 1 ipsec-isakmp set peer 102.0.0.1 set transform-set setR1 match address ACL_VPN!!! interface Loopback0 ip address 192.168.1.1 255.255.255.0!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto!interface Serial0/0 ip address 101.0.0.1 255.255.255.0
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 9
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
clock rate 2000000 crypto map mapR1!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1 no ip address shutdown clock rate 2000000!ip route 0.0.0.0 0.0.0.0 Serial0/0!!ip http serverno ip http secure-server!ip access-list extended ACL_VPN permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255!(bỏ qua)!end
Trên R2:
R2#sho run!(bỏ qua)!crypto isakmp policy 1 hash md5 authentication pre-share group 2crypto isakmp key pronet address 101.0.0.1!!crypto ipsec transform-set setR2 esp-des esp-md5-hmac !crypto map mapR2 1 ipsec-isakmp set peer 101.0.0.1 set transform-set setR2 match address ACL_VPN!!! interface Loopback0 ip address 192.168.2.1 255.255.255.0!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto!
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 10
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
interface Serial0/0 ip address 102.0.0.1 255.255.255.0 clock rate 2000000 crypto map mapR2!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1 no ip address shutdown clock rate 2000000!ip route 0.0.0.0 0.0.0.0 Serial0/0!!ip http serverno ip http secure-server!ip access-list extended ACL_VPN permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255!(bỏ qua)!end
Trên ISP:
ISP#sho run!(bỏ qua)!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto!interface Serial0/0 ip address 101.0.0.2 255.255.255.0 clock rate 64000!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1 ip address 102.0.0.2 255.255.255.0 clock rate 64000!(bỏ qua)!end
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 11
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
2) Lab 2: Site-to-site VPN sử dụng chứng thực RSA Encrypted Nonces.
Sơ đồ mạng:
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 12
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
R2
ISP
R1
Lo0: 192 .168 .1.1/24 Lo0: 192.168.2.1/24
100.0.0.0/24 101 .0.0.0/24
.2
.2.1
.1F0/1
F0/0
F0/0
F0/0
Cấu hình tương tự như lab site-to-site VPN cơ bản, chỉ khác ở chổ không cấu hình preshared-key mà cấu hình RSA Encrypted Nonces.
Thực hiện cấu hình chứng thực RSA Encrypted Nonces:
Trên R1:
Router(config)#hostname R1R1(config)#ip domain-name pronet.edu.vnR1(config)#crypto key generate rsa The name for the keys will be: R1.pronet.edu.vnChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [512]: % Generating 512 bit RSA keys, keys will be non-exportable...[OK]
R1(config)#^ZR1#*Mar 1 00:42:54.591: %SSH-5-ENABLED: SSH 1.99 has been enabled*Mar 1 00:42:55.899: %SYS-5-CONFIG_I: Configured from console by consoleR1#sho crypto key mypubkey rsa% Key pair was generated at: 00:42:54 UTC Mar 1 2002Key name: R1.pronet.edu.vn Usage: General Purpose Key Key is not exportable. Key Data: 305C300D 06092A86 4886F70D 01010105 00034B00 30480241 00E1840A 3C7C56F0 E9A6FC05 C0E9C475 31D7BAB4 16BA2D0B 6225FE1A BABBEC1A 98D10326 22E92B47 4F2EE0E0 AEBB9575 C8ADCF3A 65DBD399 43883470 D641A3E8 35020301 0001% Key pair was generated at: 00:42:55 UTC Mar 1 2002Key name: R1.pronet.edu.vn.server Usage: Encryption Key Key is not exportable. Key Data: 307C300D 06092A86 4886F70D 01010105 00036B00 30680261 00D0D76D A9BC445F 45BCEA98 BB052210 AEE61F80 E1A1C337 D42728A2 67679767 4D6004F4 D74007A5 F9193312 3208FF64 E5971867 1FDA5390 F190902D 292219FB 4955A1FA 311F7ADF B4125D20 73E45386 21CEF920 BBB31299 BE6FB651 6036A13F D3020301 0001R1#
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 13
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
R1#conf tEnter configuration commands, one per line. End with CNTL/Z.R1(config)#crypto key pubkey-chain rsa R1(config-pubkey-chain)#addressed-key 101.0.0.2R1(config-pubkey-key)#key-string Enter a public key as a hexidecimal number ....
R2(config)#hostname R2R2(config)#ip domain-name pronet.edu.vnR2(config)#crypto key generate rsa The name for the keys will be: R2.pronet.edu.vnChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [512]: % Generating 512 bit RSA keys, keys will be non-exportable...[OK]
R2(config)#R2#sho crypto key mypubkey r % Key pair was generated at: 00:42:00 UTC Mar 1 2002Key name: R2.pronet.edu.vn Usage: General Purpose Key Key is not exportable. Key Data: 305C300D 06092A86 4886F70D 01010105 00034B00 30480241 00C3F4FF 640DEC64 EBA0427D 2794180D 5FD67884 6B13ACE7 5A370FD4 75151F1B 10E400F5 04380909 066FBC57 9D2BB9A2 0EE04D95 8FB2BE15 4C1FE507 EDADDF60 89020301 0001% Key pair was generated at: 00:42:01 UTC Mar 1 2002Key name: R2.pronet.edu.vn.server Usage: Encryption Key Key is not exportable. Key Data: 307C300D 06092A86 4886F70D 01010105 00036B00 30680261 00A2308F 5F8846AF FC423170 951BC10C DD882934 C3F06E54 58A579D8 F89DAF03 0BA94069 891EA161 B7CF35BC 006A0BD2 F18FCBC1 8696A180 B74B46AA 6D5E855E 5B5F7535 B913530B F73E0625 7DAE97F8 4B4BBE24 ABBCDCDB B512BF65 91C4D642 9F020301 0001R2#R2(config)#cry key pubkey-chain rsaR2(config-pubkey-chain)#addressed-key 100.0.0.1R2(config-pubkey-key)#key-string Enter a public key as a hexidecimal number ....
duplex auto speed auto crypto map mymap!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!ip http serverno ip http secure-serverip classlessip route 0.0.0.0 0.0.0.0 101.0.0.1!ip access-list extended VPNACL permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255!control-plane!line con 0 logging synchronousline aux 0line vty 0 4!end
3) Lab 3: Site-to-site VPN sử dụng chứng thực qua CA.
Sơ đồ mạng:
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 18
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
R2
ISP
R1
Lo0: 192 .168 .1.1/24 Lo0: 192.168.2.1/24
101 .0.0.0/24102.0.0.0/24
.2.2
.1.1
S0/1
S0/0
S0/0
S0/0
103.0.0.0/24
S1/0.2
CA
.1 S0/0
Yêu cầu: LAN R1 có thể đến được LAN R2.
Thực hiện:
Cấu hình tương tự như lab site-to-site VPN cơ bản, chỉ khác ở chổ không cấu hình preshared-key mà cấu hình chứng thực qua CA.
Giả sử đã cấu hình đúng địa chỉ IP như sơ đồ, đã cấu hình định tuyến để các router liên lạc được với nhau (LAN R1 chưa thể đến được LAN R2).
Thực hiện cấu hình chứng thực qua CA:
Trên CA:
! Vì SCEP hoạt động dựa trên HTTP nên ta phải enable giao thức HTTP trên Router
CA(config)#ip http server
! Khai báo và enable CA, tên là ProNet
CA(config)#crypto pki server ProNetCA(cs-server)#no sh%Some server settings cannot be changed after CA certificate generation.% Please enter a passphrase to protect the private key% or type Return to exitPassword: (nhập cisco123, tối thiểu 7 kí tự)
Re-enter password: (nhập lại cisco123)% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 19
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
% Time has not been set. Cannot start the Certificate serverCA(cs-server)#*Mar 1 00:14:57.551: %SSH-5-ENABLED: SSH 1.99 has been enabledCA(config)#^Z% Ambiguous command: "e"*Mar 1 00:15:11.931: %SYS-5-CONFIG_I: Configured from console by console
! Cấu hình thời gian hiện hành trên router thì mới có thể enable CA, khuyến cáo nên sử dụng NTP.
CA#clock set 15:30:00 6 FEB 2009CA#% Exporting Certificate Server signing certificate and keys...
*Feb 6 15:30:00.000: %SYS-6-CLOCKUPDATE: System clock has been updated from 00:15:51 UTC Fri Mar 1 2002 to 15:30:00 UTC Fri Feb 6 2009, configured from console by console.CA#Feb 6 15:30:01.603: %PKI-6-CS_ENABLED: Certificate server now enabled.CA#
R1(config)#crypto key generate rsa The name for the keys will be: R1.pronet.edu.vnChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [512]: % Generating 512 bit RSA keys, keys will be non-exportable...[OK]
R1(config)#Feb 6 15:36:10.103: %SSH-5-ENABLED: SSH 1.99 has been enabled
! Định nghĩa một CA.
R1(config)#crypto ca trustpoint ProNet
! Lệnh enrollment mode ra cho biết là CA có cung cấp RA (Registerd Authority) dự! phòng. Điều này là mặc định ở hầu hết các Cisco IOS nên nếu không cần thiết thì! cũng không cần cấu hình lệnh này.
R1(ca-trustpoint)#enrollment mode ra
! Chỉ rỏ URL đến CA.
R1(ca-trustpoint)#enrollment url http://103.0.0.1R1(ca-trustpoint)#^ZFeb 6 15:36:42.395: %SYS-5-CONFIG_I: Configured from console by consoleR1#copy run startDestination filename [startup-config]? Building configuration...[OK]R1#conf t Enter configuration commands, one per line. End with CNTL/Z.
! Tải về và chứng thực các chứng nhận của CA.
R1(config)#crypto pki authenticate ProNetCertificate has the following attributes: Fingerprint MD5: 9B0A62AB E4F377FE 9711677F 448A72EB Fingerprint SHA1: C77F7D3C 9AA07C4C E97937DF 030D5AE6 58120162
% Do you accept this certificate? [yes/no]: yesTrustpoint CA certificate accepted.
! Yêu cầu chứng nhận định danh router.
R1(config)#crypto ca enroll ProNet%% Start certificate enrollment .. % Create a challenge password. You will need to verbally provide this password to the CA Administrator in order to revoke your certificate. For security reasons your password will not be saved in the configuration. Please make a note of it.
Password: (nhập cisco123, tối thiểu 7 kí tự)Re-enter password: (nhập lại cisco123)
% The subject name in the certificate will include: R1.pronet.edu.vn
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 21
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
% Include the router serial number in the subject name? [yes/no]: no% Include an IP address in the subject name? [no]: noRequest certificate from CA? [yes/no]: yes% Certificate request sent to Certificate Authority% The 'show crypto ca certificate ProNet verbose' commandwill show the fingerprint.
Router(config)#hostname R2R2(config)#ip domain-name pronet.edu.vnR2(config)#crypto key generate rsa The name for the keys will be: R2.pronet.edu.vnChoose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [512]: % Generating 512 bit RSA keys, keys will be non-exportable...[OK]
R2(config)#Feb 6 15:46:38.179: %SSH-5-ENABLED: SSH 1.99 has been enabledR2(config)#crypto ca trustpoint ProNetR2(ca-trustpoint)#enrollment mode raR2(ca-trustpoint)#enrollment url http://103.0.0.1R2(ca-trustpoint)#exitR2(config)#^ZR2#wrBuilding configuration...
Feb 6 15:47:26.951: %SYS-5-CONFIG_I: Configured from console by console[OK]R2#conf t Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#crypto ca authenticate ProNetCertificate has the following attributes: Fingerprint MD5: 9B0A62AB E4F377FE 9711677F 448A72EB Fingerprint SHA1: C77F7D3C 9AA07C4C E97937DF 030D5AE6 58120162
% Do you accept this certificate? [yes/no]: yesTrustpoint CA certificate accepted.
R2(config)#crypto ca enroll ProNet%% Start certificate enrollment .. % Create a challenge password. You will need to verbally provide this password to the CA Administrator in order to revoke your certificate. For security reasons your password will not be saved in the configuration. Please make a note of it.
Password: Re-enter password:
% The subject name in the certificate will include: R2.pronet.edu.vn% Include the router serial number in the subject name? [yes/no]: no% Include an IP address in the subject name? [no]: noRequest certificate from CA? [yes/no]: yes% Certificate request sent to Certificate Authority% The 'show crypto ca certificate ProNet verbose' commandwill show the fingerprint.
R1(config)#int s0/0R1(config-if)#cryR1(config-if)#crypto map mymapR1(config-if)#^ZR1#*Mar 1 00:10:01.227: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ONR1#
Trên R2:
R2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#crypto isakmp policy 1R2(config-isakmp)#en des R2(config-isakmp)#hash mR2(config-isakmp)#g 2R2(config-isakmp)#authentication rsa-sig R2(config-isakmp)#exit
R2(config)#ip access-list extended VPN_ACLR2(config-ext-nacl)#permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255R2(config-ext-nacl)#exit
R2(config)#crypto map mymap 1 ipsec-isakmp % NOTE: This new crypto map will remain disabled until a peer and a valid access list have been configured.R2(config-crypto-map)#set peer 101.0.0.1R2(config-crypto-map)#set transform-set setR2R2(config-crypto-map)#match address VPN_ACLR2(config-crypto-map)#^ZR2#R2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#int s0/0R2(config-if)#crypto map mymapR2(config-if)#^ZR2#Feb 6 16:15:33.439: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ONFeb 6 16:15:33.763: %SYS-5-CONFIG_I: Configured from console by consoleR2#
Kiểm tra liên lạc giữa LAN R1 và LAN R2:
R2#ping 192.168.1.1 source 192.168.2.1
Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:Packet sent with a source address of 192.168.2.1 !!!!!
!interface Tunnel0 ip address 10.0.0.1 255.255.255.0 tunnel source Serial0/0 tunnel destination 102.0.0.1!interface Loopback0 ip address 192.168.1.1 255.255.255.0!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 33
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
! interface Serial0/0 ip address 101.0.0.1 255.255.255.0 clock rate 2000000!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1 no ip address shutdown clock rate 2000000!router eigrp 1 network 10.0.0.0 network 192.168.1.0 auto-summary!ip route 0.0.0.0 0.0.0.0 Serial0/0!(bỏ qua)!end
Router R2:
R2#sho run!(bỏ qua)!interface Tunnel0 ip address 10.0.0.2 255.255.255.0 tunnel source Serial0/0 tunnel destination 101.0.0.1!interface Loopback0 ip address 192.168.2.1 255.255.255.0!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto! interface Serial0/0 ip address 102.0.0.1 255.255.255.0 clock rate 2000000!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 34
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
no ip address shutdown clock rate 2000000!router eigrp 1 network 10.0.0.0 network 192.168.2.0 auto-summary!ip route 0.0.0.0 0.0.0.0 Serial0/0!(bỏ qua)!end
Router ISP:
ISP#sho runBuilding configuration...!(bỏ qua)!interface FastEthernet0/0 no ip address shutdown duplex auto speed auto!interface Serial0/0 ip address 101.0.0.2 255.255.255.0 clock rate 64000!interface FastEthernet0/1 no ip address shutdown duplex auto speed auto!interface Serial0/1 ip address 102.0.0.2 255.255.255.0 clock rate 64000!(bỏ qua)!end
Tài liệu cấu hình IPSec VPN – Trịnh Thanh Sử 35
ISCW
Chương trình đạo tạo mạng chuyên nghiệp ProNet
5) Lab 5: GRE over IPSec
Các GRE tunnel như sau:R1 (192.168.1.1/24) ----- (192.168.1.2/24) R2R1 (192.168.2.1/24) ----- (192.168.2.2/24) R3