• 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.

Thực hiện IPSec VPN xác thực với Pre-shared

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

  • Thực hiện IPSec VPN xác thực với Pre-shared

    Bùi Nguyễn Hoàng Long

    VnPro

    Thực hiện IPSec VPN xác thực với Pre-shared

    I. Mô tả:
    Thực hiện cấu hình IPSec VPN xác thực bằng pre-share key, đảm bảo hai mạng 172.16.1.0/24 và 192.168.1.0/24 có thể giao tiếp được với nhau sau khi VPN được thiết lập.

    II. Cấu hình
    Cấu hình chính sách ISAKMP
    ciscoasa(config)# crypto isakmp policy 10
    ciscoasa(config-isakmp-policy)# authentication pre-share
    ciscoasa(config-isakmp-policy)# encryption 3des
    ciscoasa(config-isakmp-policy)# hash md5
    ciscoasa(config-isakmp-policy)# group 2

    Cấu hình chính sách IPSec
    ciscoasa(config)# crypto ipsec transform-set MYSET esp-3des esp-md5-hmac

    Định nghĩa luồng dữ liệu được bảo vệ
    ciscoasa(config)# access-list VPN extended permit ip 172.16.1.0 255.255.255.0 192.168.1.0 255.255.255.0

    Cấu hình Crypto map
    ciscoasa(config)# crypto map MYMAP 10 match address VPN
    ciscoasa(config)# crypto map MYMAP 10 set peer 151.1.1.2
    ciscoasa(config)# crypto map MYMAP 10 set transform-set MYSET

    Gán Crypto map vào cổng
    ciscoasa(config)# crypto map MYMAP interface outside

    Kích hoạt ISAKMP trên cổng
    ciscoasa(config)# crypto isakmp enable outside

    Cấu hình tunnel-group
    ciscoasa(config)# tunnel-group 151.1.1.2 type ipsec-l2l

    Xác định thuộc tính IPSec
    ciscoasa(config)# tunnel-group 151.1.1.2 ipsec-attributes
    ciscoasa(config-tunnel-ipsec)# pre-shared-key vnpro


    III. Cấu hình đầy đủ

    ASA1

    ASA Version 7.2(2)
    !
    hostname ASA1
    enable password 8Ry2YjIyt7RRXU24 encrypted
    names
    !
    interface Ethernet0/0
    nameif inside
    security-level 100
    ip address 172.16.1.1 255.255.255.0
    !
    interface Ethernet0/1
    nameif outside
    security-level 0
    ip address 150.1.1.2 255.255.255.0
    !
    interface Ethernet0/2
    shutdown
    no nameif
    no security-level
    no ip address
    !
    interface Ethernet0/3
    shutdown
    no nameif
    no security-level
    no ip address
    !
    interface Management0/0
    shutdown
    no nameif
    no security-level
    no ip address
    !

    access-list VPN extended permit ip 172.16.1.0 255.255.255.0 192.168.1.0 255.255.255.0
    pager lines 24
    route outside 0.0.0.0 0.0.0.0 150.1.1.1 1
    crypto ipsec transform-set MYSET esp-3des esp-md5-hmac

    crypto map MYMAP 10 match address VPN
    crypto map MYMAP 10 set peer 151.1.1.2
    crypto map MYMAP 10 set transform-set MYSET

    crypto map MYMAP interface outside

    crypto isakmp enable outside
    crypto isakmp policy 10
    authentication pre-share
    encryption 3des
    hash md5
    group 2
    lifetime 86400
    crypto isakmp policy 65535
    authentication pre-share
    encryption 3des
    hash sha
    group 2
    lifetime 86400
    tunnel-group 151.1.1.2 type ipsec-l2l
    tunnel-group 151.1.1.2 ipsec-attributes
    pre-shared-key *
    : end

    ASA2

    ASA Version 7.2(4)
    !
    hostname ASA2
    enable password 8Ry2YjIyt7RRXU24 encrypted
    passwd 2KFQnbNIdI.2KYOU encrypted
    names
    name 152.1.1.2 ca.vnpro.vn
    !
    interface Ethernet0/0
    nameif inside
    security-level 100
    ip address 192.168.1.1 255.255.255.0
    !
    interface Ethernet0/1
    nameif outside
    security-level 0
    ip address 151.1.1.2 255.255.255.0
    !
    interface Ethernet0/2
    shutdown
    no nameif
    no security-level
    no ip address
    !
    interface Ethernet0/3
    shutdown
    no nameif
    no security-level
    no ip address
    !
    interface Management0/0
    shutdown
    no nameif
    no security-level
    no ip address
    !
    ftp mode passive
    access-list VPN extended permit ip 192.168.1.0 255.255.255.0 172.16.1.0 255.255.255.0
    route outside 0.0.0.0 0.0.0.0 151.1.1.1 1
    crypto ipsec transform-set MYSET esp-3des esp-md5-hmac

    crypto map MYMAP 10 match address VPN
    crypto map MYMAP 10 set peer 150.1.1.2
    crypto map MYMAP 10 set transform-set MYSET

    crypto map MYMAP interface outside
    crypto isakmp enable outside

    crypto isakmp policy 10
    authentication pre-share
    encryption 3des
    hash md5
    group 2
    lifetime 86400
    crypto isakmp policy 65535
    authentication pre-share
    encryption 3des
    hash sha
    group 2
    lifetime 86400
    telnet timeout 5
    ssh timeout 5
    console timeout 0
    tunnel-group 150.1.1.2 type ipsec-l2l
    tunnel-group 150.1.1.2 ipsec-attributes
    pre-shared-key *
    !
    : end

    IV. Kiểm tra

    Thực hiện lệnh PING trên PC để kiểm tra kết nối

    Trạng thái ISAKMP cho biết kết nối được thiết lập thành công
    ASA2# sh crypto isakmp

    Active SA: 1
    Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
    Total IKE SA: 1

    1 IKE Peer: 150.1.1.2
    Type : L2L Role : responder
    Rekey : no State : MM_ACTIVE

    Trạng thái IPSec SA

    ASA2# sh crypto ipsec sa
    interface: outside
    Crypto map tag: MYMAP, seq num: 10, local addr: 151.1.1.2

    access-list VPN permit ip 192.168.1.0 255.255.255.0 172.16.1.0 255.255.255.0
    local ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
    remote ident (addr/mask/prot/port): (172.16.1.0/255.255.255.0/0/0)
    current_peer: 150.1.1.2

    #pkts encaps: 3, #pkts encrypt: 3, #pkts digest: 3
    #pkts decaps: 3, #pkts decrypt: 3, #pkts verify: 3
    #pkts compressed: 0, #pkts decompressed: 0
    #pkts not compressed: 3, #pkts comp failed: 0, #pkts decomp failed: 0
    #pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
    #PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
    #send errors: 0, #recv errors: 0

    local crypto endpt.: 151.1.1.2, remote crypto endpt.: 150.1.1.2

    path mtu 1500, ipsec overhead 58, media mtu 1500
    current outbound spi: 90BEDA8E

    inbound esp sas:
    spi: 0xA29BFB99 (2728131481)
    transform: esp-3des esp-md5-hmac none
    in use settings ={L2L, Tunnel, }
    slot: 0, conn_id: 1, crypto-map: MYMAP
    sa timing: remaining key lifetime (kB/sec): (4274999/28527)
    IV size: 8 bytes
    replay detection support: Y
    outbound esp sas:
    spi: 0x90BEDA8E (2428426894)
    transform: esp-3des esp-md5-hmac none
    in use settings ={L2L, Tunnel, }
    slot: 0, conn_id: 1, crypto-map: MYMAP
    sa timing: remaining key lifetime (kB/sec): (4274999/28527)
    IV size: 8 bytes
    replay detection support: Y
    Phạm Minh Tuấn

    Email : phamminhtuan@vnpro.org
    Yahoo : phamminhtuan_vnpro
    -----------------------------------------------------------------------------------------------
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

  • #2
    Thầy Tuấn cho em hỏi là bài Lab này có thể thực hiện đc trên GNS3 không ạ?
    Nhiệt tình + Không biết >> Phá hoại

    Comment


    • #3
      Chào bạn,

      Bài lab này có thể giả lập được trên GNS3.

      Phần PC bạn có thể dùng VMWARE giả lập.
      Phạm Minh Tuấn

      Email : phamminhtuan@vnpro.org
      Yahoo : phamminhtuan_vnpro
      -----------------------------------------------------------------------------------------------
      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

      Comment


      • #4
        Originally posted by phamminhtuan View Post
        Chào bạn,

        Bài lab này có thể giả lập được trên GNS3.

        Phần PC bạn có thể dùng VMWARE giả lập.
        Thanks Thầy Tuấn :)
        Nhiệt tình + Không biết >> Phá hoại

        Comment


        • #5
          Thầy Tuấn và các anh chị cho em hỏi, em đang làm lab như sơ đồ trên. ở giữa ASA1, và ASA2 em cũng đặt 1 Router.và chỉ cấu hình interface theo địa chỉ trên và up các interface đó.
          Router(config)#interface fa0/0
          Router(config-if)#descoiption "Ket noi voi ASA1"
          Router(config-if)#ip add 150.1.1.1 255.255.255.0
          Router(config-if)#no shut
          Router(config-if)#exit
          Router(config)#
          Router(config)#interface fa0/1
          Router(config-if)#descoiption "Ket noi voi ASA2"
          Router(config-if)#ip add 151.1.1.1 255.255.255.0
          Router(config-if)#no shut
          Router(config-if)#exit

          Sau đó Trên ASA1, và ASA2 em có đặt ip, và route tĩnh để trên ASA1 ping đến địa chỉ 151.1.1.2 ok, và ngược lại từ ASA2 ping tới địa chỉ 150.1.1.2 OK.
          ASA1(config)#interface e0/0
          ASA1(config-if)#desciption "ket noi toi Router"
          ASA1(config-if)#ip add 150.1.1.2 255.255.255.0
          ASA1(config-if)#nameif outside
          ASA1(config-if)#no shut
          ASA1(config-if)#exit
          ASA1(config)#
          ASA1(config)#interface e0/1
          ASA1(config-if)#desciption "ket noi toi inside 172.16.1.0/24"
          ASA1(config-if)#ip add 150.1.1.2 255.255.255.0
          ASA1(config-if)#nameif inside
          ASA1(config-if)#no shut
          ASA1(config-if)#exit
          ASA1(config)#
          ASA1(config)#route outside 151.1.1.0 255.255.255.0 150.1.1.1

          ASA2(config)#interface e0/0
          ASA2(config-if)#desciption "ket noi toi Router"
          ASA2(config-if)#ip add 151.1.1.2 255.255.255.0
          ASA2(config-if)#nameif outside
          ASA2(config-if)#no shut
          ASA2(config-if)#exit
          ASA2(config)#
          ASA2(config)#interface e0/1
          ASA2(config-if)#desciption "ket noi toi inside 172.16.1.0/24"
          ASA2(config-if)#ip add 151.1.1.2 255.255.255.0
          ASA2(config-if)#nameif inside
          ASA2(config-if)#no shut
          ASA2(config-if)#exit
          ASA2(config)#
          ASA2(config)#route outside 150.1.1.0 255.255.255.0 151.1.1.1

          Sau đó em mới cấu hình như hướng dẫn ở trên nhưng giữa PC1 (172.16.1.10) không thể remote desktop được với PC2 (192.168.1.10), mặc dù PC2 đã bật Remote Desktop.
          Kiểm tra trên ASA2 theo các lệnh như trên thì hiện thị như sau:

          ASA2# show crypto isakmp

          There are no isakmp sas

          Global IKE Statistics
          Active Tunnels: 0
          Previous Tunnels: 0
          In Octets: 0
          In Packets: 0
          In Drop Packets: 0
          In Notifys: 0
          In P2 Exchanges: 0
          In P2 Exchange Invalids: 0
          In P2 Exchange Rejects: 0
          In P2 Sa Delete Requests: 0
          Out Octets: 0
          Out Packets: 0
          Out Drop Packets: 0
          Out Notifys: 0
          Out P2 Exchanges: 0
          Out P2 Exchange Invalids: 0
          Out P2 Exchange Rejects: 0
          Out P2 Sa Delete Requests: 0
          Initiator Tunnels: 0
          Initiator Fails: 0
          Responder Fails: 0
          System Capacity Fails: 0
          Auth Fails: 0
          Decrypt Fails: 0
          Hash Valid Fails: 0
          No Sa Fails: 0

          Global IPSec over TCP Statistics
          --------------------------------
          Embryonic connections: 0
          Active connections: 0
          Previous connections: 0
          Inbound packets: 0
          Inbound dropped packets: 0
          Outbound packets: 0
          Outbound dropped packets: 0
          RST packets: 0
          Recevied ACK heart-beat packets: 0
          Bad headers: 0
          Bad trailers: 0
          Timer failures: 0
          Checksum errors: 0
          Internal errors: 0
          ASA2#


          ASA2# sh crypto ipsec sa

          There are no ipsec sas

          Không biết em có cấu hình thiếu phần nào không. Anh chị chỉ giúp em với

          Thanks all !
          Last edited by hoangtu_congngheIT; 18-03-2011, 12:17 AM.
          Nhiệt tình + Không biết >> Phá hoại

          Comment


          • #6
            Originally posted by phamminhtuan View Post
            Chào bạn,

            Bài lab này có thể giả lập được trên GNS3.

            Phần PC bạn có thể dùng VMWARE giả lập.
            Em đã check hình như IOS ASA version 8.0(2) của em bị error thì phải. Thầy có thể up cho em xin bản mà mình đã lab OK được không ạ??

            Thanks thầy
            Nhiệt tình + Không biết >> Phá hoại

            Comment


            • #7
              Chào bạn,

              Bạn lấy con Pix version 8.0(3) này là chạy được rồi.
              http://vnpro.org/forum/showthread.ph...Bc-m%E1%BB%99t
              Phạm Minh Tuấn

              Email : phamminhtuan@vnpro.org
              Yahoo : phamminhtuan_vnpro
              -----------------------------------------------------------------------------------------------
              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

              Comment


              • #8
                Thanks Thầy !
                Em đã làm đc với ASA Okie rồi
                Nhiệt tình + Không biết >> Phá hoại

                Comment


                • #9
                  Cho e hỏi. Khi ISP cấp IP động cho ASA1 hoặc ASA2 mà ko fai gán tĩnh như lab trên, chúng ta sẽ fai cấu hình như nào. Thank các Thầy !

                  Comment


                  • #10
                    Originally posted by vvnghi View Post
                    Cho e hỏi. Khi ISP cấp IP động cho ASA1 hoặc ASA2 mà ko fai gán tĩnh như lab trên, chúng ta sẽ fai cấu hình như nào. Thank các Thầy !
                    Với kiểu kết nối PPPoE,thì câu lệnh để nhận IP public động của ISP là:
                    hostname(config-if)# ip address pppoe [setroute]

                    Link tham khảo:
                    Cisco ASA 5500-X Series Next-Generation Firewalls - Some links below may open a new browser window to display the document you selected.

                    A Cisco ASA Firewall is ideal for Broadband access connectivity to the Internet since it provides state of the art and solid network security protection. Especially for small business or home use, the ASA 5505 model is ideal for broadband ADSL access connectivity. Some ISPs provide Point to Point over…
                    Nhiệt tình + Không biết >> Phá hoại

                    Comment


                    • #11
                      Originally posted by vvnghi View Post
                      Cho e hỏi. Khi ISP cấp IP động cho ASA1 hoặc ASA2 mà ko fai gán tĩnh như lab trên, chúng ta sẽ fai cấu hình như nào. Thank các Thầy !
                      Chào bạn,

                      Nếu ASA được cấp IP động thì bạn phải kết hợp thêm dịch vụ Dynamic DNS.

                      Chi tiết cấu hình như link dưới


                      ciscoasa(config)# crypto map MYMAP 10 set peer dynamicDNS-name
                      Phạm Minh Tuấn

                      Email : phamminhtuan@vnpro.org
                      Yahoo : phamminhtuan_vnpro
                      -----------------------------------------------------------------------------------------------
                      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

                      Comment


                      • #12
                        Chào Thầy, cho em hỏi là. Em thực hiện cấu hình VPN site-to-Site, nhưng khi thực hiện cấu hình xong giữa hai ASA, thực hiện lệnh show crypto isakmp sa và show crypto ipsec sa
                        thì đêu nhận được reply là There are no isakmp sas
                        Xin thầy pix lỗi giúp em, e cung thực hiện cấu hình tương tự như hướng dẫn của Thầy
                        Version ASA 5520 (8.02)

                        Comment


                        • #13
                          Em thực hiện cấu hình VPN site-to-Site, nhưng khi thực hiện cấu hình xong giữa hai ASA, thực hiện lệnh show crypto isakmp sa và show crypto ipsec sa
                          thì đêu nhận được reply là There are no isakmp sas
                          Trước khi làm bài lab như trên bạn cần kiểm tra giữa LAN2 thông với interface outside của ASA1 và ngược lại LAN1 với interface outside của ASA2 chưa ? và khi bài làm lab ảo trên gns3 thì IOS không hỗ trợ encryption 3des, bạn thay vào đó là encryption des

                          bạn kiểm tra lại nhé
                          Nhiệt tình + Không biết >> Phá hoại

                          Comment


                          • #14
                            Topoo : PC (192.168.10.10) ------ (192.168.10.1)ASA1(209.165.200.1) ----(209.165.200.254)ISP(209.165.201.254) ------(209.165.201.1)ASA2 192.168.20.1)------- PC (192.168.20.20)
                            Cấu hình VPN Site -To -Site thành công giưa ASA1 và ASA2, nhưng ping giữa hai PC k thiết lập được và ping giữa PC tới interface outside cung không thiết lập đc.
                            Mình sử dụng aes-256, chứ không fai 3des
                            Help me. Tk Bạn.

                            Comment


                            • #15
                              Cấu hình VPN Site -To -Site thành công giưa ASA1 và ASA2,
                              Bạn thử lệnh kiểm tra VPN như a Tuấn kiểm tra nếu thông số same same thì đã configure VPN okie >> bạn thử bật remote 1 máy trạm ở mạng LAN1 rồi từ 1 máy trạm ở mạng LAN2 có thể remote vào máy trạm đã bật remote ở LAN1 hay không, nếu cấu hình VPN thành công thì remote chắc chắn được.

                              ping giữa PC tới interface outside cung không thiết lập đc
                              bạn cần cấu hình 1 ACL về ping gán vào cổng outside theo chiều trên 2 ASA thì bạn mới ping được. lệnh cụ thể

                              ASA(config)#access-list PING permit icmp any any echo-reply
                              ASA(config)#access-group PING in interface outside
                              Nhiệt tình + Không biết >> Phá hoại

                              Comment

                              • Working...
                                X