Các lệnh cấu hình trong CCNA theo chuyên mục (Phần 4)



Phần 4. NAT – PPP – Frame Relay

I.Cấu hình NAT

  • Cấu hình Static NAT

Cấu hình NAT trong chế độ Router(config). Các lệnh như sau

Router(config)#ip nat inside source static [inside local address] [inside global address]

Ví dụ:

R(config)#ip nat inside source statice 10.0.0.1 202.103.2.1 (Địa chỉ 10.10.0.1 sẽ được chuyển thành 202.103.2.1 khi đi ra khỏi Router)

Sau khi cấu hình xong phải áp dụng vào cổng in và cổng out, trong ví dụ dưới đây, cổng Ethernet là công in, còn cổng Serial là cổng out

Router(config)#interface ethernet 0

Router(config-if)#ip nat inside

Router(config)#interface serial 0

Router(config-if)#ip nat outside

  • Cấu hình Dynamic NAT

Router(config)#ip nat pool [ tên pool] [A.B.C.D A1.B1.C1.D1] netmask [mặt nạ]

Router(config)#ip nat inside source list [số hiệu ACL] pool [tên pool]

Router(config)#access-list [số hiệu ACL] permit A.B.C.D windcard masks

Ví dụ:

R(config)#ip nat pool nat-pool1 179.9.8.80 179.9.8.95 netmask 255.255.255.0

R(config)#ip nat inside source list 1 pool nat-pool1

R(config)#access-list 1 permit 10.1.0.0 0.0.0.255

Sau đó áp vào cổng In và Out như Static NAT

Note: Giải địa chỉ inside local address và inside global address phải nằm trong giải cho phép của ACL

  • Cấu hình PAT overload
  • Cấu hình overload với 1 địa chỉ IP cụ thể.

Router(config)#ip nat pool [tên pool] [ip global inside] [subnet mask]

Router(config)#ip nat inside source list [tên số hiệu ACL] pool [tên pool] overload

Router(config)#access-list [số hiệu] permit [địa chỉ] [windcard mask]

Ví dụ:

R(config)#access-list 2 permit 10.0.0.0 0.0.0.255
R(config)#ip nat pool nat-pool2 179.9.8.20 255.255.255.240

R(config)#ip nat inside source list 2 nat-pool2 overload

  • Cấu hình overload dùng địa chỉ của cổng ra.(Thường xuyên được dung hơn là trường hợp trên)

Router(config)#ip nat inside source list [tên số hiệu ACL] interface [cổng ra] overload

Router(config)#access-list [số hiệu] permit [địa chỉ] [windcard mask]

Ví dụ:

R(config)#ip nat inside source list 3 interface serial 0 overload

R(config)#access-list 3 permit 10.0.0.0 0.0.0.255

  • Các lệnh Clear NAT/PAT

Lệnh xóa tất cả dynamic nat trên toàn bộ các interface.

Router#clear ip nat translation *

Lệnh xóa các single nat trên từng interface

Router#clear ip nat translation [inside/outside] [global ip - local ip]

Lệnh xóa các extended nat trên từng interface

Router#clear ip nat translation protocol [inside/outside] [global ip - global port – local ip – local port]

  • Kiểm tra và Debug các NAT và PAT

Router#show ip nat translation

Router#show ip nat statics

Router#debug ip nat

  • Cấu hình DHCP

Router(config)#ip dhcp excluded-address ip-address (end-ip-address)

Router(config)#ip dhcp pool [tên pool]

Router(dhcp-config)#network addess subnetmask

Router(dhcp-config)#default-router address

Router(dhcp-config)#dns-server address

Router(dhcp-config)#netbios-name-server address

Router(dhcp-config)#domain-name tên domain

Router(dhcp-config)#lease ngày/giờ/phút

  • Kiểm tra và troubleshoot cấu hình DHCP

Router#show ip dhcp binding

Router#debug ip dhcp server events

  • Trong trường hợp DHCP server không nằm cùng mạng với host

Note: khi DHCP server không cùng mạng với host thì ta phải dùng lệnh ip helper-address giúp host đến DHCP server.

Router(config)#interface [cổng nằm cùng mạng với host]

Router(config-if)#ip helper-address [địa chỉ của DHCP server]

Note: Trong trường hợp muốn gói tin của host được broadcast ở mạng chứa DHCP thì ta dùng thêm lệnh ip directed-broadcast ở cổng cùng mạng với DHCP server

Router(config)#interface [cổng nằm cùng mạng với dhcp]

Router(config-ì)#ip directed-broadcast

II. Cấu hình PPP

1. Cấu hình cơ bản

R(config)#interface serial 0/0

R(config-if)#encapsulation ppp

2. Cấu hình PAP

Cấu hình PAP không yêu cầu hai Router giống nhau về password nhưng CHAP thì phải có.

(Cấu hình trên RA)

R(config)#host RA

RA(config)#username RB password 321

RA(config-if)#encapsulation ppp

RA(config-if)#ppp authentication pap

RA(config-if)#ppp pap sent-username RA password 123

(Cấu hình trên RB)

R(config)#host RB

RB(config)#username RA password 123

RB(config-if)#encapsulation ppp

RB(config-if)#ppp authentication pap

RB(config-if)#ppp pap sent-username RB password 321

3. Cấu hình CHAP (yêu cầu phải giống nhau về password)

(Cấu hình trên RA)

R(config)#host RA

RA(config)#username RB password 123

RA(config-if)encapsulation ppp

RA(config-if)ppp authentication chap

(Cấu hình trên RB)

R(config)#host RB

RB(config)#username RA password 123

RB(config-if)encapsulation ppp

RB(config-if)ppp authentication chap

