Cấu Hình VPN Client To Site (Remote Access VPN) - Bài Viết Sưu Tầm

Cấu hình VPN Client to Site (Remote Access VPN)

Mô hình:

Ở đây ta sử dụng laptop VPN Client sử dụng wireless bên ngoài Internet có thể kết nối VPN về hệ thống mạng nội bộ ở trụ sở (HQ). Để giả lập môi trường Internet ta sử dụng Router ISP giả lập router ISP.

Cấu hình cơ bản:

Wireless Access Point:

 

Cấu hình cho Laptop0:

 

Router ISP:

hostname ISP ! interface FastEthernet0/0 ip address 192.168.10.1 255.255.255.0

! interface FastEthernet0/1 ip address 203.162.1.1 255.255.255.252 !

ip dhcp excluded-address 192.168.10.1 192.168.10.10

!

ip dhcp pool vpnclient

 network 192.168.10.0 255.255.255.0

 default-router 192.168.10.1

 dns-server 8.8.8.8

!

Router HQ:

hostname HQ ! interface FastEthernet0/0 ip address 172.16.1.1 255.255.255.0 ! interface FastEthernet0/1 ip address 203.162.1.2 255.255.255.252

 crypto map mymap ! ip route 0.0.0.0 0.0.0.0 FastEthernet0/1  Cấu hình VPN client-to-site trên router HQ:

1. Bật chứng thực AAA trên Router HQ sử dụng phương thức chứng thực local

HQ(config)# username cisco password cisco  HQ(config)# aaa new-model  HQ(config)# aaa authentication login default local none

2. Tạo IP pool cho VPN client sử dụng để kết nối VPN:

HQ(config)# ip local pool VPNCLIENTS 172.16.1.10 172.16.1.20

3. Cấu hình Group Authorization (nhóm thẩm định với VPN Server):

HQ(config)# aaa authorization network VPNAUTH local

4. Tạo 1 IKE Policy và Group (sử dụng pre-share key và dùng AES để mã hóa với 256 bit)

HQ(config)# crypto isakmp policy 10  HQ(config-isakmp)# authentication pre-share  HQ(config-isakmp)# encryption aes 256  HQ(config-isakmp)# group 2

5. Tạo ISAKMP group là ttggroup và password 123:

HQ(config)# crypto isakmp client configuration group ttggroup HQ(config-isakmp-group)# key 123  HQ(config-isakmp-group)# pool VPNCLIENTS  HQ(config-isakmp-group)# netmask 255.255.255.0

 

6. Cấu hình IPSec Transform sử dụng thuật toán mã hóa 3DES và SHA-HMAC để đảm bảo tính toàn vẹn dữ liệu:

HQ(config)# crypto ipsec transform-set mytrans esp-3des esp-sha-hmac

7. Tạo 1 Dynamic Crypto Map:

HQ(config)# crypto dynamic-map mymap 10  HQ(config-crypto-map)# set transform-set mytrans  HQ(config-crypto-map)# reverse-route HQ(config)# crypto map mymap client configuration address respond  HQ(config)# crypto map mymap isakmp authorization list VPNAUTH  HQ(config)# crypto map mymap 10 ipsec-isakmp dynamic mymap  

8. Cấu hình user chứng thực

HQ(config)# aaa authentication login VPNAUTH local  HQ(config)# username quang password 123 HQ(config)# crypto map mymap client authentication list VPNAUTH

9. Cài đặt VPN Client

 

GroupName: ttggroup

Group Key: 123

Host IP (Server IP):203.162.1.2

Username: cisco

Password: cisco

Thế này là kết nối thành công:

 

Tiến hành ping từ VPN Client đến Server 0:

 

Lưu ý: Nếu sử dụng thiết bị thật thì có thể dùng phần mềm cisco VPN Client.

 

Kiểm tra hoạt động VPN:

Code:

HQ# show crypto isakmp sa IPv4 Crypto ISAKMP SA dst src state conn-id slot status 192.168.10.11 203.162.1.2 QM_IDLE 1070 0 ACTIVE IPv6 Crypto ISAKMP SA HQ#

Code:

