Cấu hình FLEX VPN dễ hiểu

Cấu hình FLEX VPN

Mô hình

Vì sao flex vpn ra đời:

TẠI SAO FLEXVPN RA ĐỜI?

Vấn đề trước đây:

Trước đây mô hình HQ và các chi nhánh (HUB and SPOKE) mà dùng VPN thì mỗi khi có chi nhánh mới thì trên HQ sẽ cần config lại một lần. Nếu có nhiều site thì quản trị khá thủ công và dễ sai sót.

FlexVPN ra đời giải quyết:

FlexVPN cho phép chỉ cần cấu hình MỘT LẦN DUY NHẤT ở HQ. Sau đó mỗi chi nhánh lắp thêm router mới thì chỉ cần khai báo tại chi nhánh đó, HQ sẽ tự động kết nối với branch mới này mà không cần sửa gì thêm.

Công nghệ:

FlexVPN sử dụng giao thức IKEv2 (Internet Key Exchange version 2) để thiết lập kết nối VPN, bảo mật hơn nhiều so với IKEv1 cũ (google để so sánh, đa số ae mình làm thì có mẫu config chuẩn là được )

Các bước CẤU HÌNH TRÊN HUB:

===========Chuẩn bị bộ tham số mã hoá  ===============

crypto ikev2 proposal FLEXVPN_PROPOSAL

 encryption aes-cbc-256

 integrity sha256

 group 14

=============Cho bộ tham số vào policy ===============

crypto ikev2 policy FLEXVPN_POLICY

 proposal FLEXVPN_PROPOSAL

=============Dùng pre-share-key cisco123=======

crypto ikev2 keyring FLEXVPN_KEYRING

 peer ANY_SPOKE

  address 0.0.0.0 0.0.0.0

  pre-shared-key local cisco123

  pre-shared-key remote cisco123

==============Tạo profile IKEv2===============

crypto ikev2 profile IKEV2_PROFILE

 match identity remote fqdn domain FLEXVPN.LAB ###Chỉ cần domain khớp với đầu SPOKE gửi lên là dc

 identity local fqdn HUB.FLEXVPN.LAB ###Dùng tên để giao tiếp bắt tay với SPOKE

 authentication remote pre-share

 authentication local pre-share

 keyring local FLEXVPN_KEYRING

 aaa authorization group psk list FLEXVPN_AUTH  SPOKE_POLICY

 virtual-template 1

==============Tạo profile IPSEC===============

crypto ipsec profile IPSEC_PROFILE

 set ikev2-profile IKEV2_PROFILE ###Nhét profile IKEv2 ở trên vào đây

==========Tạo interface tunnel VPN (giống kiểu vpn route-based)======

interface Virtual-Template1 type tunnel

 ip unnumbered Loopback0

 tunnel source Ethernet0/0

 tunnel mode ipsec ipv4

 tunnel protection ipsec profile IPSEC_PROFILE

============== Cấp IP tunnel tự động cho SPOKE sau khi bắt tay xong===============

aaa new-model

aaa authorization network FLEXVPN_AUTH local

ip local pool FLEX_POOL 172.16.0.2 172.16.0.254

crypto ikev2 authorization policy SPOKE_POLICY

 pool FLEX_POOL

 route set interface

***Nghĩa là nếu đúng SPOKE gửi lên bắt tay xong, thì sẽ cấp cho SPOKE dải IP 172.16.0.0/24 và dữ liệu mã hoá sẽ đi qua tunnel VPN***

Các bước CẤU HÌNH TRÊN SPOKE:

aaa new-model

aaa authorization network FLEXVPN_AUTH local

!

crypto ikev2 authorization policy SPOKE_POLICY

 route set interface

 route set access-list SPOKE_TRAFFIC ###xác thực xong thì sẽ quảng bá dải LAN lên HUB##

!

ip access-list standard SPOKE_TRAFFIC

 permit 2.2.2.2 0.0.0.0 ##dải LAN của SPOKE##

!

crypto ikev2 proposal FLEXVPN_PROPOSAL

 encryption aes-cbc-256

 integrity sha256

 group 14

!

crypto ikev2 policy FLEXVPN_POLICY

 proposal FLEXVPN_PROPOSAL

!

crypto ikev2 keyring IKEV2_KEYRING

 peer HUB

  address 10.1.4.1

  pre-shared-key local cisco123

  pre-shared-key remote cisco123

 !

crypto ikev2 profile IKEV2_PROFILE

 match identity remote fqdn HUB.FLEXVPN.LAB

 identity local fqdn SPOKE2.FLEXVPN.LAB

 authentication remote pre-share

 authentication local pre-share

 keyring local IKEV2_KEYRING

 aaa authorization group psk list FLEXVPN_AUTH SPOKE_POLICY

!

crypto ipsec profile IPSEC_PROFILE

 set ikev2-profile IKEV2_PROFILE

!

!

interface Tunnel0

 ip address negotiated

 tunnel source Ethernet0/0

 tunnel mode ipsec ipv4

 tunnel destination 10.1.4.1 ##IP WAN của HUB

 tunnel protection ipsec profile IPSEC_PROFILE

VERIFY:

show crypto session thấy UP

Ping thử ip tunnel 2 bên cho nhau

show ip route ở HUB thấy có học dc LAN của SPOKE

Nếu sau khi bắt tay mới quảng bá LAN thêm thì cần clear crypto session cho quảng bá lại

 

Bài viết cùng danh mục