4. Các cấu hình khác của PPP

<!--[if !supLists]-->a. <!--[endif]-->Cấu hình Multilink

R(config-if)#encapsulation ppp

R(config-if)#ppp multilink

<!--[if !supLists]-->b. <!--[endif]-->Cấu hình Compression

R(config-if)#encapsulation ppp

R(config-if)#compress [predictor/stac/mppc]

<!--[if !supLists]-->c. <!--[endif]-->Cấu hình Error detection

R(config-if)#encapsulation ppp

R(config-if)#ppp quality [phần trăm]

5. Các lệnh kiểm tra cấu hình PPP

R#show interface (xem encapsulation)

R#debug ppp negotiation (Xem quá trình kết nối giữa 2 node)

R#debug ppp authentication (Xem quá trình xác thực giữa 2 node)

III. Cấu hình Frame-Relay

<!--[if !supLists]-->1. <!--[endif]-->Cấu hình đơn giản

R(config-if)#encapsulation frame-relay {ciso| ietf} (mặc định là cisco)

Khi lệnh này được thực thi, DLCI sẽ được Inverse ARP tự động map, người dùng không cần phải làm gì cả.

* Nhưng Inverse ARP không làm việc với các kết nối Hub-and-Spoke

<!--[if !supLists]-->2. <!--[endif]-->Cấu hình Frame-relay static map

R(config-if)#encapsulation frame-relay

R(config-if)#frame-relay map ip remote–ip-address local-dlci [broadcast] [cisco| ietf]

(ip address trong dòng lệnh trên chỉ lấy làm minh họa bởi nó rất phổ biến, chính xác phải là remote–protocol–address)

Broadcast trong câu lệnh trên có 2 chức năng:

<!--[if !supLists]-->§ <!--[endif]-->Forward broadcast khi multicast không được khởi động.

<!--[if !supLists]-->§ <!--[endif]-->Đơn giản hóa cấu hình OSPF cho mạng nonbroadcast sử dụng FRelay.

Ví dụ:

R(config-if)#encapsulation frame-relay

R(config-if)#frame-relay map ip 192.168.2.1 100 broadcast

<!--[if !supLists]-->3. <!--[endif]-->Cấu hình FR trong mạng None Broadcast MutiAccess

<!--[if !supLists]-->- <!--[endif]-->Trong mạng Broadcast khi 1 máy tính truyền frame tất cả các node lắng nghe frame nhưng chỉ có node cần nhận mới nhận được.

<!--[if !supLists]-->- <!--[endif]-->Trong mạng None Broadcast khi 1 máy tính truyền frame thì chỉ có node cần nhận mới lắng nghe và nhận được frame đó, các node còn lại thì không. Frame được truyền qua 1 virtual Circuit hoặc 1 thiết bị chuyển mạch.

<!--[if !supLists]-->- <!--[endif]-->Star topology có thể được coi như là 1 mạng Hub and Spoke.

<!--[if !supLists]-->4. <!--[endif]-->Giải quyết vấn đề với Routing Updates mà không disable Split Horizal

Giải pháp dùng Sub-interface

R(config)#interface s0/0

R(config-if)#encapsulation frame-relay

R(config-if)interface s0/0.1 [multipoint| point-to-point]

<!--[if !supLists]-->- <!--[endif]-->point-to-point: Mỗi subinterface có subnet riêng của mình. Broadcast và Split horizol không là vấn đề.

<!--[if !supLists]-->- <!--[endif]-->Multi-point: Tất cả các subinterface liên quan phải cùng chung 1 subnet và như vậy Broadcast và Split horizol sẽ có vấn đề.

Ví dụ:

(Point-to-point)

R(config)#interface s0/0

R(config-if)#encapsulation frame-relay

R(config-if)#interface s0/0.1 point-to-point

R(config-subif)#frame-relay interface-dlci 18

(Multipoint)

R(config)#interface s0/0

R(config-if)#encapsulation frame-relay

R(config-if)#interface s0/0.2 multipoint

R(config-subif)#frame-relay interface-dlci 19

R(config-subif)#frame-relay interface-dlci 20

<!--[if !supLists]-->5. <!--[endif]-->Cấu hình trên Frame-relay Switching (ví dụ)

R(config)#frame-relay switching

R(config)#interface s0/0

R(config-if)#encapsulation frame-relay

R(config-if)#frame-relay intf-type dce

R(config-if)#frame-relay route 103interface serial 0/1 301


» Các bài viết khác trong kiến thức căn bản về Kiến thức mạng Cisco:
» Các lệnh cấu hình trong CCNA theo chuyên mục (Phần 3)
» Các lệnh cấu hình trong CCNA theo chuyên mục (Phần 2)
» Các lệnh cấu hình trong CCNA theo chuyên mục (Phần 1)
» Hướng dẫn cài đặt Kiến thức mạng Cisco:


Được tạo bởi liennp
Lần sửa cuối 15/07/10

Giới thiệu PLANETPhản hồi trực tuyến Mua hàng ở đâySơ đồ WebsiteEnglish  

Sử dụng bộ phần mềm TVIS 3.0
© Bản quyền của công ty máy tính NETCOM Co.,Ltd 2000-2016

Số lần truy cập:

Mọi kết nối tới Website này cũng như việc tái sử dụng lại nội dung phải được sự đồng ý của công ty NETCOM Co.,Ltd.
Mọi chi tiết xin liên hệ theo địa chỉ sau: Công ty máy tính NETCOM Co.,Ltd Số 46A/120 Đường Trường Chinh - Phương Mai - Đống Đa - Hà Nội.
Tel: (04)35737747 , Fax: (04)35737748 , Email: support@netcom.com.vn