Vpn config-on-cisco-devices

37
I.VPN CONFIG ON CISCO ROUTER 1 Policy Base VPN Configuration on Cisco Router 1.1 Site-to-Site IPSEC VPN 1.1.1 Site-to-Site IPSEC-VPN with static IP

Transcript of Vpn config-on-cisco-devices

Page 1: Vpn config-on-cisco-devices

I.VPN CONFIG ON CISCO ROUTER 1 Policy Base VPN Configuration on Cisco Router1.1 Site-to-Site IPSEC VPN1.1.1 Site-to-Site IPSEC-VPN with static IP

-Bước 1: Cấu hình Interesting trafic:

Page 2: Vpn config-on-cisco-devices

R1(config)#ip access-list extended VPN-ACL

R1(config-ext-nacl)#permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

R2(config)#ip access-list extended VPN-ACL

R2(config-ext-nacl)#permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255

-Bước 2: Cấu hình loại bỏ các traffic sử dụng internet:

+R1:

R1(config)#ip access-list extended NAT-ACL

R1(config-ext-nacl)#deny ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 : loại bỏ traffic từ LAN1 đến LAN2 trong hoạt động của NAT

R1(config-ext-nacl)#permit ip 192.168.1.0 0.0.0.255 any : cho phep tat ca traffic khac tu LAN1 duoc NAT

Kích hoạt chức năng NAT trên port:

R1(config)#ip nat inside source list NAT-ACL interface fa0/0 overload

R1(config)#int fa0/0

R1(config-if)#ip nat outside

R1(config)#int fa0/1

R1(config-if)#ip nat inside

+R2: Làm tương tự như R1

-Bước 3: Cấu hình Phase 1(ISAKMP) : Để thiết lập 1 kênh sercure channel

+R1:

R1(config)#crypto isakmp policy 1 : tạo policy 1. Có thể có nhiều policyR1(config-isakmp)#encryption 3des(hoặc aes hoặc des)R1(config-isakmp)#hash md5(hoặc sha)R1(config-isakmp)#authentication pre-share : để xác thựcR1(config-isakmp)#group 2 (hoặc 5)R1(config-isakmp)#exitR1(config)# crypto isakmp key “secretkey” address “200.200.200.1” : định nghĩa 1 pre-shared key(“secretkey”) cho xác thực với remote peer IP 200.200.200.1

+R2: Làm tương tự như R1

Page 3: Vpn config-on-cisco-devices

-Bước 4: Cấu hình Phase 2(IPSec)Để mã hóa và xác thực mạnh ta dùng 1 trong 2 cặp sau:+ESP-3DES and ESP-MD5-HMAC+ESP-AES and ESP-SHA-HMAC

+R1:R1(config)#crypto ipsec transform-set “TRSET” esp-md5-hmac : cấu hình 1 transform set với 3des để mã hóa và MD5-HMAC để xác thựcR1(cfg-crypto-trans)# exitR1(config)#crypto map VPNMAP 10 ipsec-isakmpR1(config-crypto-map)# set peer 200.200.200.1R1(config-crypto-map)#set transform-set “TRSET”R1(config-crypto-map)# match address VPN-ACLR1(config-crypto-map)# exitGán crypto-map vào interface WAN: R1(config)# int fa0/0R1(config-if)# crypto map VPNMAP

+R2: Làm tương tự như R1

Note: Kiểm traR#show crypto isakmp sa : để kiểm tra thiết lập tunnelR#show crypto ipsec sa : để kiểm tra encrypted dữ liệu ở 2 đầu

1.1.2 IPSEC VPN Site-To-Site with dynamic IP

-Bước 1 & Bước 2 làm tương tự như mục 1.1: Cấu hình Interesting Traffic và loại bỏ traffic NAT

Page 4: Vpn config-on-cisco-devices

-Bước 3: Phase 1 Configuration

+R1:

R1(config)#crypto isakmp policy 1 : tạo policy 1. Có thể có nhiều policy

R1(config-isakmp)#encryption 3des(hoặc aes hoặc des)

R1(config-isakmp)#hash md5(hoặc sha)

R1(config-isakmp)#authentication pre-share : để xác thực

R1(config-isakmp)#group 2 (hoặc 5)