HQ# show crypto ipsec sa interface: FastEthernet0/1 Crypto map tag: mymap, local addr 203.162.1.2 protected vrf: (none) local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0) remote ident (addr/mask/prot/port): (172.16.1.12/255.255.255.255/0/0) current_peer 192.168.10.11 port 500 PERMIT, flags={origin_is_acl,} #pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0 #pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0 #pkts compressed: 0, #pkts decompressed: 0 #pkts not compressed: 0, #pkts compr. failed: 0 #pkts not decompressed: 0, #pkts decompress failed: 0 #send errors 0, #recv errors 0 local crypto endpt.: 203.162.1.2, remote crypto endpt.:192.168.10.11 path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/1 current outbound spi: 0x1F2703F6(522650614) inbound esp sas: spi: 0x35592B74(895036276) transform: esp-3des esp-sha-hmac , in use settings ={Tunnel, } conn id: 2006, flow_id: FPGA:1, crypto map: mymap sa timing: remaining key lifetime (k/sec): (4525504/1521) IV size: 16 bytes replay detection support: N Status: ACTIVE inbound ah sas: inbound pcp sas: outbound esp sas: spi: 0x1F2703F6(522650614) transform: esp-3des esp-sha-hmac , in use settings ={Tunnel, } conn id: 2007, flow_id: FPGA:1, crypto map: mymap sa timing: remaining key lifetime (k/sec): (4525504/1521) IV size: 16 bytes replay detection support: N Status: ACTIVE outbound ah sas: outbound pcp sas: HQ#

 

 

Cấu hình running:

HQ#show running-config 

Building configuration...

Current configuration : 1458 bytes

!

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname HQ

!

!

!

!

!

!

!

aaa new-model

!

aaa authentication login VPNAUTH local 

aaa authentication login default local none 

!

!

aaa authorization network VPNAUTH local

!

!

!

!

!

ip cef

no ipv6 cef

!

!

!

username cisco password 0 cisco

username quang password 0 123

!

!

crypto isakmp policy 10

encr aes 256

authentication pre-share

group 2

!

!

!

crypto isakmp client configuration group ttggroup

key 123

pool VPNCLIENTS

netmask 255.255.255.0

!

!

crypto ipsec transform-set mytrans esp-3des esp-sha-hmac

!

crypto dynamic-map mymap 10

set transform-set mytrans 

reverse-route

!

crypto map mymap client authentication list VPNAUTH

crypto map mymap isakmp authorization list VPNAUTH

crypto map mymap client configuration address respond

crypto map mymap 10 ipsec-isakmp dynamic mymap

!

!

!

!

!

!

spanning-tree mode pvst

!

!

!

!

!

!

interface FastEthernet0/0

 ip address 172.16.1.1 255.255.255.0

 duplex auto

 speed auto

!

interface FastEthernet0/1

 ip address 203.162.1.2 255.255.255.252

 duplex auto

 speed auto

 crypto map mymap

!

interface Vlan1

 no ip address

 shutdown

!

ip local pool VPNCLIENTS 172.16.1.10 172.16.1.20

ip classless

ip route 0.0.0.0 0.0.0.0 FastEthernet0/1 

!

ip flow-export version 9

!

!

access-list 100 permit ip 172.16.1.0 0.0.0.255 any

!

line con 0

!

line aux 0

!

line vty 0 4

!

!

!

end

HQ#

 

ISP#sh running-config 

Building configuration...

Current configuration : 737 bytes

!

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname ISP

!

!

!

!

ip dhcp excluded-address 192.168.10.1 192.168.10.10

!

ip dhcp pool vpnclient

network 192.168.10.0 255.255.255.0

default-router 192.168.10.1

dns-server 8.8.8.8

!

!

!

ip cef

no ipv6 cef

!

!

!

!

!

!

!

!

!

!

!

!

spanning-tree mode pvst

!

!

!

!

!

!

interface FastEthernet0/0

ip address 192.168.10.1 255.255.255.0

duplex auto

speed auto

!

interface FastEthernet0/1

ip address 203.162.1.1 255.255.255.252

duplex auto

speed auto

!

interface Vlan1

no ip address

shutdown

!

ip classless

!

ip flow-export version 9

!

!

!

!

!

!

!

line con 0

!

line aux 0

!

line vty 0 4

login

!

!

!

end

ISP#

 

Từ khóa » Cấu Hình Vpn Client To Site Trên Router Cisco