• 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 Dynamic NAT và PAT

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

  • Thực hiện Dynamic NAT và PAT

    Bùi Nguyễn Hoàng Long
    VnPro


    Thực hiện Dynamic NAT và PAT


    I. Mô tả:
    Cho phép truy cập dịch vụ bên ngoài Internet từ mạng 192.168.1.0/24 với yêu cầu”
    • Dãy địa chỉ từ 192.168.1.1-182.168.1.127 sẽ Nat động tương ứng với dãy địa chỉ 192.168.2.10-192.168.2.100
    • Dãy địa chỉ từ 192.168.1.128-192.168.1.254 sẽ PAT tương ứng với địa chỉ 192.168.2.9

    II. Cấu hình

    Xác định dãy địa chỉ đầu nhất
    ASA(config)# nat (inside) 1 192.168.1.0 255.255.255.128

    Xác định dãy địa chỉ thứ hai
    ASA(config)# nat (inside) 2 192.168.1.128 255.255.255.128

    Thực hiện NAT động cho dãy địa chỉ thứ nhất
    ASA(config)# global (outside) 1 192.168.2.10-192.168.2.100 netmask 255.255.255.0

    Thực hiện PAT cho dãy địa chỉ thứ hai
    ASA(config)# global (outside) 2 192.168.2.9 netmask 255.255.255.0

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

    ASA
    ASA Version 8.0(2)
    !
    hostname ASA
    enable password 8Ry2YjIyt7RRXU24 encrypted
    names
    !
    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 192.168.2.1 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
    management-only
    !
    passwd 2KFQnbNIdI.2KYOU encrypted
    ftp mode passive
    access-list PING extended permit icmp any any echo-reply
    global (outside) 1 192.168.2.10-192.168.2.100 netmask 255.255.255.0
    global (outside) 2 192.168.2.9 netmask 255.255.255.0
    nat (inside) 1 192.168.1.0 255.255.255.128
    nat (inside) 2 192.168.1.128 255.255.255.128
    access-group PING in interface outside
    route outside 0.0.0.0 0.0.0.0 192.168.2.2 1
    !
    class-map inspection_default
    match default-inspection-traffic
    !
    !
    policy-map type inspect dns preset_dns_map
    parameters
    message-length maximum 512
    policy-map global_policy
    class inspection_default
    inspect dns preset_dns_map
    inspect ftp
    inspect h323 h225
    inspect h323 ras
    inspect rsh
    inspect rtsp
    inspect esmtp
    inspect sqlnet
    inspect skinny
    inspect sunrpc
    inspect xdmcp
    inspect sip
    inspect netbios
    inspect tftp
    !
    service-policy global_policy global
    prompt hostname context
    Cryptochecksum:dba2db98f02aa720ff5cea67b371a558
    : end
    GATEWAY
    Building configuration...

    Current configuration : 726 bytes
    hostname GATEWAY
    !
    interface FastEthernet0/0
    ip address 192.168.2.2 255.255.255.0
    ip nat inside
    duplex auto
    speed auto
    !
    interface FastEthernet0/1
    ip address dhcp
    ip nat outside
    duplex auto
    speed auto
    !
    ip nat inside source list 1 interface FastEthernet0/1 overload
    ip classless
    ip http server
    no ip http secure-server
    !
    access-list 1 permit 192.168.2.0 0.0.0.255
    !
    line con 0
    line aux 0
    line vty 0 4
    login
    !
    end

    IV. Kiểm tra

    Thực hiện kiểm tra qua icmp với địa chỉ thuộc dãy thứ nhất



    ASA(config)# sh xlate
    1 in use, 8 most used
    Global 192.168.2.10 Local 192.168.1.2



    ASA(config)# sh xlate
    2 in use, 8 most used
    Global 192.168.2.10 Local 192.168.1.2
    Global 192.168.2.11 Local 192.168.1.127

    Thực hiện truy cập qua icmp với địa chỉ thuộc dãy thứ hai


    ASA(config)# sh xlate
    6 in use, 8 most used
    Global 192.168.2.10 Local 192.168.1.2
    PAT Global 192.168.2.9(1) Local 192.168.1.128 ICMP id 512
    PAT Global 192.168.2.9(1025) Local 192.168.1.128(1110)
    PAT Global 192.168.2.9(1) Local 192.168.1.128(123)
    PAT Global 192.168.2.9(1024) Local 192.168.1.128(1054)
    Global 192.168.2.11 Local 192.168.1.127
    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
Working...
X