R1(config-isakmp)#exit

R1(config)# crypto isakmp key “secretkey” address 0.0.0.0 0.0.0.0 : định nghĩa 1 pre-shared key(“secretkey”) cho xác thực với remote peer IP

+R2: Config Phase 1 tương tự như cấu hình site-to-site

-Bước 4 : Cấu hình Phase 2:

R1(config)#crypto ipsec transform-set “TRSET” esp-md5-hmac : cấu hình 1 transform set với 3des để mã hóa và MD5-HMAC để xác thực

Page 5: Vpn config-on-cisco-devices

Đầu tiên tạo 1 dynamic crypto map(DYNMAP) trong đó có Transform Set và Crypto ACL:

R1(config)# crypto dynamic-map “DYNMAP” 10

R1(config-crypto-map)# set transform-set “TRSET”

R1(config-crypto-map)#match address “VPN-ACL”

R1(config-crypto-map)# exit

Tạo 1 static crypto map (VPNMAP) sử dụng dynamic map đã cấu hình trước đó

R1(config)# crypto map “VPNMAP” 10 ipsec-isakmp dynamic DYNMAP

Gán static crypto map (VPNMAP) vào cổng out WAN outside of router R1:

R1(config)# int fa0/0

R1(config-if)# crypto map “VPNMAP”

+R2: Cấu hình Phase 2 cho R2 tương tự như trong trường hợp Site-to-Site with static IP

Page 6: Vpn config-on-cisco-devices

1.2. HUB and SPOKE IPSEC VPN

-R1(HUB):

+Đầu tiên cấu hình xác định Interesting traffic:

R1(config)# ip access-list extended VPN-TO-REMOTE1

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

R1(config)# ip access-list extended VPN-TO-REMOTE2

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255

+Loại bỏ Interesting traffic trong NAT:

R1(config)# ip access-list extended NAT-ACL

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255

Page 7: Vpn config-on-cisco-devices

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 any

+ Cấu hình Phase 1 ISAKMP Parameters:

R1(config)# crypto isakmp policy 1

R1(config-isakmp)# encryption 3des

