• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

Iscw – vpn site to site ( cli )

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Iscw – vpn site to site ( cli )




    Mục tiêu :

    Xây dựng kết nối VPN site to site giữa chi nhánh Saigon1 và trung tâm Center. Những router Center và Saigon1 sử dụng IOS có hỗ trợ tính năng VPN. Các router Center và Saigon1 sử dụng các địa chỉ thực (do ISP cấp) cố định để thực hiện kết nối VPN. Kết quả yêu cầu là khi PC trong LAN của Saigon1 có nhu cầu đi vào LAN của Center thì sẽ sử dụng đường kết nối VPN, các nhu cầu đi ra Internet sẽ được NAT overload qua địa chỉ của cổng trên Saigon1.

    A) Cấu hình ban đầu


    Tiến hành đấu nối cab như hình vẽ và đặt địa chỉ ban đầu cho hệ thống:



    Saigon1#sh run

    Building configuration...



    Current configuration : 1310 bytes

    !

    version 12.3

    !

    hostname Saigon1

    !

    ip subnet-zero

    ip cef

    !

    interface Ethernet0/0

    ip address 173.1.1.1 255.255.255.0

    half-duplex

    !

    interface Serial0/0

    ip address 193.1.1.1 255.255.255.0

    clock rate 64000

    no fair-queue

    !

    ip http server

    ip classless

    ip route 0.0.0.0 0.0.0.0 Serial0/0

    !

    line con 0

    line aux 0

    line vty 0 4

    !

    End



    Center#

    Center#sh run

    Building configuration...



    Current configuration : 1186 bytes

    !

    version 12.3

    !

    hostname Center

    !

    ip subnet-zero

    ip cef

    !

    ip audit po max-events 100

    !

    interface FastEthernet0/0

    ip address 172.1.1.1 255.255.255.0

    duplex auto

    speed auto

    !

    interface Serial0/0

    ip address 192.1.1.1 255.255.255.0

    clock rate 64000

    no fair-queue

    !

    ip http server

    no ip http secure-server

    ip classless

    ip route 193.1.1.0 255.255.255.0 192.1.1.2

    !

    line con 0

    line aux 0

    line vty 0 4

    !

    End



    ISP#sh run

    Building configuration...



    Current configuration : 1220 bytes

    !

    version 12.2

    !

    hostname ISP

    !

    logging queue-limit 100

    !

    ip subnet-zero

    !

    no ip domain lookup

    !

    interface Loopback0

    ip address 100.100.100.100 255.255.255.0

    !

    interface Serial0/0

    ip address 192.1.1.2 255.255.255.0

    !

    interface Serial0/1

    ip address 193.1.1.2 255.255.255.0

    ip http server

    ip classless

    !

    !

    line con 0

    line aux 0

    line vty 0 4

    !

    End



    Tiến hành kiểm tra kết nối giữa 2 router Center và Saigon1:



    Saigon1#ping 192.1.1.1

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/30/32 ms



    B) Cấu hình VPN giữa 2 site




    Cấu hình VPN trên Center và Saigon1:



    1) Cấu hình pha 1 cho Center và Saigon1:



    Center(config)#crypto isakmp policy 1

    Center(config-isakmp)#encryption aes ß dùng kiểu mã hóa là aes

    Center(config-isakmp)#authentication pre-share ß kiểu xác thực giữa các bên

    Center(config-isakmp)#group 2 ßdùng giải thuật Diffe-Hellman group 2 để xây dựng kênh truyền thông tin bảo mật ban đầu



    Chú ý các thông số này phải giống nhau giữa 2 bên chủ thể kết nối VPN.



    Tương tự cấu hình pha 1 cho Saigon1:

    Saigon1(config)#crypto isakmp policy 1

    Saigon1(config-isakmp)#encryption aes

    Saigon1(config-isakmp)#authentication pre-share

    Saigon1(config-isakmp)#group 2









    1.1) Cấu hình thông tin dùng để xác thực giữa 2 bên tham gia kết nối VPN



    Center(config)#crypto isakmp key cisco address 193.1.1.1 255.255.255.255

    Saigon1(config)# crypto isakmp key cisco address 192.1.1.1 255.255.255.255



    2) Cấu hình pha 2 cho hệ thống:



    2.1) Xây dựng Transform set cho 2 thiết bị Center và Saigon1:



    Thông tin transform set dùng để định nghĩa cách thức sử dụng VPN cho 2 bên (giải thuật mã hóa dữ liệu, có sử dụng xác thực nguồn gốc sinh ra dữ liệu hay không) và yêu cầu giống nhau trên 2 bên tham gia kết nối.



    Center(config)# crypto ipsec transform-set MYSET esp-3des esp-sha-hmac

    Center(cfg-crypto-trans)# mode tunnel ß có thể chọn mode tunnel hoặc transport tùy theo nhu cầu sử dụng, mặc định là tunnel



    Saigon1(config)# crypto ipsec transform-set MYSET esp-3des esp-sha-hmac

    Saigon1(cfg-crypto-trans)# mode tunnel



    Sử dụng giao thức esp cho VPN, mã hóa dữ liệu bằng thuật toán 3des , dùng giải thuật hash sha cho việc xác thực nguồn gốc dữ liệu. Chú ý MYSET chỉ là tên đặt và có thể khác nhau ở 2 bên



    2.2) Xây dựng cryto map:



    Xây dựng crypto map trên Center:



    Center(config)#crypto map MYMAP 1 ipsec-isakmp

    Center(config-crypto-map)# match address 100

    Center(config-crypto-map)# set peer 193.1.1.1

    Center(config-crypto-map)# set transform-set MYSET

    Center(config-crypto-map)# reverse-route ß router sẽ tự động sinh ra thông tin định tuyến cho đường đi tương ứng





    Center(config)# access-list 100 permit ip 172.1.1.0 0.0.0.255 173.1.1.0 0.0.0.255

    ßđặc tả dữ liệu sẽ được bảo vệ bởi kết nối VPN



    Xây dựng crypto map trên Saigon1:



    Saigon1(config)#crypto map MYMAP 1 ipsec-isakmp

    Saigon1(config-crypto-map)# match address 100

    Saigon1(config-crypto-map)# set peer 193.1.1.1

    Saigon1(config-crypto-map)# set transform-set MYSET

    Saigon1(config-crypto-map)# reverse-route ß router sẽ tự động sinh ra thông tin định tuyến cho đường đi tương ứng



    Saigon1(config)# access-list 100 permit ip 173.1.1.0 0.0.0.255 173.1.1.0 0.0.0.255

    ßđặc tả dữ liệu sẽ được bảo vệ bởi kết nối VPN





    3) Áp dụng lên cổng tương ứng:



    Center(config)# interface s0/0

    Center(config-if)# crypto map MYMAP

    *Mar 1 00:26:28.018: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON



    Saigon1(config)# interface s0/0

    Saigon1(config-if)# crypto map MYMAP

    *Mar 1 00:26:28.018: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON





    4) Cấu hình NAT trên Saigon1:

    Xây dựng access-list chọn dữ liệu cần NAT

    Saigon1(config)#access-list 101 deny ip 173.1.1.0 0.0.0.255 172.1.1.0 0.0.0.255

    Saigon1(config)#access-list 101 permit ip 173.1.1.0 0.0.0.255 any



    Thực hiện NAT overload:

    Saigon1(config)# ip nat inside source list 101 interface s0/0 overload



    Áp dụng lên cổng:

    Saigon1(config)# interface e0/0

    Saigon1(config-if)# ip nat inside

    Saigon1(config)# interface s0/0

    Saigon1(config-if)# ip nat outside

    C) Kiểm tra các thông số cấu hình




    Thông tin định tuyến trên các router:



    Center#sh ip route



    Gateway of last resort is not set



    172.1.0.0/24 is subnetted, 1 subnets

    C 172.1.1.0 is directly connected, Ethernet0/0

    173.1.0.0/24 is subnetted, 1 subnets

    S 173.1.1.0 [1/0] via 193.1.1.1

    S 193.1.1.0/24 [1/0] via 192.1.1.2

    C 192.1.1.0/24 is directly connected, Serial0/0



    Saigon1#sh ip route



    Gateway of last resort is 0.0.0.0 to network 0.0.0.0



    172.1.0.0/24 is subnetted, 1 subnets

    S 172.1.1.0 [1/0] via 192.1.1.1

    173.1.0.0/24 is subnetted, 1 subnets

    C 173.1.1.0 is directly connected, Ethernet0/0

    C 193.1.1.0/24 is directly connected, Serial0/0

    S* 0.0.0.0/0 is directly connected, Serial0/0



    ISP#sh ip route



    Gateway of last resort is not set



    100.0.0.0/24 is subnetted, 1 subnets

    C 100.100.100.0 is directly connected, Loopback0

    C 193.1.1.0/24 is directly connected, Serial0/1

    C 192.1.1.0/24 is directly connected, Serial0/0

    ISP#



    Saigon1#ping 172.1.1.1 source 173.1.1.1

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 172.1.1.1, timeout is 2 seconds:

    Packet sent with a source address of 173.1.1.1

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 92/93/97 ms

    Saigon1#



    Saigon1#sh ip nat translations

    Pro Inside global Inside local Outside local Outside global



    Saigon1#ping 100.100.100.100 source 173.1.1.1

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:

    Packet sent with a source address of 173.1.1.1

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/30/32 ms

    Saigon1#sh ip nat tr

    Saigon1#sh ip nat translations

    Pro Inside global Inside local Outside local Outside global

    icmp 193.1.1.1:4 173.1.1.1:4 100.100.100.100:4 100.100.100.100:4

    Kiểm tra các thông số của kết nối VPN:

    Saigon1#sh crypto isakmp sa

    Saigon1#sh crypto isakmp sa

    dst src state conn-id slot

    192.1.1.1 193.1.1.1 QM_IDLE 1 0



    Saigon1#sh crypto isakmp sa detail

    Codes: C - IKE configuration mode, D - Dead Peer Detection

    K - Keepalives, N - NAT-traversal

    X - IKE Extended Authentication

    psk - Preshared key, rsig - RSA signature

    renc - RSA encryption



    C-id Local Remote I-VRF Encr Hash Auth DH Lifetime Cap.

    1 193.1.1.1 192.1.1.1 aes sha psk 2 23:54:20



    Saigon1#sh crypto ipsec sa



    interface: Serial0/0

    Crypto map tag: MYMAP, local addr. 193.1.1.1



    protected vrf:

    local ident (addr/mask/prot/port): (173.1.1.0/255.255.255.0/0/0)

    remote ident (addr/mask/prot/port): (172.1.1.0/255.255.255.0/0/0)

    current_peer: 192.1.1.1:500

    PERMIT, flags={origin_is_acl,}

    #pkts encaps: 9, #pkts encrypt: 9, #pkts digest 9

    #pkts decaps: 9, #pkts decrypt: 9, #pkts verify 9

    #pkts compressed: 0, #pkts decompressed: 0

    #pkts not compressed: 0, #pkts compr. failed: 0

    #pkts not decompressed: 0, #pkts decompress failed: 0

    #send errors 1, #recv errors 0



    local crypto endpt.: 193.1.1.1, remote crypto endpt.: 192.1.1.1

    path mtu 1500, ip mtu 1500, ip mtu idb Serial0/0

    current outbound spi: 531ED50



    inbound esp sas:

    spi: 0xB6965E89(3063307913)

    transform: esp-3des esp-sha-hmac ,

    in use settings ={Tunnel, }

    slot: 0, conn id: 2000, flow_id: 1, crypto map: MYMAP

    sa timing: remaining key lifetime (k/sec): (4587939/3255)

    IV size: 8 bytes

    replay detection support: Y



    inbound ah sas:



    inbound pcp sas:



    outbound esp sas:

    spi: 0x531ED50(87158096)

    transform: esp-3des esp-sha-hmac ,

    in use settings ={Tunnel, }

    slot: 0, conn id: 2001, flow_id: 2, crypto map: MYMAP

    sa timing: remaining key lifetime (k/sec): (4587939/3253)

    IV size: 8 bytes

    replay detection support: Y



    outbound ah sas:



    outbound pcp sas:



    center#sh crypto isakmp sa

    dst src state conn-id slot

    192.1.1.1 193.1.1.1 QM_IDLE 1 0



    center#sh crypto isakmp sa de

    center#sh crypto isakmp sa detail

    Codes: C - IKE configuration mode, D - Dead Peer Detection

    K - Keepalives, N - NAT-traversal

    X - IKE Extended Authentication

    psk - Preshared key, rsig - RSA signature

    renc - RSA encryption



    C-id Local Remote I-VRF Encr Hash Auth DH Lifetime Cap.

    1 192.1.1.1 193.1.1.1 aes sha psk 2 23:51:50



    center#sh crypto ipsec sa



    interface: Serial0/0

    Crypto map tag: MYMAP, local addr. 192.1.1.1



    protected vrf:

    local ident (addr/mask/prot/port): (172.1.1.0/255.255.255.0/0/0)

    remote ident (addr/mask/prot/port): (173.1.1.0/255.255.255.0/0/0)

    current_peer: 193.1.1.1:500

    PERMIT, flags={origin_is_acl,}

    #pkts encaps: 14, #pkts encrypt: 14, #pkts digest 14

    #pkts decaps: 14, #pkts decrypt: 14, #pkts verify 14

    #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.: 192.1.1.1, remote crypto endpt.: 193.1.1.1

    path mtu 1500, ip mtu 1500, ip mtu idb Serial0/0

    current outbound spi: B6965E89



    inbound esp sas:

    spi: 0x531ED50(87158096)

    transform: esp-3des esp-sha-hmac ,

    in use settings ={Tunnel, }

    slot: 0, conn id: 2000, flow_id: 1, crypto map: MYMAP

    sa timing: remaining key lifetime (k/sec): (4437306/3091)

    IV size: 8 bytes

    replay detection support: Y



    inbound ah sas:



    inbound pcp sas:



    outbound esp sas:

    spi: 0xB6965E89(3063307913)

    transform: esp-3des esp-sha-hmac ,

    in use settings ={Tunnel, }

    slot: 0, conn id: 2001, flow_id: 2, crypto map: MYMAP

    sa timing: remaining key lifetime (k/sec): (4437306/3090)

    IV size: 8 bytes

    replay detection support: Y



    outbound ah sas:



    outbound pcp sas:

    D) Cấu hình cuối cùng của hệ thống


    Tiến hành đấu nối cab như hình vẽ và đặt địa chỉ ban đầu cho hệ thống:



    Saigon1#sh run

    Building configuration...



    Current configuration : 1310 bytes

    !

    version 12.3

    service timestamps debug datetime msec

    service timestamps log datetime msec

    no service password-encryption

    !

    hostname Saigon1

    !

    memory-size iomem 10

    no aaa new-model

    ip subnet-zero

    ip cef

    !

    crypto isakmp policy 1

    encr aes

    authentication pre-share

    group 2

    crypto isakmp key cisco address 192.1.1.1

    !

    !

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

    !

    crypto map MYMAP 1 ipsec-isakmp

    set peer 192.1.1.1

    set transform-set MYSET

    match address 100

    reverse-route

    !

    interface Ethernet0/0

    ip address 173.1.1.1 255.255.255.0

    ip nat inside

    half-duplex

    no keepalive

    !

    interface Serial0/0

    ip address 193.1.1.1 255.255.255.0

    ip nat outside

    clock rate 64000

    no fair-queue

    crypto map MYMAP

    !

    ip nat inside source list 101 interface Serial0/0 overload

    ip http server

    no ip http secure-server

    ip classless

    ip route 0.0.0.0 0.0.0.0 Serial0/0

    !

    access-list 100 permit ip 173.1.1.0 0.0.0.255 172.1.1.0 0.0.0.255

    access-list 101 deny ip 173.1.1.0 0.0.0.255 172.1.1.0 0.0.0.255

    access-list 101 permit ip 173.1.1.0 0.0.0.255 any

    !

    line con 0

    line aux 0

    line vty 0 4

    privilege level 15

    no login

    !

    !

    End



    Center#

    Center#sh run

    Building configuration...



    Current configuration : 1186 bytes

    !

    version 12.3

    service timestamps debug datetime msec

    service timestamps log datetime msec

    no service password-encryption

    !

    hostname Center

    !

    boot-start-marker

    boot-end-marker

    !

    memory-size iomem 10

    no aaa new-model

    ip subnet-zero

    ip cef

    !

    ip audit po max-events 100

    !

    crypto isakmp policy 1

    encr aes

    authentication pre-share

    group 2

    crypto isakmp key cisco address 193.1.1.1

    !

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

    !

    crypto map MYMAP 1 ipsec-isakmp

    set peer 193.1.1.1

    set transform-set MYSET

    match address 100

    reverse-route

    !

    interface FastEthernet0/0

    ip address 172.1.1.1 255.255.255.0

    duplex auto

    speed auto

    no keepalive

    !

    interface Serial0/0

    ip address 192.1.1.1 255.255.255.0

    clock rate 64000

    no fair-queue

    crypto map MYMAP

    !

    ip http server

    no ip http secure-server

    ip classless

    ip route 193.1.1.0 255.255.255.0 192.1.1.2

    !

    access-list 100 permit ip 172.1.1.0 0.0.0.255 173.1.1.0 0.0.0.255

    !

    !

    line con 0

    line aux 0

    line vty 0 4

    privilege level 15

    no login

    !

    End



    ISP#sh run

    Building configuration...



    Current configuration : 1220 bytes

    !

    version 12.2

    service timestamps debug datetime msec

    service timestamps log datetime msec

    no service password-encryption

    !

    hostname ISP

    !

    logging queue-limit 100

    !

    ip subnet-zero

    !

    no ip domain lookup

    !

    mpls ldp logging neighbor-changes

    !

    no voice hpi capture buffer

    no voice hpi capture destination

    !

    mta receive maximum-recipients 0

    !

    interface Loopback0

    ip address 100.100.100.100 255.255.255.0

    !

    !

    !

    interface Ethernet0/0

    ip address 172.16.1.1 255.255.255.0

    half-duplex

    no cdp enable

    !

    interface Serial0/0

    ip address 192.1.1.2 255.255.255.0

    !

    interface Serial0/1

    ip address 193.1.1.2 255.255.255.0

    ip http server

    ip classless

    !

    tftp-server flash:

    call rsvp-sync

    !

    mgcp profile default

    !

    dial-peer cor custom

    !

    line con 0

    line aux 0

    line vty 0 4

    privilege level 15

    no login

    !

    end
    Email : vnpro@vnpro.org
    ---------------------------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog
Working...
X