R1(config-isakmp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

R1(config-isakmp)# exit

+ Cấu hình 1 pre-share key khác nhau cho mỗi Spoke Site:

R1(config)# crypto isakmp key “secretkey1” address 30.30.30.2

R1(config)# crypto isakmp key “secretkey2” address 40.40.40.2

+ Cấu hình Phase 2 Transform-set and Crypto Map:

R1(config)# crypto ipsec transform-set “TRSET” esp-3des esp-md5-hmac

R1(cfg-crypto-trans)# exit

+ Tạo crypto cho mỗi Spoke :

R1(config)# crypto map “VPNMAP 10” ipsec-isakmp

R1(config-crypto-map)# set peer 30.30.30.2

R1(config-crypto-map)# set transform-set “TRSET”

R1(config-crypto-map)# match address VPN-TO-REMOTE1

R1(config-crypto-map)# exit

R1(config)# crypto map “VPNMAP 20” ipsec-isakmp

R1(config-crypto-map)# set peer 40.40.40.2

R1(config-crypto-map)# set transforms-set “TRSET”

R1(config-crypto-map)# match address VPN-TO-REMOTE2

R1(config-crypto-map)# exit

Page 8: Vpn config-on-cisco-devices

+ Gán crypto map vào interface WAN:

R1(config)# int fa0/0

R1(config-if)# crypto map VPNMAP

Note: R1 & R2 cấu hình tương tự như cấu hình R2 trong trường hợp Site-to-Site.

1.3 Remote Access IPSEC VPN

-Cấu hình trên Router R1:

+Bước 1: Cấu hình VPN POOL để gán IP cho remote access client:

R1(config)# ip local pool vpnpool “192.168.50.1 192.168.5.10”

+Bước 2: Cấu hình VPN Interesting Traffic and NAT Exemption:

Tạo access-list xác định traffic cho phép đi qua VPN

R1(config)# ip access-list extended “VPN-ACL”

R1(config-ext-nacl)# permit ip 192.168.1.0 .0.0.0.255 192.168.50.0 0.0.0.255

Page 9: Vpn config-on-cisco-devices

Loại bỏ interesting traffic va cho phep NAT traffic nao đi ra internet:

R1(config)# ip access-list extended NAT-ACL

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.50.0 0.0.0.255

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 any

Gán NAT vào interface fa0/0(inside) & interface fa0/1(outside):

R1(config)# ip nat inside source list NAT-ACL int fa0/1 overload

R1(config)# int fa0/1

R1(config-if)# ip nat outside

R1(config)#int fa0/0

R1(config-if)# ip nat inside

+Bước 3: Cấu hình xác thực user:

Tạo 1 username/password cho mỗi remote user:

R1(config)# username “vpnuser” password “strongpassword”

Sau đó kích hoạt cơ chế AAA trên router:

R1(config)# aaa new-model

Cấu hình đăng nhập & ủy quyền:

R1(config)# aaa authentication login “USERAUTH” local

R1(config)# aaa authorization network “NETAUTHORIZE” local

+ Bước 4: Cấu hình IPSEC Phase 1(isakmp parameters):

Đầu tiên cấu hình 1 isakmp policy tương tự như site-to-site IPSEC:

R1(config)# crypto isakmp policy 10

R1(config-isakmp)# encryption 3des

R1(config-isakmp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

Page 10: Vpn config-on-cisco-devices

Keyring : để lưu trữ pre-shared-keys.

Cấu hình 1 pre-shared key cho remote access VPN clients:

R1(config)# crypto keyring “vpnclientskey”

R1(config-keyring)# pre-shared-key address 0.0.0.0 0.0.0.0 key “cisco123”

Cấu hình policy and parameters cho Group of remote users sẽ kế thừa:

R1(config)# crypto isakmp client configuration group remotevpn <- Group name (see below)

R1(config-isakmp-group)# key cisco123 <- Group Password (see picture below)

R1(config-isakmp-group)# dns 192.168.1.2

R1(config-isakmp-group)# wins 192.168.1.2

R1(config-isakmp-group)# domain “mycompany.com”

R1(config-isakmp-group)# pool vpnpool <- IP address pool configured before

R1(config-isakmp-group)# acl VPN-ACL <- Split-Tunnel Access List

Note: - Câu lệnh “acl VPN-ACL” thiết lập chia nhỏ tunnel. Nghĩa là, traffic sẽ đi qua VPN tunnel chỉ nếu nó matches với access-list VPN-ACL. Nếu bạn remove ACL này thì tất cả traffic sẽ đi qua VPN tunnel (tức là không cho phép truy cập internet từ vị trí của remote user).

- Tên của Group cấu hình ở trên (remotevpn) and key (cisco123) phải được sử dụng trong “Group Authentication” (“Name”/”Password”) của phần mềm VPN client như hình dưới đây:

Page 11: Vpn config-on-cisco-devices

Cấu hình 1 isakmp profile:

R1(config)# crypto isakmp profile remoteclients

R1(config-isa-prof)# description “Remote Access VPN clients”

R1(config-isa-prof)# keyring “vpnclientskey” : cấu hình trước đó

R1(config-isa-prof)# match identity group “remotevpn” : cấu hình trước đó

R1(config-isa-prof)# client authentication list “USERAUTH” : cấu hình trước đó

R1(config-isa-prof)# isakmp authorization list “NETAUTHORIZE” : cấu hình trước đó

R1(config-isa-prof)# client configuration addres respond : Respond IP address request từ client.

+ Bước 5 : Cấu hình IPSEC Phase 2 (tương tự như trường hợp Site—to-Site with dynamic IP) :

Cấu hình Phase 2 Transform Set and Crypto Map (tương tự trường hợp site-to-site VPN):

R1(config)# crypto ipsec transform-set “TRSET” esp-3des esp-md5-hmac

R1(cfg-crypto-trans)# exit

Tạo 1 dynamic crypto map (DYNMAP) có Transform Set ở trên và isakmp profile (“remoteclients”) cấu hình trước đó :

R1(config)# crypto dynamic-map DYNMAP 10

Page 12: Vpn config-on-cisco-devices

R1(config-crypto-map)# set transform-set “TRSET” : sử dụng tranform-set có tên “TRSET” đã tạo trước đó

R1(config-crypto-map)# set isakmp-profile “remoteclients”

R1(config-crypto-map)# exit

Tạo 1 static crypto map (VPNMAP) sử dụng dynamic map cấu hình trước đó:

R1(config)# crypto map VPNMAP 10 ipsec-isakmp dynamic DYNMAP

Gán static crypto map (VPNMAP) vào int fa0/1 WAN outside của router :

R1(config)# int fa0/1

R1(config-if)# crypto map VPNMAP

1.4 Site-to-Site and Remote Access IPSEC VPN on same device

Page 13: Vpn config-on-cisco-devices

-Router R1 (HUB)

+Bước 1: Cấu hình VPN POOL để gán IP cho remote access client:

R1(config)# ip local pool vpnpool “192.168.50.1 192.168.5.10”

+ Bước 2 : Cấu hình Interesting Traffic and NAT Exemption:

Đầu tiên xác định Interesting Traffic để mã hóa. Có 3 crypto ACLs:

R1(config)# ip access-list extended VPNsite1-ACL

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

R1(config)# ip access-list extended VPNsite2-ACL

R1(config-ext-nacl)# permit ip 192.168.1.0 .0.0.255 192.168.3.0 0.0.0.255

R1(config)# ip access-list extended VPNclient-ACL

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0. 255 192.168.50.0 0.0.0.255

Loại bỏ Interesting traffic từ hoạt động của NAT:

R1(config)# ip access-list extended NAT-ACL

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255

R1(config-ext-nacl)# deny ip 192.168.1.0 0.0.0.255 192.168.50.0 0.0.0.255

R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 any

Gán NAT vào interface fa0/0(inside) & interface fa0/1(outside):

R1(config)# ip nat inside source list NAT-ACL int fa0/1 overload

R1(config)# int fa0/1

R1(config-if)# ip nat outside

R1(config)#int fa0/0

R1(config-if)# ip nat inside

+Bước 2: Cấu hình xác thực user:

Tạo 1 username/password cho mỗi remote user:

Page 14: Vpn config-on-cisco-devices

R1(config)# username “vpnuser” password “strongpassword”

Sau đó kích hoạt cơ chế AAA trên router:

R1(config)# aaa new-model

Cấu hình đăng nhập & ủy quyền:

R1(config)# aaa authentication login “USERAUTH” local

R1(config)# aaa authorization network “NETAUTHORIZE” local

+ Bước 3: Cấu hình Phase 1 IPSEC:

Cấu hình phase 1 isakmp policy:

R1(config)# crypto isakmp policy 10

R1(config-isakmp)# encryption 3des

R1(config-isamkp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

R1(config-isakmp)# exit

Cấu hình crypto keyring để lưu trữ pre-shared keys:

R1(config)# crypto keyring “vpnclientskey” : cho remote user

R1(conf-keyring)# pre-shared-key address 0.0.0.0 0.0.0.0 key “cisco123”

R1(conf-keyring)# exit

R1(config)# crypto keyring “staticbranch” : cho site with static IP

R1(conf-keyring)# pre-shared-key address 30.30.30.2 key “secretkey1” : nếu có nhiều site sử dụng static IP public thì thêm địa chỉ bởi câu lệnh này.

R1(conf-keyring)# exit

R1(config)# crypto keyring “dynamicbranch”

R1(conf-keyring)# pre-shared-key address 0.0.0.0 0.0.0.0 key “secretkey2”

R1(conf-keyring)# exit

Page 15: Vpn config-on-cisco-devices

Cấu hình policy and parameters cho Group of remote users sẽ kế thừa:

R1(config)# crypto isakmp client configuration group “remotevpn” <- Group name (see below)

R1(config-isakmp-group)# key “cisco123” <- Group Password (see picture below)

R1(config-isakmp-group)# dns 192.168.1.2

R1(config-isakmp-group)# wins 192.168.1.2

R1(config-isakmp-group)# domain “asahi-intecc.com”

R1(config-isakmp-group)# pool vpnpool <- IP address pool configured before

R1(config-isakmp-group)# acl VPNclient-ACL<- Split-Tunnel Access List

Cấu hình of ISAKMP Profiles.

R1(config)# crypto isakmp profile “staticL2L” : cho Branch với static IP public

R1(conf-isa-prof)# keyring “staticbranch” : “staticbranch” đã tạo trước đó

R1(conf-isa-prof)# match identity address 30.30.30.2 255.255.255.255 ->Router R2 static IP

R1(conf-isa-prof)# exit

R1(config)# crypto isakmp profile “dynamicL2L” : cho Branch với dynamic IP public

R1(conf-isa-prof)# keyring “dynamicbranch” : cấu hình trước đó

R1(conf-isa-prof)# match identity address 0.0.0.0 : Bất kỳ 1 Remote Branch nào đều truy cập được.

R1(config)# crypto isakmp profile “remoteclients” :cho Remote User

R1(conf-isa-prof)# keyring vpnclientskey

R1(conf-isa-prof)# match identity group remotevpn

R1(conf-isa-prof)# client authentication list USERAUTHEN

R1(conf-isa-prof)# isakmp authorization list NETAUTHORIZE

R1(conf-isa-prof)# client configuration address respond : trả lời yêu cầu IP từ remote user

Page 16: Vpn config-on-cisco-devices

+ Bước 4 : Cấu hình IPSEC Phase 2:

Cấu hình Transform Set and Crypto Map:

R1(config)# crypto ipsec transform-set “TRSET” esp-3des esp-md5-hmac

R1(cfg-crypto-trans)# exit

Cấu hình dynamic crypto map & static crypto map:

R1(config)# crypto dynamic-map DYNMAP 10

R1(config-crypto-map)# set transform-set “TRSET”

R1(config-crypto-map)# set isakmp-profile “remoteclients” : Attach isakmp profile of VPN

clients configured before

R1(config-crypto-map)# exit

R1(config)# crypto dynamic-map DYNMAP 20

R1(config-crypto-map)# set transform-set “TRSET”

R1(config-crypto-map)# set isakmp-profile “dynamicL2L” : attach isakmp profile of dynamic IP branch configured before

R1(config-crypto-map)# match address VPNsite2-ACL

R1(config-crypto-map)# exit

R1(config)# crypto map VPNMAP 10 ipsec-isakmp : This is the static tunnel crypto map

R1(config-crypto-map)# set peer 30.30.30.2

R1(config-crypto-map)# set transform-set “TRSET”

R1(config-crypto-map)# set isakmp-profile “staticL2L” : Attach isakmp profile of static IP branch configured before

R1(config-crypto-map)# match address VPNsite1-ACL

R1(config-crypto-map)# exit

Page 17: Vpn config-on-cisco-devices

R1(config)# crypto map VPNMAP 20 ipsec-isakmp dynamic DYNMAP : Attach the dynamic crypto map on a new entry of the static crypto map

Attach the static crypto map VPNMAP to the WAN outside finterface(fa0/1) of the Hub router:

R1(config)# int fa0/1

R1(config-if)# crypto map VPNMAP

Những điểm cần nhớ:

-Tạo 1 keyring cho mỗi loại VPN tunnel(static IP branch, dynamic IP branch, VPN clients).

-Gán mỗi keyring cho 1 “isakmp profile” tương ứng

-Tạo một dynamic crypto map với 2 entries. Trên 1 entry gán “isakmp profile” cho dynamic Lan-to-Lan tunnel và trên entry khác gán “isakmp profile” cho remote clients tunnel.

-Tạo 1 static crypto map với 2 entries. Trên 1 entry gán cho “isakmp profile” của static Lan-to-Lan tunnel, và trên entry tiếp theo gán dynamic crypto map.

2. Route Base VPN Configuration On Cisco Router2.1 Site-to-Site VPN Using GRE with IPSEC Protection

- Bước 1: Cấu hình GRE Tunnel:Router R1:

Page 18: Vpn config-on-cisco-devices

R1(config)# int Tunnel 0R1(config-if)# ip address 10.0.0.1 255.255.255.0R1(config-if)# tunnel source 20.20.20.2R1(config-if)# tunnel destination 30.30.30.2R1(config-if)# exit

Router R2:R2(config)# int Tunnel 0R2(config-if)# ip address 10.0.0.2 255.255.255.0R2(config-if)# tunnel source 30.30.30.2R2(config-if)# tunnel destination 20.20.20.2 R2(config-if)# exit

-Bước 2: Cấu hình định tuyến giữa 2 đầu VPN Tunnel

Có thể sử dụng dynamic routing(khi đó ta network dải mạng của tunnel) hoặc static routing

-Bước 3: Cấu hình IPSEC Phase 1:

Router R1:

R1(config)# crypto isakmp policy 10

R1(config-isakmp)# encryption 3des

R1(config-isakmp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

R1(config-isakmp)# exit

R1(config)# crypto isakmp key “testkey123” address 30.30.30.2

Router R2:

R2(config)# crypto isakmp policy 10

R2(config-isakmp# encryption 3des

R2(config-isakmp)# hash md5

Page 19: Vpn config-on-cisco-devices

R2(config-isakmp)# authenication pre-share

R2(config-isakmp)# group 2

R2(config-isakmp)# exit

R2(config)# crypto isakmp key “testkey123” address 20.20.20.2

-Bước 4: Cấu hình IPSEC Phase 2 (IPSEC Profile):

Router R1:

R1(config)# crypto ipsec transform-set “TRSET” esp-3des esp-md5-hmac : Transform-set này định nghĩa giao thức mã hóa và xác thực của IPSEC.

R1(cfg-crypto-trans)# exit

R1(config)# crypto ipsec profile “GRE-PROTECTION” : Đây là ipsec profile sẽ sử dụng để bảo vệ GRE Tunnel.

R1(ipsec-profile)# set transform-set “TRSET” : Gán transform-set đã cấu hình ở trên

R1(ipsec-profile)# exit

Router R2:

R2(config)# crypto ipsec transform-set “TRSET” esp-3des esp-md5-hmac : Transform-set này định nghĩa giao thức mã hóa và xác thực của IPSEC.

R2(cfg-crypto-trans)# exit

R2(config)# crypto ipsec profile “GRE-PROTECTION” : Đây là ipsec profile sẽ sử dụng để bảo vệ GRE Tunnel.

R2(ipsec-profile)# set transform-set “TRSET” : Gán transform-set đã cấu hình ở trên

R2(ipsec-profile)# exit

-Bước 5: Attach IPSEC Protection profile to GRE Tunnel

Router R1:

Page 20: Vpn config-on-cisco-devices

R1(config)# int Tunnel 0

R1(config-if)# tunnel protection ipsec profile GRE-PROTECTION : Gắn IPSEC Profile cấu hình trước đó để bảo vệ cho GRE tunnel.

Router R2:

R2(config)# int Tunnel 0

R2(config-if)# tunnel protection ipsec profile GRE-PROTECTION

2.2 Hub-and-Spoke VPN Using with GRE IPSEC ProtectionCấu hình tương tự như Site-to-Site GRE with IPSEC Protection. Router HUB cấu hình mỗi tunnel riêng tương ứng với 1 Spoke, điều này không hợp lý trong một mạng lớn. GRE VPN yêu cầu tất cả các site đều phải có static IP Public.

Page 21: Vpn config-on-cisco-devices

-Bước 1: Cấu hình GRE Tunnels:

Router R1:

R1(config)# interface Tunnel0 : GRE Tunnel for Site-to-Site VPN with R2

R1(config-if)# ip address 10.0.0.1 255.255.255.0 : Đặt IP cho tunnel

R1(config-if)# tunnel source 20.20.20.2 : IP public of port WAN

R1(config-if)# tunnel destination 30.30.30.2 : IP public of R2

R1(config-if)# exit

R1(config)# interface Tunnel1 : GRE tunnel for site-to-site VPN with R3

R1(config-if)# ip address 10.1.1.1 255.255.255.0

R1(config-if)# tunnel source 20.20.20.2

R1(config-if)# tunnel destination 40.40.40.2

R1(config-if)# exit

-Bước 2: Cấu hình định tuyến giữa các tunnel và IP LAN

-Bước 3: Cấu hình IPSEC Phase 1:

Router Hub :R1

R1(config)# cypto isakmp policy 10

R1(config-isakmp)# encryption 3des

R1(config-isakmp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

R1(config-isakmp)# exit

Tạo 2 pre-share key cho mỗi Spoke Branch Router:

R1(config)# crypto isakmp key “testkey123” address 30.30.30.2

R1(config)# crypto isakmp key “testkey1234” address 40.40.40.2

Page 22: Vpn config-on-cisco-devices

-Bước 4: Cấu hình IPSEC Phase 2 (ipsec profile):

Router R1:

R1(config)# crypto transform-set “TRSET” esp-3des esp-md5-hmac

R1(cfg-crypto-trans)#exit

R1(config)# crypto ipsec profile “GRE-PROTECTION”

R1(config)# set transform-set “TRSET”

R1(config-profile)# exit

-Bước 5: Gán IPSEC Protection profile to GRE Tunnels

Router R1:

R1(config)#interface Tunnel0

R1(config-if)# tunnel protection ipsec profile “GRE-PROTECTION”

R1(config)# interface Tunnel1

R1(config-if)# tunnel protection ipsec profile “GRE-PROTECTION”

Note: R2 và R3 cấu hình tương tự như trong trường hợp Site-to-Site GRE with IPSEC Protection.

Page 23: Vpn config-on-cisco-devices

2.3 Dynamic Multipoint VPN (DMVPN)

Config trên các Spoke tương tự nhau, dưới đây ta chỉ cấu hình Spoke R3.

-Bước 1 : Cấu hình Multipoint GRE Tunnel:

+Router R1 (HUB):

R1(config)# interface fa0/1 : Public WAN interface on Hub router

R1(config-if)# ip address 20.20.20.2 255.255.255.0 : Đặt ip public cho port WAN

R1(config-if)# exit

R1(config)# int Tunnel : mGRE interface

R1(config-if)# ip add 10.0.0.1 255.255.255.0 : IP address of Tunnel

R1(config-if)# tunnel source fa0/1 : Source of Tunnel is the WAN interface

R1(config-if)# tunnel mode gre multipoint : Set tunnel mode as mGRE

Page 24: Vpn config-on-cisco-devices

R1(config-if)# ip mtu 1440 : Reduce the MTU to allow extra overhead from mGRE and IPSEC

+Router Spoke : 2 Spoke config tương tự nhau

R3(config)# int fa0/1 : public WAN interface on Spoke Router.

R3(config-if)# ip address dhcp : R3 sử dụng dynamic ip public

R3(config-if)# exit

R3(config)# int Tunnel0 : This is the mGRE interface

R3(config-if)# ip address 10.0.0.3 255.255.255.0 : IP of Tunnel cùng subnet với ip tunnel of HUB

R3(config-if)#tunnel source fa0/1 : source của tunnel là cổng WAN

R3(config-if)# tunnel mode gre multipoint : Set the tunnel mode as mGRE

R3(config-if)# ip mtu 1440 : Reduce the MTU to allow extra overhead from mGRE and IPSEC

-Bước 2 : Cấu hình Next Hop Resolution Protocol (NHRP) :

Router R1 (HUB):

Note : Địa chỉ của NHRP Server (NHS) luôn luôn là địa chỉa của Tunnel Interface of Hub.

R1(config)# int Tunnel0

R1(config-if)# ip nhrp authentication “NHRPkey” : Key để xác thực clients.

R1(config-if)# ip nhrp map multicast dynamic : Enable forwarding of multicast traffic across the tunnel.

R1(config-if)# ip nhrp network-id “100” : Indentifies the DMVPN cloud. Tất cả router phải có network-id giống nhau.

R1(config-if)# tunnel key “100” : Có thể có hoặc ko. Chỉ từ IOS 12.3 trở lên mới có option này

Page 25: Vpn config-on-cisco-devices

SPOKE (ROUTER R3) :

R3(config)# interface Tunnel0 : Get back into the Tunnel Interface

R3(config-if)# ip nhrp authentication “NHRPkey” : Secret key for authenticating with Hub

R3(config-if)# ip nhrp map multicast dynamic : Enables forwarding of multicast traffic

across the tunnel.

R3(config-if)# ip nhrp network-id 100 : Identifies the DMVPN cloud. All routers must have

the same network ID.

R3(config-if)# tunnel key 100 : OPTIONAL. Needed only on older IOS versions such as 12.3

R3(config-if)# ip nhrp map 10.0.0.1 20.20.20.2 : Map the NHS address (10.0.0.1 on Hub)

with the Hub’s WAN public IP (20.20.20.2)

R3(config-if)# ip nhrp map multicast 20.20.20.2 : Send multicast traffic to the Hub only. Hub

will receive all multicast traffic (e.g routing protocol updates) and then send out updates to

all the Spoke routers.

R3(config-if)# ip nhrp nhs 10.0.0.1 : Specify the NHS IP (this is always the private IP of the

Tunnel Interface on Hub router)

R3(config-if)# exit

-Bước 3: Cấu hình giao thức định tuyến động (Dynamic Routing):

Nhớ quảng bá dải IP của tunnel

Nếu sử dụng EIGRP thì phải disable split-horizon như sau:

HUB :

R1(config)# router eigrp 90 Create an EIGRP instance with Autonomous System 90

R1(config-router)# no auto-summary Disable automatic summarization of subnets

R1(config-router)# network 10.0.0.0 0.0.0.255 DMVPN Tunnel Interface Subnet

R1(config-router)# network 192.168.1.0 0.0.0.255 Hub LAN subnet

R1(config-router)# exit

Page 26: Vpn config-on-cisco-devices

R1(config)# interface Tunnel0 Get back into the Tunnel Interface

R1(config-if)# no ip split-horizon eigrp 90 Disable Split Horizon

R1(config-if)# no ip next-hop-self eigrp 90 Disable next hop self

R1(config-if)# no ip redirects Useful to have

R1(config-if)# exit

Spoke (Router R3):

R3(config)# router eigrp 90Create an EIGRP instance with Autonomous System 90

R3(config-router)# no auto-summaryDisable automatic summarization of subnets

R3(config-router)# network 10.0.0.0 0.0.0.255DMVPN Tunnel Interface Subnet

R3(config-router)# network 192.168.3.0 0.0.0.255LAN subnet

R3(config-router)# exit

R3(config)# interface Tunnel0Get back into the Tunnel Interface

R3(config-if)# no ip split-horizon eigrp 90Disable Split Horizon

R3(config-if)# no ip next-hop-self eigrp 90Disable next hop self

R3(config-if)# no ip redirects Useful to have

R1(config-if)# exit

Bước 4: Cấu hình IPSEC PROTECTION:

Router-1 (HUB):

R1(config)# crypto isakmp policy 10

R1(config-isakmp)# encryption 3des

R1(config-isakmp)# hash md5

R1(config-isakmp)# authentication pre-share

R1(config-isakmp)# group 2

R1(config-isakmp)# exit

R1(config)# crypto isakmp key strongsecretkey address 0.0.0.0 0.0.0.0

Page 27: Vpn config-on-cisco-devices

R1(config)# crypto ipsec transform-set TRSET esp-3des esp-sha-hmac

R1(cfg-crypto-trans)# exit

R1(config)# crypto ipsec profile PROTECT-DMVPN

R1(ipsec-profile)# set transform-set TRSET

R1(ipsec-profile)# exit

R1(config)# interface Tunnel0

R1(config-if)# tunnel protection ipsec profile PROTECT-DMVPN

Router-3 (SPOKE):

R3(config)# crypto isakmp policy 10

R3(config-isakmp)# encryption 3des

R3(config-isakmp)# hash md5

R3(config-isakmp)# authentication pre-share

R3(config-isakmp)# group 2

R3(config-isakmp)# exit

R3(config)# crypto isakmp key strongsecretkey address 0.0.0.0 0.0.0.0 Spoke routers must

allow also connections from any IP in order to form IPSEC VPN tunnels with other Spokes.

R3(config)# crypto ipsec transform-set TRSET esp-3des esp-sha-hmac

R3(cfg-crypto-trans)# exit

R3(config)# crypto ipsec profile PROTECT-DMVPN

R3(ipsec-profile)# set transform-set TRSET

R3(ipsec-profile)# exit

R3(config)# interface Tunnel0

R3(config-if)# tunnel protection ipsec profile PROTECT-DMVPN

Page 28: Vpn config-on-cisco-devices