Router

Published on December 2016 | Categories: Documents | Downloads: 68 | Comments: 0 | Views: 787
of 159
Download PDF   Embed   Report

Comments

Content


MỤC LỤC
PHẦN 1 : CẤU HÌNH ROUTER ................................ ................................ .............5
LAB 1-1: ................................ ................................ ................................ ...................5
ĐĂNG NHẬP VÀO ROUTER – GIAO DIỆN DÒNG LỆNH................................ 5
1. Yêu cầu ................................ ................................ ................................ ..........5
2. Hướng dẫn................................ ................................ ................................ ......5
LAB 1-2: ................................ ................................ ................................ .................13
ĐẶT MẬT KHẨU CHO ROUTER ................................ ................................ .......13
1. Mô tả ................................ ................................ ................................ ............13
2. Thực hiện ................................ ................................ ................................ .....13
3. Kiểm tra................................ ................................ ................................ ........14
LAB 1-3: ................................ ................................ ................................ .................17
CÁC LỆNH CƠ BẢN CỦA HỆ ĐIỀU HÀNH CISCO IOS ................................ .17
1. Đặt router banner ................................ ................................ .........................17
2. Cấu hình các cổng giao tiếp trên router: ................................ ......................18
3. Đặt hostname ................................ ................................ ............................... 20
4. Lưu cấu hình ................................ ................................ ................................ 21
5. Các lệnh kiểm tra cấu hình................................ ................................ ...........21
LAB 1-4: ................................ ................................ ................................ .................23
CISCO DISCOVERY PROTOCOL ................................ ................................ .......23
1. Mô tả ................................ ................................ ................................ ............23
2. Thực hiện ................................ ................................ ................................ .....23
LAB 1-5: ................................ ................................ ................................ .................27
SỬ DỤNG TELNET................................ ................................ ............................... 27
1. Mô tả ................................ ................................ ................................ ............27
2. Thực hiện ................................ ................................ ................................ .....27
LAB 1-6: ................................ ................................ ................................ .................32
KHÔI PHỤC MẬT KHẨU CHO CISCO 2600, 3600 ................................ ...........32
1. Mô tả ................................ ................................ ................................ ............32
2. Cách thực hiện ................................ ................................ ............................. 32
LAB 1-7: ................................ ................................ ................................ .................36
NẠP IOS IMAGE TỪ TFTP SERVER CHO ROUTER CHẠY TỪ FLASH.......36
1. Mô tả ................................ ................................ ................................ ............36
2. Thực hiện ................................ ................................ ................................ .....36
LAB 1-8: ................................ ................................ ................................ .................40
NẠP IOS IMAGE TỪ TFTP SERVER CHO ROUTER CHẠY TỪ RAM..........40
1. Mô tả ................................ ................................ ................................ ............40
2. Thực hiện ................................ ................................ ................................ .....40
LAB 1-9: ................................ ................................ ................................ .................44
NẠP IOS IMAGE CHO SWITCH 2900, 3500 ................................ ......................44
1. Mô tả ................................ ................................ ................................ ............44
2. Thực hiện ................................ ................................ ................................ .....44
LAB 1-10: ................................ ................................ ................................ ...............48
CISCO HTTP WEB SERVER................................ ................................ ................48
1. Mô tả ................................ ................................ ................................ ............48
2. Cấu hình ................................ ................................ ................................ .......48
LAB 1-11: ................................ ................................ ................................ ...............50
CẤU HÌNH ROUTER TỪ XA QUA CỔNG AUX ................................ ...............50
1. Mô tả ................................ ................................ ................................ ............50
2. Các bước tiến hành................................ ................................ .......................50
PHẦN 2: CẤU HÌNH SWITCH................................ ................................ .............52
LAB 2-1 ................................ ................................ ................................ ..................52
CẤU HÌNH CĂN BẢN CATALYST 2900 ................................ ...........................52
1. Mô tả ................................ ................................ ................................ ............52
2. Thực hiện ................................ ................................ ................................ .....52
LAB 2-2: ................................ ................................ ................................ .................57
VLAN................................ ................................ ................................ ......................57
1. Mô tả ................................ ................................ ................................ ............57
2. Thực hiện ................................ ................................ ................................ .....58
LAB 2-3 ................................ ................................ ................................ ..................61
ĐỊNH TUYẾN GIỮA CÁC VLAN ................................ ................................ .......61
1. Cấu hình đầy đủ ................................ ................................ ...........................61
2. Các bước thực hiện ................................ ................................ ......................62
3. Kiểm tra................................ ................................ ................................ ........65
LAB 2-4 ................................ ................................ ................................ ..................70
VLAN TRUNKING................................ ................................ ................................ 70
1. Mô tả ................................ ................................ ................................ ............70
2. Cấu hình ................................ ................................ ................................ .......70
3. Thực hiện ................................ ................................ ................................ .....73
4. Kiểm tra................................ ................................ ................................ ........77
LAB 2-5 ................................ ................................ ................................ ..................81
LÀM VIỆC VỚI TFTP SERVER................................ ................................ ...........81
1. Mô tả ................................ ................................ ................................ ............81
2. Thực hiện ................................ ................................ ................................ .....81
PHẦN 3 : ĐỊNH TUYẾN TRÊN ROUTER................................ ...........................85
LAB 3-1: ................................ ................................ ................................ .................85
ĐỊNH TUYẾN TRÊN ROUTER CISCO................................ ............................... 85
LAB 3-2: ................................ ................................ ................................ .................89
CẤU HÌNH ĐỊNH TUYẾN TĨNH ................................ ................................ .........89
1. Mô tả và yêu cầu: ................................ ................................ .........................89
2. Cấu hình: ................................ ................................ ................................ ......89
3. Các bước thực hiện: ................................ ................................ .....................90
LAB 3-3: ................................ ................................ ................................ .................95
CẤU HÌNH RIP CƠ BẢN................................ ................................ ......................95
1. Mô tả & yêu cầu................................ ................................ ...........................95
2. Cấu hình ................................ ................................ ................................ .......95
3. Các bước thực hiện ................................ ................................ ......................97
4. Kiểm tra................................ ................................ ................................ ........99
LAB 3-4: GIAO THỨC ĐỊNH TUYẾN RIP ................................ .......................102
1. Mô tả và yêu cầu: ................................ ................................ .......................102
2. Cấu hình: ................................ ................................ ................................ ....102
3. Các bước thực hiện: ................................ ................................ ...................103
LAB 3-5: CẤU HÌNH PASSIVE INTERFACE ................................ ..................108
1. Mô tả và yêu cầu: ................................ ................................ .......................108
2. Cấu hình: ................................ ................................ ................................ ....108
3. Kiểm tra: ................................ ................................ ................................ ....110
LAB 3-6: ................................ ................................ ................................ ...............112
CẤU HÌNH IGRP CƠ BẢN................................ ................................ .................112
1. Mô tả và yêu cầu: ................................ ................................ .......................112
2. Cấu hình: ................................ ................................ ................................ ....112
3. Các bước thực hiện: ................................ ................................ ...................114
4. Kiểm tra & giải quyết sự cố: ................................ ................................ ......115
LAB 3-7: ................................ ................................ ................................ ...............118
CẤU HÌNH IGRP PASSIVE INTERFACE ................................ .........................118
1. Mô tả & yêu cầu:................................ ................................ ........................118
2. Cấu hình: ................................ ................................ ................................ ....118
3. Kiểm tra: ................................ ................................ ................................ ....120
LAB 3-8: ................................ ................................ ................................ ...............123
CẤU HÌNH IGRP UNEQUAL-COST LOAD BALANCING ............................123
1. Mô tả & yêu cầu:................................ ................................ ........................123
2. Cấu hình: ................................ ................................ ................................ ....123
3. Kiểm tra: ................................ ................................ ................................ ....125
LAB 3-9: ................................ ................................ ................................ ...............128
RIP & DISCONTIGUOUS NETWORKS ................................ ............................128
1. Mô tả: ................................ ................................ ................................ .........128
2. Cấu hình: ................................ ................................ ................................ ....128
3. Các bước thực hiện: ................................ ................................ ...................129
4. Kiểm tra và giải quyết sự cố: ................................ ................................ .....130
LAB 3-10: ................................ ................................ ................................ .............133
REDISTRIBUTE GIỮA RIP & IGRP ................................ ................................ .133
1. Mô tả: ................................ ................................ ................................ .........133
2. Cấu hình: ................................ ................................ ................................ ....133
3. Các bước thực hiện: ................................ ................................ ...................135
LAB 3-11: ................................ ................................ ................................ .............141
CẤU HÌNH EIGRP CƠ BẢN................................ ................................ ...............141
1. Mô tả: ................................ ................................ ................................ .........141
2. Cấu hình: ................................ ................................ ................................ ....141
3. Các bước thực hiện: ................................ ................................ ...................143
4. Kiểm tra: ................................ ................................ ................................ ....144
LAB 3-12: ................................ ................................ ................................ .............147
REDISTRIBUTE GIỮA EIGRP & IGRP ................................ ............................147
1. Mô tả: ................................ ................................ ................................ .........147
2. Cấu hình: ................................ ................................ ................................ ....147
3. Các bước thực hiện: ................................ ................................ ...................149
4. Kiểm tra: ................................ ................................ ................................ ....150
LAB 3-13: ................................ ................................ ................................ .............153
CẤU HÌNH OSPF CƠ BẢN................................ ................................ .................153
1. Mô tả: ................................ ................................ ................................ .........153
2. Cấu hình: ................................ ................................ ................................ ....154
3. Các bước thực hiện: ................................ ................................ ...................155
4. Kiểm tra và giải quyết sự cố: ................................ ................................ .....157
PHẦN 1 : CẤU HÌNH ROUTER
LAB 1-1:
ĐĂNG NHẬP VÀO ROUTER – GIAO DIỆN DÒNG LỆNH
1. Yêu cầu
Bài thực hành này giúp người đọc làm quen với chế độ lệnh (CLI-Command Line
Interface) và một số lệnh cơ bản của hệ điều hành CiscoIOS.
2. Hướng dẫn
a) Nối cáp
– Để đảm bảo an toàn thiết bị trong khi thực hành, cần phải tắt hoàn toàn nguồn điện
các thiết bị trong khi nối cáp. Dùng cáp Console (cáp Rolled) nối cổng COM1 của
máy PC (dùng Terminal chuyển đổi từ DB-9 sang RJ45) với cổng Console của
Router.
– Kiểm tra lại dây đảm bảo đã nối chắc chắn.
b) Đăng nhập vào router
Khởi động Windows, vào HyperTerminal
Start - Programs - Accessories - Communications - Hyper Terminal
- Name: <tên file lưu trữ >
- Icon: chọn biểu tượng tuỳ thích.
Connect using : COM1
– Thiết lập cấu hình như trong hộp thoại sau:
Khởi động Router
– Bật nguồn cho Router.
– Xem các thông tin về Router được hiển thị trên HYPER TERMINAL.
System Bootstrap, Version 11.0(10c), SOFTWARE

Version của IOS đang lưu trong ROM
Copyright (c) 1986-1996 by cisco Systems
2500 processor with 14336 Kbytes of main memory ← Cho biết loại bộ xử lý
Router (2500) và dung lượng bộ nhớ RAM
Notice: NVRAM invalid, possibly due to write erase.
F3: 4+573916 at 0x3000060
Restricted Rights Legend
Use, duplication, or disclosure by the Government is subject to restrictions as set
forth in subparagraph (c) of the Commercial Computer Software – Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in
Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-I-L), Version 12.1(3), RELEASE SOFTWARE
(fc1)

Version của IOS đang lưu trong flash
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Thu 06-Jul-00 07:33 by cmong
Image text-base: 0x0303E710, data-base: 0x00001000
cisco 2509 (68030) processor (revision M) with 14336K/2048K bytes of memory.
Processor board ID 07143970, with hardware revision 00000000
Bridging software.
X.25 software, Version 3.0.0.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
8 terminal line(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read ONLY)
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
Would you like to terminate autoinstall? [yes]:
Press RETURN to get started!
– Nhấn Enter để tiếp tục xuất hiện dấu nhắc đợi lệnh, lúc này đang ở user mode, để vào
priviledge mode, dùng lệnh enable
Router>_
Router>enable
Router#
– Để quay lại user mode bằng lệnh disable hoặc lệnh exit
Router#disable
Router>
– Dùng lệnh logout để thoát chế độ dòng lệnh
Router>logout
Router con0 is now available
Press RETURN to get started.
– Bạn đang ở chế độ user mode, nhập ký tự ? (chấm hỏi) để xem các lệnh được dùng
trong chế độ này:
Router>?
Exec commands:
access-enable Create a temporary Access -List entry
access-profile Apply user-profile to interface
clear Reset functions
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
help Description of the interactive help system
lock Lock the terminal
login Log in as a particular user
logout Exit from the EXEC
mrinfo Request neighbor and version information from a multicast
router
mstat Show statistics after multiple multicast traceroutes
mtrace Trace reverse multicast path from destination to source
name-connection Name an existing network connection
pad Open a X.29 PAD connection
ping Send echo messages
ppp Start IETF Point-to-Point Protocol (PPP)
resume Resume an active network connection
--More—
Nếu số hàng thông tin cần hiển thị nhiều hơn một trang màn hình (25 hàng), cuối màn
hình hiện chữ --More-- bạn nhấn phím ENTER để xem hàng kế tiếp, hoặc phím SPACE
để xem trang kế tiếp. Nếu bạn nhấn phím ENTER, thông tin sẽ hiển thị thêm từng hàng.
Nếu bạn dùng SPACE BAR, thông tin sẽ hiển thị theo trang màn hình.
– Lệnh giúp đỡ (?) rất hữu dụng, bạn có thể dùng trong bất kỳ chế độ nào, Router sẽ đưa
ra các mục chọn được phép sử dụng và ý nghĩa của lệnh đó. Ví dụ bạn muốn xem tiếp các
phần của lệnh show, bạn gõ:
Router>show ?
Hoặc bạn không nhớ tất cả những lệnh bắt đầu bằng các k tự te, bạn có thể gõ:
Router>te?
Telnet Terminal
Khi đó, router sẽ liệt kê tất cả các lệnh bắt đầu bằng t e.
– Hệ điều hành trong Router Cisco cho phép gõ tắt. Bạn chỉ cần gõ số ký tự đủ để phân
biệt các câu lệnh với nhau là câu lệnh được chấp nhận, hoặc bạn nhấn phím TAB để hiện
đầy đủ câu lệnh.
Router>tel[TAB]
Router>telnet
– Vào chế độ global-configuration-mode, dùng lệnh configuration terminal
Router#configuration terminal
Enter configuration commands, one per line. End with CNTL/Z.
– Một số tổ hợp phím tắt: Kỳ thi CCNA đòi hỏi người học phải sử dụng thành thạo tổ hợp
các phím tắt này. Ngòai ra, một số chương trình dùng làm terminal có thể không hỗ trợ
các tổ hợp phím này.
Ctrl-A
Trở về đầu dòng
Ctrl-B
Mũi tên trái
Trở về một ký tự
Esc-B
Trở về một từ
Ctrl-E
Đến cuối dòng
Ctrl-F
Mũi tên phải
Tới một ký tự
Ctrl-P
Mũi tên lên
Đến câu lệnh đã thực hiện trước đó
Ctrl-N
Mũi tên xuống
Đến câu lệnh đã thực hiện sau câu lệnh đó
c) Xem thông tin về cấu hình của router
Tại chế độ privileged mode, bạn hãy thực hiện các lệnh sau, và kiểm tra kết quả của từng
lệnh:
show version
Xem tên files IOS, version của IOS đang sử dụng, cấu hình phần cứng của Router,
chế độ BOOT (thanh ghi)
show flash:
dir flash
Xem file IOS đang lưu trong flash
dir nvram
Xem các file đang lưu trong NVRAM
show interface [interface]
Xem cấu hình của tất cả các cổng hay của cổng được chỉ định
show running-config
Xem cấu hình chung đang sử dụng
show startup-config
show configuration
Xem cấu hình chung dùng cho khởi động (lưu trong NVRAM)
show clock
Xem đồng hồ
show user
Xem các kết nối đang truy cập vào Router
show line
Xem tất cả các kết nối (line) của Router
show ip route
Xem bảng chọn đường của Router
show arp
Xem bảng tương ứng (map) từ địa chỉ MAC và địa chỉ IP
show host
Xem tên và địa chỉ của các host đã biết (đã được đặt tên)
– Xoá cấu hình được router dùng lúc khởi động: dùng lệnh erase startup-config. Khi đã
thực hiện lệnh này, nếu xem lại cấu hình khởi động, bạn sẽ nhận thông báo lỗi
Router#erase startup-config
Erasing the nvram filesystem will remove all files!
Continue? [confirm]
[OK]
Erase of nvram: complete
Router#sh start
%% Non-volatile configuration memory is not present
Router#
d) Sử dụng HYPER TERMINAL
Sử dụng trình tiệc ích truyền file của HYPER TERMINAL
– Để có thể cấu hình nhanh một Router, bạn có thể soạn thảo trước các câu lệnh bằng
NotePad theo đúng trình tự, lưu dưới dạng file text, sau đó dùng Send Text File...
(Transfer -> Send Text File...) để truyền File:
Ví dụ: bạn soạn thảo file SHOW.TXT như sau:
show version
show flash:
show running-config
show startup-config
configuration terminal
exit
– Cách truyền file chỉ hữu dụng với các lệnh cấu hình không có các thông số xác nhận
(một dòng là câu lệnh hoàn chỉnh), không thực hiện được cho các câu lệnh có thông số
lựa chọn. Chẳng hạn: không nên dùng cho lệnh enable (vì có thể phải xác nhận mật
khẩu), không thể dùng cho lệnh lưu cấu hình vào NVRAM vì có xác nhận tên file:
Router#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Chỉnh thời gian trễ dòng lệnh
Để có thể theo dõi kịp các thông báo, bạn cài thời gian trễ khi truyền từng dòng khoảng
2000ms - 4000ms (Chọn File – Properties – ASCII Setup ...)
Capture thao tác
– Trong quá trình làm Lab, bạn muốn ghi lại các thao tác, các thông tin của Router khi
thực hành, bạn sử dụng Capture của Hyper -Terminal (Transfer – Capture Text ... )
– Bạn hãy nhập tên file với đường dẫn đầy đủ. Bắt đầu từ lúc này, tất cả các thao tác của
bạn và kết quả đều được ghi lại. Khi thực hiện xong, nhớ Stop Capture (Transfer ->
Capture Text -> Stop) để lưu file và sử dụng WordPad để xem lại.
LAB 1-2:
ĐẶT MẬT KHẨU CHO ROUTER
1. Mô tả
Thông thường có các loại mật khẩu để bảo mật cho một router Cisco như sau:
– Loại mật khẩu đầu tiên là enable. Lọai này được sử dụng để vào chế độ enabled
mode. Router sẽ yêu cầu bạn nhập mật khẩu này vào khi bạn đánh lệnh enable từ user
mode để chuyển sang chế độ enable mode.
– Ba loại còn lại là mật khẩu khi người dùng truy cập qua cổng console, cổng Aux, hay
Telnet.
¤ Mật khẩu có phân biệt chữ hoa hay chữ thường (case sensitive), và không quá 25 ký tự.
Các ký tự này có thể là chữ hoa, chữ thường, con số, các dấu chấm câu và khoảng cách;
tuy nhiên ký tự đầu tiên không được là dấu trắng.
2. Thực hiện
Mật khẩu truy cập vào enable mode
– Hai loại enable mật khẩu trên router, đặt bằng các lệnh sau:
Router(config)#enable secret vip ¬ mật khẩu là vip
Router(config)#enable password cisco ¬ mật khẩu là cisco
– Ở chế độ mặc định, mật khẩu ở dạng không mã hóa (clear-text) trong file cấu hình;
Lệnh enable secret password sẽ mã hóa các mật khẩu hiện có của router . Nếu có đặt
enable secret, nó sẽ có hiệu lực mạnh hơn các mật khẩu còn lại.
Mật khẩu truy cập vào User Mode
a. Đặt mật khẩu cho user mode bằng lệnh line, xem xét các thông số theo sau bằng
cách đánh dấu ? sau lệnh line.
Router(config)#line ?
<0-4> First Line number
aux Auxiliary line
console Primary terminal line
vty Virtual terminal
– aux đặt mật khẩu cho cổng aux, thường dùng khi cấu hình cho modem gắn router,
quay số vào để cấu hình router.
– console đặt mật khẩu trước khi vào user mode
– vty đặt mật khẩu để telnet vào router. Nếu không đặt mật khẩu, không thể thực hiện
telnet vào router.
Để đặt mật khẩu cho user mode, cần xác định line muốn cấu hình và dùng lệnh login để
router đưa ra thông báo chứng thực đòi hỏi nhập mật khẩu.
b.Đặt mật khẩu trên cổng aux của router:
Vào global config mode đánh lệnh line aux 0.
Chú ý rằng chỉ được chọn số 0 vì thông thường chỉ có một cổng auxilary trên router.
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line aux 0
Router(config-line)#login
Router(config-line)#password vip
Câu lệnh login rất quan trọng, nếu không có lệnh này, router sẽ không thông báo đòi hỏi
chứng thực.
c. Đặt mật khẩu truy cập cho cổng console tr ên router: dùng lệnh line console 0
Router(config)#line console 0
Router(config-line)#login
Router(config-line)#password vnpro
d. Đặt mật khẩu telnet: dùng lệnh line vty
Router(config-line)#line vty 0 4
Router(config-line)#login
Router(config-line)#password vnpro
Sau khi router cấu hình địa chỉ IP, bạn có thể dùng chương trình Telnet để cấu hình và
kiểm tra router thay vì sử dụng cáp console.
3. Kiểm tra
Kiểm tra lại các loại mật khẩu đã đặt bằng cách xem cấu hình hiện tại đang chạy, thực
hiện lệnh show running-config:
Router#show running-config
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router
!
enable secret 5 $1$Y3Hx$iF7j2hPkFe6/hwJG.NZOg.
enable password cisco
!
!
interface Ethernet0
no ip address
shutdown
!
interface Serial0
no ip address
shutdown
!
!
line con 0
password rrr
login
line aux 0
password vip
login
line vty 0 4
password RRR
login
!
end
Trong cấu hình ta thấy enable secret password ở dạng mã hóa. Các mật khẩu khác ở dạng
không mã hóa. Hệ điều hành Cisco IOS cho phép mã hóa tất cả các mật khẩu trong file
cấu hình bằng lệnh service password-encryption tại global configuration mode:
Router#
Router#conf ter
Router(config)#service password-encryption
Router(config)# [Ctrl–Z]
Router#show running-config
Building configuration...
Current configuration:
!
version 12.0
service password-encryption
!
hostname Router
!
enable secret 5 $1$Y3Hx$iF7j2hPkFe6/hwJG.NZOg.
enable password 7 01100F175804
!
!
interface Ethernet0
no ip address
shutdown
!
interface Serial0
no ip address
shutdown
!
!
line con 0
password 7 111B0B17
login
line aux 0
password 7 0312521B
login
line vty 0 4
password 7 1520393E
login
!
end
Tất cả các mật khẩu đã được mã hóa. Mật khẩu Enable secret vẫn ở dạng cũ; Mức độ mã
hóa được hiển thị bằng chỉ số đứng ngay trước mỗi mật khẩu. Các giá trị có thể có của
chỉ số này là:
– 7 : mật khẩu được mã hóa theo thuật toán hai chiều MD7; mật khẩu dạng này có thể
giải mã được.
– 5 : mật khẩu được mã hóa theo thuật toán một chiều MD5; không thể giải mã được
dạng này.
– 0 : (hoặc không có giá trị) mật khẩu được hiển thị ở dạng không mã hóa.
Nếu tắt chế độ mã hóa với câu lệnh no service password-encryption, thì mật khẩu vẫn ở
dạng mã hóa trừ khi đặt lại mật khẩu.
LAB 1-3:
CÁC LỆNH CƠ BẢN CỦA HỆ ĐIỀU HÀNH CISCO IOS
1. Đặt router banner
Đặt lời chào khi người dùng đăng nhập qua cổng console hay telnet vào router. Trong
thực tế, lệnh banner được dùng để ra các cảnh báo đối với các truy cập trái phép v ào
router. Lệnh này chỉ có tính chất cung cấp thông tin về hệ thống mà người dùng đang
truy cập vào.
– Câu lệnh thực hiện tại global configuration mode như sau
Router(config)#banner ?
LINE c banner-text c, where 'c' is a delimiting character
exec Set EXEC process creation banner
incoming Set incoming terminal line banner
login Set login banner
motd Set Message of the Day banner
– Tham số motd thường hay được sử dụng nhất. Thông số này đưa ra thông báo cho mọi
người khi quay số hay kết nối với router thông qua Telnet , cổng aux hay cổng console.
Router(config)#banner motd ?
LINE c banner-text c, where 'c' is a delimiting character
Router(config)#banner motd #
Enter TEXT message. End with the character '#'.
Chao cac hoc vien lop CCNA
#
Router(config)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#exit
Router con0 is now available
Press RETURN to get started.
Chao cac hoc vien lop CCNA
Router>
– Để loại bỏ banner dùng lệnh no banner login
Router#
Router#conf t
Router(conf)#no banner login
2. Cấu hình các cổng giao tiếp trên router:
Cấu hình các cổng giao tiếp của router là một trong những tác vụ cấu hình quan trọng
nhất trong qui trình cấu hình một thiết bị định tuyến router . Tác vụ này phải chính xác để
router có thể trao đổi các thông tin với các thiết bị khác cũng như là có thể trao đổi được
dữ liệu. Các bước cấu hình như sau:
– Tại chế độ cấu hình tòan cục, ta dùng lệnh interface [loại interface] [số thứ tự]
– Để cho phép interface hoạt động, hãy dùng lệnh no shutdown.
– Để tắt một interface dùng lệnh shutdown.
– Nếu một interface bị shutdown, trạng thái hiển thị sẽ là administratively down khi
dùng lệnh show interface để xem trạng thái của một cổng giao tiếp . Khi đó, nếu dùng
lệnh show running-config, ta sẽ thấy kết quả lệnh sẽ hi ển thị trạng thái của các giao
tiếp là shutdown.
– Mặc định các interface ở trạng thái shutdown.
Router#sh int e0
Ethernet0 is administratively down, line protocol is down
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int e0
Router(config-if)#no shutdown
Router(config-if)#^Z
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state
to up
Router#sh int e0
Ethernet0 is up, line protocol is up
– Đặt địa chỉ IP cho một interface
Router(config)#int e0
Router(config-if)#ip address 172.16.10.2 255.255.255.0
Router(config-if)#no shut
– Nếu muốn đặt thêm một địa chỉ thứ hai cho cổng giao tiếp, phải dùng tham số
secondary.
– Một cổng giao tiếp của router có thể đặt nhiều địa chỉ IP.
Router(config-if)#ip address 172.16.20.2 255.255.255.0 secondary
Router(config-if)#^Z
Router#sh run
Building configuration
Current configuration:
...
!
interface Ethernet0
ip address 172.16.20.2 255.255.255.0 s econdary
ip address 172.16.10.2 255.255.255.0
!
– Một số lệnh cho cổng serial của router:
Lệnh clock rate: đặt xung clock cho DCE. Nếu đặt lệnh clock rate trên một cổng giao tiếp
không phải là DCE thì câu lệnh không có tác dụng.
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0
Router(config-if)#clock rate ?
Speed (bits per second)
1200
2400
4800
9600
19200
38400
56000
64000
72000
125000
148000
250000
500000
800000
1000000
1300000
2000000
4000000
<300-4000000> Choose clockrate from list above
Router(config-if)#clock rate 64000
%Error: This command applies only to DCE interfaces
Router(config-if)#int s1
Router(config-if)#clock rate 64000
Lệnh bandwith: Ở chế độ mặc định, các cổng giao tiếp của thiết bị định tuyến Cisco
sẽ họat động ở băng thông của T1 (1,544 Mbps). Tuy nhiên, l ệnh bandwidth không ảnh
hưởng gì đến tốc độ truyền dữ liệu thật sự của cổng giao tiếp. Lệnh bandwidth chỉ có tác
động đến quá trình tính tóan metric của các giao thức định tuyến như IGRP, EIGRP hay
OSPF để tính toán chi phí tốt nhất tới một mạng ở xa.
Router(config-if)#bandwidth ?
<1-10000000> Bandwidth in kilobits ← Bandwidth được tính bằng Kbit
Router(config-if)#bandwidth 64
– Mô tả cho cổng giao tiếp: mô tả rất hữu ích cho người quản trị và nó chỉ có tác dụng
cục bộ, dùng lệnh description tại interface mode; để xem lại dùng lệnh show run hay
show interface
Router(config)#int e0
Router(config-if)#description Sales Lan
Router(config-if)#int s0
Router(config-if)#description Ket noi Wan toi DHDN
Router#sh run
[...]
!
interface Ethernet0
description Sales Lan
ip address 172.16.10.30 255.255.255.0
!
interface Serial0
description Ket noi Wan toi PTIT
no ip address
no ip directed-broadcast
no ip mroute-cache
Router#sh int e0
Ethernet0 is up, line protocol is up
Hardware is Lance, address is 0010.7be8.25db (bia 0010.7be8.25db)
Description: Sales Lan
...
Router#sh int s0
Serial0 is up, line protocol is up
Hardware is HD64570
Description: Ket noi Wan toi PTIT
...
Router#
3. Đặt hostname
Đặt tên cho router bằng lệnh hostname, tên chỉ có tác dụng cục bộ. Việc đặt hostname
là cần thiết trong qui trình cấu hình router.
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname RRR
RRR(config)#
4. Lưu cấu hình
Dùng lệnh copy running-config startup-config hay write memory để lưu file cấu
hình từ DRAM vào NVRAM (có thể dùng lệnh tắt copy run start hay wr)
RRR#copy run start
Destination filename [startup-config]?[Enter]
Building configuration...
Xem lại file đã lưu trong NVRAM
RRR#show startup-config
5. Các lệnh kiểm tra cấu hình
– Lệnh ping có thể dùng với các giao thức khác nhau, thực hiện ở user-mode hay
priviledge-mode
RRR#ping ?
WORD Ping destination address or hostname
appletalk Appletalk echo
decnet DECnet echo
ip IP echo
ipx Novell/IPX echo
srb srb echo
<cr>
– Telnet để kiểm tra kết nối IP
RRR#telnet ?
WORD IP address or hostname of a remote system
<cr>
Một cách để kiểm tra hoạt động của cổng giao tiếp của router là dùng lệnh show
interface. Lệnh này sẽ hiển thị trạng thái của tất cả các cổng giao tiếp của router.
Router#sh int ?
Ethernet IEEE 802.3
Null Null interface
Serial Serial
accounting Show interface accounting
crb Show interface routing/bridging info
irb Show interface routing/bridging info
<cr>
Có thể chỉ ra cổng giao tiếp để xem thông tin cụ thể về cổng giao tiếp đó.
RRR#sh int e0
Ethernet0 is up, line protocol is up
Hardware is Lance, address is 0010.7b7f.c26c (bia 0010.7b7f.c26c)
Internet address is 172.16.10.1/24
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set, keepalive set (10 sec)
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:08:23, output 00:08:20, output hang never
Last clearing of "show interface" counters never
Queueing strategy: fifo
...
Một số thông báo sự cố thường gặp đối với cổng giao tiếp serial và cách giải quyết
sự cố (trạng thái liên kết xem bằng lệnh show interface serial x trong đó x là số thứ tự của
cổng).
Trạng thái của liên kết
Nguyên nhân
Cách khắc phục
Serial x is up, line protocol is up
Đã kết nối được.
Serial x is down, line protocol is down.
Router không nhận được tín hiện carrier detect (CD) do một trong các nguyên nhân sau:
Đường kết nối bị down
Cáp kết nối vào router bị hỏng hay sai.
Phần cứng của router bị hỏng
– Xem lại tài liệu hướng dẫn xem cách kết nối cáp và loại cáp đã sử dụng đúng hai
chưa.
– Kết nối vào các cổng khác.
Serial x is administratively down, line protocol is down. Chưa cho phép router cổng hoạt
động. Thực hiện no shutdown trong cấu hình cổng serial ở cả hai phía.
Serial x is up, line protocol is down.
– Cấu hình sai giữa hai router ở hai đầu.
– Remote router không gửi keepalive packet.
– Clock rate chưa được đặt trên Router DCE – Kiểm tra lại cấu hình IP ở hai đầu và
phải đảm bảo encapsulation gi ống nhau.
– Bò lệnh no keepalive ờ hai đầu trong cấu hình cổng serial
– Đặt clock rate cho Router DCE bằng lệnh clock rate xxxxx trong cầu hình cổng serial.
Serial x is up, line protocol is up (looped).
(trạng thái này ít gặp trong lab) Gây nên do trạng thái lặp của đường truyền.
– Dùng lệnh show running–config để xem xét có cổng nào bị cấu hình dưới dạng loop
hay không. Nếu có, bỏ trạng thái này đi.
– Reset lại cổng bằng lệnh shutdown, rồi sau đó no shutdown.
LAB 1-4:
CISCO DISCOVERY PROTOCOL
1. Mô tả
–Cisco Discovery Protocol (CDP) là giao thức riêng của Cisco dùng để thu thập thông tin
về các thiết bị lân cận. Khi sử dụng giao thức CDP, bạn có thể biết được thông tin phần
cứng, phần mềm của các thiết bị gần kề. Thông tin này rất hữu ích trong quá trình xử lý
sự cố hay kiểm soát các thiết bị trong một hệ thống mạng.
–Bài thực hành này giúp bạn biết được các chức năng và thông số của các lệnh liên quan
tới CDP.
+ CDP chỉ cung cấp thông tin về thiết bị nối kết nối trực tiếp, trái với giao thức định
tuyến. Giao thức định tuyến cung cấp thông tin cho phép router xác định chặng kế cho
các mạng muốn tới.
2. Thực hiện
Trước tiên, cấu hình các router như sau. Mặc định, các thiết bị Cisco đã có cho phép giao
thức CDP. Do đó, khi dùng lệnh show run, thông tin về CDP sẽ không đ ược hiển thị.
RouterA
!
hostname RouterA
!
interface serial0
ip address 172.16.10.1 255.255.255.0
clock rate 64000 ←hoạt động như là DCE cung cấp xung clock
no shut
!
interface ethernet0
ip address 192.168.0.1 255.255.255.0
no shut
!
no ip classless
!
line console 0
line aux 0
line vty 0 4
login
!
end
RouterB
!
hostname RouterB
!
interface serial0
ip address 172.16.10.2 255.255.255.0
no shut
!
no ip classless
!
line console 0
line aux 0
line vty 0 4
login
!
End
a) Để xem thông tin về các thông số thời gian của CDP , dùng lệnh show
cdp (hay sh cdp)
Router#sh cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Router#
Dùng lệnh cdp holdtime và cdp timer để đặt lại thời gian gởi và thời gian giữ gói
cho router.
– CDP timer là chu kỳ gởi gói CDP tới tới tất cả cổng đang hoạt động.
– CDP holdtime là khoảng thời gian thiết bị giữ gói nhận được từ láng giềng.
RouterA#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#cdp ?
holdtime Specify the holdtime ( in sec) to be sent in packets
timer Specify the rate at which CDP packets aresent(in sec)
run
RouterA(config)#cdp timer 90
RouterA(config)#cdp holdtime 240
RouterA(config)#^Z
Bạn có thể tắt hòan tòan giao thức CDP trong thiết bị Cisco với lệnh no cdp run. Để
tắt CDP trên một cổng sử dụng câu lệnh no cdp enable trên cổng đó.
b) Lệnh show cdp neighbor (viết tắt sh cdp nei) hiện thông tin về thiết bị
nối trực tiếp.
RouterA#sh cdp nei
Capability Codes: R - Router, T - Trans Bridge,
B - Source Route Bridge, S - Switch, H - Host,
I - IGMP, r - Repeater
Device ID Local Interfce Holdtme Capability Platform Port ID
Switch Eth 0 238 T S 1900 2
RouterB Ser 0 138 R 2500 Ser 0
RouterA#
Một lệnh khác cho biết thông tin về các thiết bị láng giềng là show cdp neighbor detail
(show cdp nei de), cũng có thể chạy trên router và switch
RouterA#sh cdp neighbor detail
-------------------------
Device ID: 1900Switch
Entry address(es):
IP address: 0.0.0.0
Platform: cisco 1900, Capabilities: Trans -Bridge Switch
Interface: Ethernet0, Port ID (outgoing port): 2
Holdtime : 166 sec
Version :
V9.00
-------------------------
Device ID: 2501B
Entry address(es):
IP address: 172.16.10.2
Platform: cisco 2500, Capabilities: Router
Interface: Serial0, Port ID (out going port): Serial0
Holdtime : 154 sec
<...>
RouterA#
Ngoài ra, lệnh show cdp entry * cũng hiển thị thông tin tương tư.̣
Lệnh show cdp traffic hi ển thị lưu lượng tại cổng gồm cả số gói CDP gởi nhận và bị lỗi :
RouterA#sh cdp traffic
CDP counters:
Packets output: 13, Input: 8
Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
No memory: 0, Invalid packet: 0, Fragmented: 0
RouterA#
c) Thông tin trạng thái CDP trên port hay cổng hiển thị bằng lệnh show
cdp interface (sh cdp int)
Như đã đề cập trước, có thể tắt CDP hoàn toàn trên router dùng lệnh no cdp run. Tuy
nhiên, muốn tắt CDP trên từng cổng dùng lệnh no cdp enable. Có thể cho phép CDP trên
một port bằng lệnh cdp enable.
Trên router, show cdp interface cho thông tin về từng cổng dùng CDP, gồm cả dạng đóng
gói trên đường truyền, timer và holdtime trên mỗi cổng
RouterA#sh cdp interface
Ethernet0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial0 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial1 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Tắt CDP trên một cổng
RouterA#config t
Enter configuration commands, one per line. End withCNTL/Z.
RouterA(config)#int s0
RouterA(config-if)#no cdp enable
RouterA(config-if)#^Z
Kiểm tra lại sự thay đổi đó.
RouterA#sh cdp int
Ethernet0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial1 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Router#
Lưu ý rằng serial 0 không được liệt kê khi thực hiện lệnh trên, nếu dùng lệnh cdp enable
trên serial 0, cổng này sẽ hiển thị.
LAB 1-5:
SỬ DỤNG TELNET
1. Mô tả
–Telnet là một giao thức đầu cuối ảo (virtual terminal) là một phần của chồng giao thức
TCP/IP. Telnet cho phép tạo kết nối với thiết bị từ xa, thu thập thông tin và chạy chương
trình.
–Lab này hướng dẫn dùng lệnh telnet và các lệnh liên quan trên router.
+ Virtual terminal (VTY) lines cho phép việc truy cập vào router thông qua các phiên nối
kết Telnet. VTY lines không nối trực tiếp vào các cổngs như cách TTY nối vào
asynchronous interface mà là các kết nối “ảo” vào router thông qua địa chỉ của ethernet
port (cổng ethernet). Router tạo những VTY lines một cách linh động, trong khi đó TTY
lines là chỉ nối kết vào những cổng vật lý. Khi người dùng kết nối vào router bằng VTY
line, người dùng đó đang kết nối vào một cổng ảo trên cổng.
2. Thực hiện
Ban đầu cấu hình router như sau
RouterA
!
hostname RouterA
!
interface serial0
ip address 172.16.10.1 255.255.255.0
clock rate 64000 ←hoạt động như là thiết bị DCE cung cấp xung clock
no shut
!
interface ethernet0
ip address 192.168.0.1 255.255.255.0
no shut ← cho phép cổng
!
line console 0
line aux 0
line vty 0 4
login
!
end
RouterB
!
hostname RouterB
!
interface serial0
ip address 172.16.10.2 255.255.255.0
no shut
!
line console 0
line aux 0
line vty 0 4
login
!
end
Đặt địa chỉ IP, mật khẩu dùng để telnet cho Switch
– Với Catalyst 2900
!
hostname Switch
!
enable password cisco
!
interface vlan1
ip address 192.168.0.148 255.255.255.0
!
line vty 0 15
login
password cisco
!
End
Tiến hành các bước sau đây để kiểm tra kết quả:
a) Thử dùng lệnh telnet trên router:
RouterA#telnet 172.16.10.2
Trying 172.16.10.2 ... Open
Password required, but none set
[Connection to 172.16.10.2 closed by foreign host]
RouterA#
+ Đối với Cisco router, bạn không cần phải dùng lệnh telnet mà chỉ cần đánh địa chỉ IP
tại dấu nhắc, router sẽ ngầm định rằng bạn muốn telnet vào thiết bị, ví dụ:
RouterA#172.16.10.2
Trying 172.16.10.2 ... Open
Password required, but none set
[Connection to 172.16.10.2 closed by foreign host]
RouterA#
Trong trường hợp trên, mật khẩu chưa được đặt cho đường VTY nên ta không thể telnet
vào RouterB được. Đặt mật khẩu cho đường VTY như sau
RouterB#config t
Enter configuration commands, one per line. End with CNTL/Z.
RouterB(config)#line vty 0 4
RouterB(config-line)#login
RouterB(config-line)#mật khẩu Router
RouterB(config-line)#^Z
RouterB#
Thử truy cập bằng cách telnet vào router lần nữa:
RouterA#172.16.10.2
Trying 172.16.10.2 ... Open
User Access Verification
Mật khẩu:
RouterB>
Chú ý rằng mật khẩu VTY là mật khẩu ở user-mode, không phải là enable–mode nên
không thể vào enable mode nếu chưa đặt enable password.
RouterB>en
% No password set
RouterB>
b) Telnet vào nhiều thiết bị đồng thời
Bạn có thể giữ kết nối mà trở về router console ban đầu bằng cách nhấn Ctrl+Shift+6
đồng thời, sau đó thả ra và nhấn X.
RouterA#telnet 172.16.10.2
Trying 172.16.10.2 ... Open
User Access Verification
Mật khẩu:
RouterB>[Ctrl+Shift+6, x]
RouterA#
Telnet tiếp tục vào switch
RouterA#telnet 192.168.0.148
Trying 192.168.0.148 ... Open
...
Switch>[Ctrl+Shift+6, x]
RouterA#
c) Kiểm tra các kết nối telnet bằng lệnh show sessions.
RouterA#sh sessions
Conn Host Address Byte Idle Conn Name
1 172.16.10.2 172.16.10.2 0 0 172.16.10.2
* 2 192.168.0.148 192.168.0.148 0 0 192.168.0.148
RouterA#
Dấu (*) nghĩa là session cuối cùng bạn dùng; có thể trở lại session cuối bằng cách nhấn
Enter hai lần. Hay muốn tới session bất kỳ bằng cách gõ số của kết nối và nhấn Enter hai
lần.
–Kiểm tra Telnet Users
RouterA#sh users
Line User Host(s) Idle Location
* 0 con 0 172.16.10.2 00:07:52
192.168.0.148
Ký hiệu con tượng trưng cho local console.
RouterB>sh users
Line User Host(s) Idle Location
0 con 0 idle 9
* 2 vty 0
Thông tin hiển thị console đang hoạt động và VTY port 2 đang được dùng. Dấu * phiên
người dùng hiện tại.
d) Đóng phiên làm việc Telnet
–Có thể đóng phiên làm việc bằng các nhấn exit hay disconnect
RouterA#[Enter] [Enter]
[Resuming connection 2 to 192.168.0.148 ... ]
Switch>exit
[Connection to 192.168.0.148 closed by foreign h ost]
RouterA#disconnect ? ← tham số theo sau là số thứ tự Conn hiển thị trong lệnh
show sessions
<1-2> The number of an active network connection
WORD The name of an active network connection
<cr>
RouterA#disconnect 1
Closing connection to 172.16.10.2 [confirm]
RouterA#
–Để ngắt một kết nối của một user dùng lệnh clear line
RouterB#clear line 2 ← tham số theo sau là số thứ tự line hiển thị trong lệnh show users
[confirm]
[OK]
LAB 1-6:
KHÔI PHỤC MẬT KHẨU CHO CISCO 2600, 3600
1. Mô tả
–Quá trình khởi động của router đã được định trước. Sau quá trình kiểm tra bật nguồn
(POST) và nạp hệ điều hành IOS, router sẽ nạp cấu hình họat động trong NVRAM. Các
cấu hình này không chỉ chứa thông tin giao thức định tuyến, địa chỉ mà còn chứa mật
khẩu của router.
–Mật khẩu được phục hồi bằng cách bỏ qua nội dung file cấu hình trong NVRAM trong
quá trình khởi động. Việc bỏ qua cấu hình được thực hiện bằng cách sửa đổi nội dung
thanh ghi cấu hình (configuration register) của router. Lúc này router sẽ không cấu hình
chứa mật khẩu cần phục hồi. Khi đã vào được router, người dùng có thể xem mật khẩu
trong NVRAM và có thể sử dùng, xoá hay thay đổi chúng. Kỹ thuật hồi phục mật khẩu
khác nhau đối với các dòng router, tổng quát cách thực hiện:
1.Nối terminal vào console port.
2.Tắt router và bật lại.
3.Phải ngắt quá trình khởi động của router và đưa nó về monitor mode.
4.Tại monitor mode, cấu hình router sao cho router khởi động mà không đọc nội dung file
cấu hình trong NVRAM.
5.Khởi động lại router.
6.Sau khi router khởi động lại, mật khẩu sẽ không còn tác dụng. Vào privileged mode,
xem, thay đổi, hay xoá NVRAM mật khẩu.
7.Vào configuration mode và đặt lại thanh ghi để router khởi động từ NVRAM.
8.Nạp lại router. Lúc này mật khẩu đã biết.
+ Khôi phục mật khẩu chỉ có thể thực hiện trên terminal gắn với cổng console của router.
Các cách này không thể thực hiện được với cổng aux của router.
2. Cách thực hiện
Phần này hướng dẫn cách khôi phục mật khẩu cho router Cisco 3600 series, Cisco
2600 series.
Trước khi bắt đầu, router phải đặt enable mật khẩu hay login mật khẩu.
Router
!
hostname Cisco3600
!
enable pass cisco ← enable mật khẩu
!
no ip classless
!
line console 0
password cisco ← Login mật khẩu
login
line aux 0
line vty 0 4
login
!
end
a.Tắt router và bật trở lại. Trong quá trình boot, sẽ xuất hiện các dòng sau:
...
Copyright (c) 1994-1996 by cisco system, Inc.
C3600 processor with 16384 Kbytes of main memory
Main memory is configure to 32 bit mode with parity disabled ← Nhấn ngắt
(Ctrl+Break) tại đây.
+ Nhấn ngắt ngay khi bật router có thể làm đứng router. Tốt nhất là chờ nhấn ngắt khi
router hiện thông báo về kích thước bộ nhớ chính của router.
Bạn cũng có thể nhấn Ctrl+Break trong 15 giây đầu tiên.
Lưu ý rằng đối với các chương trình terminal tổ hợp phím ngắt khác nhau. Phổ biến là
Windown HyperTerminal dùng tổ hợp phím Ctrl+Break để ngắt.
b.Lúc này router vào monitor mode, thực hiện lệnh confreg 0x2142
Moniror: command “boot” aborted due to user interrupt
rommon 1 >
rommon 1 > confreg 0x2142
c.Router sẽ nhắc phải reset lại để thay đổi có tác dụng, đánh lệnh reset tại dấu nhắc:
You must reset or power cycle
rommon 2 >
rommon 2 > reset
Router sẽ nạp lại. Lúc này router đã bỏ qua cấu hình trong NVRAM. Khi khởi động
xong, nhấn Enter vào user mode và đánh enable để vào privileged mode:
Press Return to get START
Router>
Router>enable
Router#
Dùng lệnh show running–configuration để xem cấu hình hiện tại. Chú ý rằng cấu hình
không chứa loại mật khẩu nào. Đây là cấu hình mặc định của router khi bỏ qua file cấu
hình trong NVRAM:
Current configuration:
!
version 11.2
...
!
line con 0 ← không có mật khẩu
line aux 0
line vty 0 4
login
!
end
Nếu muốn xem mật khẩu hiện tại và tiếp tục sử dụng nó, dùng lệnh show startup–
configuration. Từ cấu hình bạn có thể thấy enable mật khẩu và console mật khẩu là
“cisco”. Nếu mật khẩu đã mã hoá bạn sẽ phải thay đổi hay xoá nó.
Router#sh start
Using 355 out of 30712 bytes
!
hostname Cisco3600
!
enable pass cisco ←enable mật khẩu
!
no ip classless
!
line console 0
mật khẩu cisco ← Login mật khẩu
login
line aux 0
line vty 0 4
login
!
end
+ Thay đổi: Để thay đổi mật khẩu hiện thời bạn phải chép cấu hình NVRAM vào running
configuration bằng lệnh copy start run.Vào config mode bằng lệnh config term. Đặt lại
mật khẩu mới. Nhấn Ctrl–Z để thoát khỏi configuration mode khi hoàn tất. Đánh lệnh
write memory hoặc copy run start để lưu cấu hình.
+ Xoá: Có thể xoá mật khẩu bằng lệnh erase start hay write erase
d.Bước cuối cùng thay đổi thanh ghi configuration register để router nạp từ
NVRAM.
Xem cấu hình thanh ghi hiện tại:
Router#sh ver
...
Configuration register is 0x2142
Thay đổi thanh ghi
Router#config term
Router(config)#config–register 0x2102
Router(config)#exit
Dùng lệnh show version để xem ảnh hưởng của cài đặt mới.
Router>sh ver
...
Configuration register is 0x2142 (will be 0x2102 at next reload)
Đánh lệnh reload để nạp lại router và làm cho giá trị thanh ghi mới có tác dụng. Bạn
không cần phải lưu thay đổi.
Router#reload
System configuration has been modified. Save? [yes/no]: n
Proceed with reload? [confirm]
Router sẽ nạp lại. Nó sẽ lấy cấu hình từ NVRAM, mật khẩu của router bây giờ đã biết và
bạn có thể truy cập vào privileged mode của router.
+ Cấu hình bên trong Router gồm những thành phần sau:
RAM/DRAM -- lưu trữ những bảng routing, ARP cache, fast -switching cache, packet
buffering (shared RAM), và packet hold queues; RAM c ũng cung cấp bộ nhớ tạm thời
(running memory) cho file cấu hình của router khi router đang hoạt động; nội dung RAM
mất khi tắt nguồn hoặc restart router.
NVRAM -- non-volatile RAM lưu trữ file cấu hình backup/startup của router; nội dung
của NVRAM vẫn được giử khi tắt nguồn hoặc restart router.
Flash -- có thể xóa, có thể lập trình lại ROM nơi lưu trữ hệ điều hành và một số mã lệnh
(microcode); Bộ nhớ Flash cho phép cập nhập phần mềm mà không cần lấy và thay thế
chip xử lý; Nội dung Flash vẫn được giử khi tắt nguồn hoặc restart; Bộ nhớ Flash có thể
chứa nhiều versions của phần mềm IOS.
ROM -- chứa chương trình kiểm tra khi bật nguồn router, chương trình bootstrap, và
phần mềm hệ điều hành; nâng cấp phần mềm trong ROM đòi hỏi phải lấy và thay thế
chip cắm trên CPU.
Interfaces -- Kết nối mạng trên board mạch chủ hoặc trên interface modules riêng bi ệt,
qua đó những packet đi vào và đi ra router.
LAB 1-7:
NẠP IOS IMAGE TỪ TFTP SERVER CHO ROUTER CHẠY TỪ FLASH
1. Mô tả
– Bài thực hành này mô tả cách nạp IOS từ router chạy từ flash. Một số router chạy từ
flash như Cisco 2500 series hay Cisco 1600 series.
– PC họat động như một TFTP server sẽ nối với router trong cùng mạng LAN. IOS
image mới sẽ chứa trong TFTP server và sẽ được truyền qua Cisco router bằng giao
thức truyền TFTP. Trong hình vẽ này, PC hoạt động như TFTP server còn router sẽ là
TFTP client.
Router chạy từ Flash và router chạy từ RAM
Cisco router có thể thực thi IOS từ RAM hay từ Flash, chạy từ flash chậm hơn.
– Router chạy từ flash là các loại Cisco 2500 series và một số router Cisco 1600 series.
Toàn bộ IOS được nạp vào bộ nhớ flash ở dạng không nén. Cisco IOS chạy từ flash.
Cập nhật IOS mới trở thành vấn đề: làm sao để nạp vào flash trong khi đang thực thi
IOS cũ? Cisco giải quyết điều này bằng một IOS đặc biệt lưu trong ROM. Chương
trình giúp đỡ khởi động sẽ nạp lại router để boot từ ROM. Lúc này Flash có thể cập
nhật và IOS mới sẽ có thể chạy từ flash.
– Router chạy từ RAM là các đời router Cisco 3600, 4000, 7000, và 7500. Các router
này chứa IOS image dạng nén trong flash. Khi khởi động, router sao chép IOS từ
flash vào trong RAM và thực thi IOS trên RAM. Các router này có thể cập nhật dễ
dàng IOS trong flash bằng cách chép phiên bản mới bằng TFTP.
2. Thực hiện
– Ban đầu cấu hình của RouterA như sau
RouterA
!
hostname RouterA
!
interface Ethernet0
ip address 10.10.3.253 255.255.255.0 ← Ethernet interface trên cùng mạng với
TFTP server
no shut ← cho phép cổng
!
line con 0
line aux 0
line vty 0 4
login
!
end
Dùng lệnh show version để tìm phiên bản của IOS hiện có.
RouterA#show version
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-I-L), Version 12.1(3), RELEASE SOFTWARE
(fc1)

Router đang chạy IOS version 12.1(3)
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Thu 06-Jul-00 07:33 by cmong
Image text-base: 0x0303E710, data-base: 0x00001000
ROM: System Bootstrap, Version 11.0(10c), SOFTWARE
BOOTFLASH: 3000 Bootstrap Software (IGS-BOOT-R), Version 11.0(10c),
RELEASE SOFTWARE (fc1)
R1 uptime is 1 hour, 22 minutes
System returned to ROM by power -on
System image file is "flash:c2500-i-l.121-3.bin"

IOS được nạp từ flash
cisco 2511 (68030) processor (revision M) with 14336K/2048K bytes of memory.

Router có 16 MB RAM, 14MB dùng cho bộ nhớ xử lý, 2MB dùng
cho bộ nhớ I/O
Processor board ID 07143970, with hardware revision 00000000
Bridging software.
X.25 software, Version 3.0.0.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
16 terminal line(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read ONLY) ← router có 8 MB
flash
Configuration register is 0x2102
– Xem nội dung bộ nhớ flash dùng lệnh show flash
RouterA#show flash
System flash directory:
File Length Name/status
1 7640212 c2500-i-l.121-3.bin
[7640276 bytes used, 748332 available, 8388608 total]
Để chắc chắn có thể truy cập được TFTP server ở địa chỉ 10.10.3.28, dùng lệnh ping để
kiểm tra.
RouterA#ping 10.10.3.28
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.3.28 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip min/avg/max = 4/4/4 ms
– Sau khi đã kiểm tra kết nối đến TFTP server như trên, ta bắt đầu nạp IOS mới vào
router bằng lệnh copy tftp flash.
– Lưu ý dòng sản phẩm Cisco 2500 là lọai router chạy từ flash.
RouterA#copy tftp flash
**** NOTICE ****
Flash load helper v1.0
This process will accept the copy options and then terminate
the current system image to use the ROM based image for the copy . ← router sẽ
nạp IOS image
trong ROM, IOS này sẽ ghi IOS mới vào flash
Routing functionality will not be available during that time.
If you are logged in via telnet, this connection will terminate.
Users with console access can see the results of the copy operation.
---- ******** ----
Proceed? [confirm]
Address or name of remote host [255.255.255.255]? 10.10. 3.28 ← địa chỉ TFTP
server
Source file name []?c2500-i-l.121-4.bin
Destination file name []?
Accessing tftp://10.10.3.28/c2500-i-l.121-4.bin...
Erase flash: before copying? [confirm] ←xoá nội dung hiện tại của flash
Loading System flash directory:
File Length Name/status
1 7640212 c2500-i-l.121-3.bin
[7640276 bytes used, 748332 available, 8388608 total]
Accessing file 'c2500-i-l.121-4.bin' on 10.10.3.28...
Loading c2500-i-l.121-4.bin from 10.10.3.28 (via Ethernet0):! [OK]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Loading c2500-i-l.121-4.bin from 10.10.3.28 (via Ethernet0):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 7640212/8388608 bytes]
Verifying checksum... OK (0x1FC7)
Flash copy took 0:03:47 [hh:mm:ss]
%FLH: Re-booting system after download
Restricted Rights Legend
...
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-I-L), Version 12.1(4), RELEASE SOFTWARE
(fc1)
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Thu 06-Jul-00 07:33 by cmong
Image text-base: 0x0303E710, data-base: 0x00001000
cisco 2511 (68030) processor (revision M) with 14336K/2048K bytes of memory.
Processor board ID 07143970, with hardware revision 00000000
Bridging software.
X.25 software, Version 3.0.0.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
16 terminal line(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read ONLY)
Press RETURN to get started!
–Sau khi đã nạp IOS mới dùng lệnh show version để kiểm tra lại router đã chạy IOS mới
chưa:
RouterA#show version
– Kiểm tra lại lần nữa bằng show flash.
LAB 1-8:
NẠP IOS IMAGE TỪ TFTP SERVER CHO ROUTER CHẠY TỪ RAM
1. Mô tả
– Cấu hình này mô tả cách nạp IOS image từ router chạy từ RAM. Một số dòng sản
phẩm router chạy từ RAM là Cisco 2600, Cisco 2800, Cisco 3600 series, Cisco 4600
series.
– PC chạy TFTP server nối với router trong cùng mạng LAN. IOS image mới sẽ chứa
trong PC và sẽ truyền qua Cisco router bằng giao thức truyền TFTP. PC hoạt động
như TFTP server, router sẽ là TFTP client.
2. Thực hiện
– Ban đầu cấu hình của RouterA như sau
RouterA
!
hostname RouterA
!
interface Ethernet0/0
ip address 10.10.3.253 255.255.255.0 ← Ethernet interface trên cùng mạng với
TFTP server
!
line con 0
line aux 0
line vty 0 4
login
!
end
– Dùng lệnh show version để tìm phiên bản của IOS hiện có. Lệnh này cung cấp một số
thông tin như dung l ượng bộ nhớ và image của router
RouterA#show version
Cisco Internetwork Operating System Software
IOS(tm)C2600 Software(C2600-JSX-M),Version 12.1(5)XM,EARLY
DEPLOYMENT RELEASE SOFTWARE ↑
Router đang chạy IOS version 11.1 (4)
Image text-base: 0x80008088, data-base: 0x8148BD7C
RouterA uptime is 11 minutes
System restarted by power-on
System image file is "flash: c2600-i-mz.120-3.T3.bin ", booted via flash

IOS được nạp trong flash
cisco 2621 (MPC860) processor (revision 0x102) with 60416K/5120K bytes of
memory.

Router có 64MB DRAM, 60MB dùng cho bộ nhớ xử lý, 4MB dùng cho bộ nhớ
I/O
Processor board ID JAB041708RB (3572412720)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
SuperLAT software (copyright 1990 by Meridia n Technology Corp).
TN3270 Emulation software.
4 Ethernet/IEEE 802.3 interface(s)
2 FastEthernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
32K bytes of non-volatile configuration memory.
16384K bytes of processor board System flash (Read ONLY) ← router có 16 MB
flash
Configuration register is 0x2102
– Xem nội dung bộ nhớ flash dùng lệnh show flash
RouterA#show flash
System flash directory:
File Length Name/status
1 3612344 c2600-i-mz.120-3.T3.bin
– Để chắc chắn có thể truy cập được TFTP server ở địa chỉ 10.10.3.28, dùng lệnh ping
để kiểm tra.
RouterA#ping 10.10.3.28
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.3.28 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip min/avg/max = 4/ 4/4 ms
– Khi đã kiểm tra kết nối đến TFTP server, ta bắt đầu nạp IOS mới vào router bằng lệnh
copy tftp flash. Lưu ý trong bài thực hành này, ta sẽ không xoá file cũ hiện đã có
trong flash.
RouterA#copy tftp flash
Address or name of remote hos t [10.10.3.28]? ← địa chỉ TFTP server
Source file name? c2600-jsx-mz.121-5.xm.bin ← tên của IOS muốn nạp
Destination file name?
Accessing tftp://10.10.3.28/c2600-jsx-mz.121-5.xm.bin
Erase flash device before writing? [confirm]n ← không xoá file hiện tại của flash
Loading c2600-jsx-mz.121-5.xm.bin from 10.10.3.28 (via Ethernet0/0)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
...
[OK - 3612344/7224320 bytes]
Verifying checksum... OK (0x515A)
– Sau khi quá trình nạp hoàn tất, ta kiểm tra nội dung của bộ nhớ flash bằng lệnh show
flash
RouterA#show flash
System flash directory:
File Length Name/status
1 12080536 c2600-jsx-mz.121-5.xm.bin
2 3612344 c2600-i-mz.120-3.T3.bin
[15693008 bytes used, 1084208 available, 16777216 total]
16384K bytes of processor board System flash (Read/Write)
– Lúc này có hai file trong flash. Ta cần khai báo cho router biết dùng file nào trong khi
khởi động. Dùng lệnh boot system flash trong configuration mode
RouterA#conf term
RouterA(config)#boot system flash c2600 -jsx-mz.121-5.xm.bin
RouterA(config)#exit
– Kiểm tra lại bằng show run để chắc chắn câu lệnh đánh đúng
– Lưu cấu hình dùng lệnh write memory (hay copy run start) và sau đó nạp lại
RouterA#write mem
Building configuration ...
[OK]
RouterA#reload
Proceed with reload? [confirm]
– Sau khi đã nạp IOS mới dùng lệnh show version để kiểm tra lại router đã chạy IOS
mới hay chưa:
RouterA#show version
Cisco Internetwork Operating System Sof tware
IOS (tm) C2600 Software (C2600-JSX-M), Version 12.1(5)XM,
...
System file image “flash: c2600-jsx-mz.121-5.xm.bin“
Nếu muốn nạp IOS mới mà không giữ phiên bản cũ, cũng dùng lệnh copy tftp flash và
cho phép xoá flash trước khi ghi.
RouterA#copy tftp flash
System flash directory:
Address or name of remote host [10.10.3.28]? ← địa chỉ TFTP server
Source file name? ← tên của IOS muốn nạp
Destination file name?
Accessing file tftp://...
Erase flash device before writing? [confirm] ←Nhấn Enter tại đây để cho phép
xóa flash trước khi ghi file mới
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device ...
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ee ...erased
Erase of flash: complete
Copy ...
as ...? [yes/no]y
Loading
!!!!!!!!!!!!!!!!!!!!
[OK - 12080536/24160256 bytes]
Verifying checksum... OK (0xECAC)
12080536 bytes copied in 100.524 secs (120805 bytes/sec)
Sau khi nạp xong hệ điều hành cho router, nên kiểm tra lại tình trạng các file hiện có
trong flash bằng show flash hoặc dir flash
LAB 1-9:
NẠP IOS IMAGE CHO SWITCH 2900, 3500
1. Mô tả
– Bài thực hành này mô tả cách nạp IOS image cho switch 2900 và 3500 series.
– PC nối với switch qua cổng console. IOS image sẽ chứa trong PC và được truyền qua
Catalyst switch bằng giao thức xmodem.
2. Thực hiện
a. Quá trình boot của switch 2900 khi mất IOS image:
C2900XL Boot Loader (C2900-HBOOT-M) Version 12.0(5.1)XP,
MAINTENANCE INTERIM SOFTWARE
Compiled Fri 10-Dec-99 11:06 by cchang starting...
Base ethernet MAC Address: 00:b0:64:c9:cd:40
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 3 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 3612672
flashfs[0]: Bytes used: 3584
flashfs[0]: Bytes available: 3609088
flashfs[0]: flashfs fsck took 2 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
The system is unable to boot automatica lly because there are no bootable files to
boot.
Switch không tìm thấy IOS image
switch:
b. Copy IOS image từ xmodem vào flash, lấy tên là bootfile
switch: copy xmodem: flash:bootfile
Begin the Xmodem or Xmodem-1K transfer now...
– Sau khi switch xuất hiện dòng thông báo trên, ở cửa sổ Hyper Terminal, chọn
Transfer/Send File. Chọn IOS image cần truyền từ PC, chọn protocol là xmodem.
Phải thực hiện việc này trong vòng 3 giây, nếu không switch sẽ bị timeout quá trình
nhận file.
CC................................................ ............................
.................................................. ............................
..............
quá trình copy đã hoàn tấtFile "xmodem:" successfully copied to "flas h:bootfile"
c. Cấu hình cho switch boot bằng IOS image vừa được copy
switch: boot flash:bootfile
Loading
"flash:bootfile"...###############################
############################
##################################################
############################
##################
File "flash:bootfile" uncompressed and installed, entry point: 0x3000
executing...
cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706
Cisco Internetwork Operating System Software
IOS (tm) C2900XL Software (C2900XL-C3H2S-M), Version 12.0(5.2)XU,
MAINTENANCE
INTERIM SOFTWARE
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Mon 17-Jul-00 17:35 by ayounes
Image text-base: 0x00003000, data-base: 0x00301F3C
Initializing C2900XL flash...
flashfs[1]: 4 files, 1 directories
flashfs[1]: 0 orphaned files, 0 orphaned directories
flashfs[1]: Total bytes: 3612672
flashfs[1]: Bytes used: 1649664
flashfs[1]: Bytes available: 1963008
flashfs[1]: flashfs fsck took 6 seconds.
flashfs[1]: Initialization complete.
...done Initializing C2900XL flash.
C2900XL POST: System Board Test: Passed
C2900XL POST: Daughter Card Test: Passed
C2900XL POST: CPU Buffer Test: Passed
C2900XL POST: CPU Notify RAM Test: Passed
C2900XL POST: CPU Interface Test: Passed
C2900XL POST: Testing Switch Core: Passed
C2900XL POST: Testing Buffer Table: Passed
C2900XL POST: Data Buffer Test: Passed
C2900XL POST: Configuring Switch Parameters: Passed
C2900XL POST: Ethernet Controller Test: Passed
C2900XL POST: MII Test: Passed
cisco WS-C2912-XL (PowerPC403GA) processor (revision 0x11) with
8192K/1024K
bytes of memory.
Processor board ID FAB0403W0LS, with hardware revision 0x01
Last reset from warm-reset
Processor is running Enterprise Edition Software
Cluster command switch capable
Cluster member switch capable
12 FastEthernet/IEEE 802.3 interface(s)
32K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address: 00:B0:64:C9:CD:40
Motherboard assembly number: 73-3397-07
Power supply part number: 34-0834-01
Motherboard serial number: FAB040263DN
Power supply serial number: PHI034005GP
Model revision number: A0
Model number: WS-C2912-XL-EN
System serial number: FAB0403W0LS_
Press RETURN to get started!
Switch>enable
Switch#
d. Dùng lệnh show flash để xem nội dung bộ nhớ flash
Switch#show flash:
Directory of flash:/
2 -rwx 1645824 Jan 01 1970 00:37:30 bootfile
4 -rwx 776 Mar 01 1993 01:00:44 vlan.dat
6 -rwx 17 Jan 01 1970 00:00:56 env_vars
7 -rwx 765 Mar 01 1993 00:59:17 config.text
3612672 bytes total (1963008 bytes free)
Switch#
e. Dùng lệnh show boot để kiểm tra các tham số boot
Switch#show boot
BOOT path-list:
Config file: flash:config.text
Enable Break: yes
Manual Boot: no
HELPER path-list:
NVRAM/Config file
buffer size: 32768
Switch#
LAB 1-10:
CISCO HTTP WEB SERVER
1. Mô tả
HTTP là một ứng dụng client/server, dùng giao thức vận chuyển TCP. Client chạy
trình duyệt Web như Netscape Navigator hay Internet Explorer.
PC chạy trình duyệt Web, kết nối Ethernet với router VNPro là Web server.
Bài thực hành này mô tả cách cấu hình router để có thể truy cập và quản lý router
bằng chương trình duyệt Web chạy trên PC ở địa chỉ 10.10.3.77.
2. Cấu hình
VNPro
!
hostname VNPro
!
enable password cisco
!
no ip domain-lookup
!
interface Ethernet 0
ip address 10.10.3.100 255.255.255.0
!
cho phép router hoạt động như HTTP serverip http server
!-–- lệnh này cho phép router trả lời HTTP request từ một Web client
ip classless
!
line console 0
password cisco
login
line vty 0 4
login
!
end
Tại PC
Đia chỉ IP là 10.10.3.1/24
Kiểm tra
Kiểm tra kết nối giữa PC và router bằng lệnh ping trên PC.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>ping 10.10.3.100
Pinging 10.10.3.100 with 32 bytes of data:
Reply from 10.10.3.100: bytes=32 time<1ms TTL=255
Reply from 10.10.3.100: bytes=32 time<1ms TTL=255
Reply from 10.10.3.100: bytes=32 time<1ms TTL=255
Reply from 10.10.3.100: bytes=32 time< 1ms TTL=255
Ping statistics for 10.10.3.100:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli -seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\>
Chạy chương trình duyệt Web. Nhập địa chỉ của router VNPro trên thanh Address và
nhấn Enter
Màn hình login sẽ xuất hiện
Nhập User name: cisco hoặc VNPro; Mật khẩu: cisco (mật khẩu này là enable mật
khẩu được đặt trên router trước đó)
Với giao diện Web có thể thực hiện bằng cách chọn lệnh trên màn hình.
LAB 1-11:
CẤU HÌNH ROUTER TỪ XA QUA CỔNG AUX
1. Mô tả
Công dụng phổ biến nhất của cổng AUX l à để thiết lập các kết nối từ xa vào router
(thông qua Modem), chủ yếu để cấu hình khi không có điều kiện truy cập trực tiếp tr ên
cổng console.
Bài thực hành này mô tả các bước thiết lập kết nối phần cứng và cấu hình router để
router có thể chấp nhận cuộc gọi.
2. Các bước tiến hành
a. Kết nối từ modem vào cổng AUX:
Nếu cổng AUX là RJ-45: dùng cáp Rolled RJ-45--RJ-45 cable (P/N CAB-500RJ), cáp
console, và đầu chuyển đổi RJ-45 sang DB-25 (P/N CAB-25AS-MMOD) để kết nối vào
Modem.
Nếu AUX là DB-25: sử dụng cáp thẳng DB-25Female - DB25Male RS-232 để kết nối từ
router đến Modem.
b. Để cấu hình các thông số trên cổng AUX, trước hết cần xác định line number của
cổng AUX bằng lệnh show line
Với các lọai router thông thường, cổng AUX nằm ở line 1. Ri êng đối với các
Access Server thì port AUX l ại nằm liền sau các line TTY. Cụ thể với Access Serve r có
16 Async modem lines thì cổng AUX nằm ở line 17.
Trong ví dụ dưới dây, ta dùng lệnh show line để xác định cổng AUX nằm ở line 65 :
vnpro#show line
Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
* 0 CTY - - - - - 0 0 0/0 -
65 AUX 9600/9600 - - - - - 0 1 0/0 -
66 VTY - - - - - 0 0 0/0 -
67 VTY - - - - - 0 0 0/0 -
68 VTY - - - - - 0 0 0/0 -
69 VTY - - - - - 0 0 0/0 -
70 VTY - - - - - 0 0 0/0 –
Line(s) not in async mode -or- with no hardware support 1-64
c. Cấu hình line AUX trên router:
Với cổng AUX nằm trên line 65 như ở ví dụ trên:
vnpro(config)#line 65
vnpro(config-line)#modem inout
!--- Cho phép gọi vào ra trên router.
vnpro(config-line)#speed 115200
!--- Xác định line speed router li ên lạc với modem
vnpro(config-line)#transport input all
!--- Line hỗ trợ các lọai protocols khác nhau.
vnpro(config-line)#flowcontrol hardware
!--- Bật RTS/CTS flow control.
vnpro(config-line)#login
!--- Xác nhận các cuộc gọi tới sử dụng mật khẩu cấu h ình bên dưới
vnpro(config-line)#password cisco
Dùng chương trình Hyper Terminal để quay số kết nối vào router. Khi kết nối xong,
nhập mật khẩu để đăng nhập vào chế độ Conmmand Line Interface.
Chú ý là ta nên quay số từ chương trình HyperTerminal của Windows, không được
quay số dùng Dial-up Networking
PHẦN 2: CẤU HÌNH SWITCH
LAB 2-1
CẤU HÌNH CĂN BẢN CATALYST 2900
1. Mô tả
Phần thực hành này mô tả cách cấu hình các thông số cơ bản cho thiết bị switch
Catalyst 2900. Các thông số cơ bản bao gồm đặt tên, địa chỉ IP, và mật khẩu.
2. Thực hiện
a. Nối cổng COM của máy tính với cổng console của Catalyst 2900 (ở mặt sau của
switch) dùng cáp Rolled-over.
Các thông số truy cập: 8 data bit , no parity, 1 stop bit, no flow control.
b. Bật switch và xem quá trình khởi động (cần khoảng 1 phút để 2900 khởi động
xong)
C2900XL Boot Loader (C2900-HBOOT-M) Version 12.0(5)XU,
RELEASE
SOFTWARE (fc1)
Compiled Mon 03-Apr-00 17:20 by swati
starting...
Base ethernet MAC Address: 00:02:b9:9a:85:80
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 108 files, 3 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 3612672
flashfs[0]: Bytes used: 2775040
flashfs[0]: Bytes available: 837632
flashfs[0]: flashfs fsck took 6 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
Loading "flash:c2900XL-c3h2s-mz-120.5-
XU.bin"...########################################
##################
################################### ###############
##################

c. Khi khởi động xong, bạn sẽ được thông báo bằng System Configuration Dialog
(do chưa có cấu hình lưu trong switch).
IOS (tm) C2900XL Software (C2900XL -C3H2S-M), Version
12.0(5)XU,RELEASE SOFTWARE
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Mon 03-Apr-00 16:37 by swati
--- System Configuration Dialog ---
At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.
Continue with configuration dialog? [yes/no]:
Cũng giống như router nhấn no để không vào Setup mode chuyển trực tiếp sang
user exec mode:
Switch>
d. Nhấn enable vào privileged mode:
Switch>enable
Switch#show running-config
Building configuration...
Current configuration:
!
version 12.0
no service pad
service timestamps debug uptime
service timestamps log uptime
no service mật khẩu-encryption
!
hostname Switch
!
ip subnet-zero
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface VLAN1
no ip directed-broadcast
no ip route-cache
!
line con 0
transport input none
stopbits 1
line vty 5 15
!
end
Như đã hiển thị ở trên, cấu hình của switch rất giống với IOS trên router. Các interface
trên switch là các port của switch. Lưu ý sẽ không có bất kỳ cấu định tuyến nào trên
switch, bạn sẽ không thấy bất cứ lệnh nào liên quan tới định tuyến gói tin.
e. Bước tiếp theo, ta đặt tên cho switch, đặt các mật khẩu truy cập
Đặt tên:
Switch#config terminal
Switch(config)#host ALSwitch
ALSwitch(config)#
Đặt mật khẩu
ALSwitch(config)#enable password class
ALSwitch(config)#line con 0
ALSwitch(config-line)#password cisco
ALSwitch(config-line)#login
ALSwitch(config-line)#line vty 0 15
ALSwitch(config-line)#password cisco
ALSwitch(config-line)#login
Dùng câu lệnh copy để lưu cấu hình từ RAM vào NVRAM:
ALSwitch#copy running-config startup-config
f. Đặt địa chỉ IP cho switch để nó có thể liên lạc với các thiết bị khác qua trên mạng.
Switch là một thiết bị lớp 2. Việc đặt IP address cho switch chỉ nhằm mục đích
quản trị.
Tất cả các port mặt định của VLAN 1, do đó phải cấu hình cho quản lý switch dùng
VLAN 1. Bạn cấu hình VLAN 1 như cấu hình một cổng giao tiếp của router khi gán địa
chỉ IP.
ALSwitch#config terminal
ALSwitch(config)#interface vlan 1
ALSwitch(config-if)#ip address 10.1.1.251 255.255.255.0
Vì switch không thể cấu hình giao thức định tuyến, nên để tới tất cả các mạng, ta phải cấu
hình một địa chỉ gateway mặc định để gởi tất cả lưu lượng khi ta cần liên lạc giữa các
VLAN.
ALSwitch(config)#ip default-gateway 10.1.1.1
g. Cấu hình PC của bạn cho nó là một thành phần trong mạng 10.1.1.0/24 (giả sử
đặt địa chỉ IP cho PC là 10.1.1.10/24). Cắm PC vào một port bất kỳ của switch.
Từ PC Telnet vào switch dùng địa chỉ đã cấu hình 10.1.1.251 (Từ Window:
Start/Run/Telnet 10.1.1.251)
Sau khi đã telnet thành công, thử một số lệnh trên switch:
ALSwitch#show interfaces
FastEthernet0/1 is down, line protocol is down
Hardware is Fast Ethernet, address is 0002.fd49.7b81
(bia
0002.fd49.7b81)
MTU 1500 bytes, BW 0 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not set
Auto-duplex , Auto Speed , 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
--More—
Lệnh show version để xem thông tin phần cứng và phần mềm
ALSwitch#show version
Cisco Internetwork Operating System Software
IOS (tm) C2900XL Software (C2900XL -C3H2S-M), Version
12.0(5)XU, RELEASE SOFTWARE
Compiled Mon 03-Apr-00 16:37 by swati
Image text-base: 0x00003000, data-base: 0x00301398
ROM: Bootstrap program is C2900XL boot loader
ALSwitch uptime is 16 minutes
System returned to ROM by power-on
System image file is "flash:c2900XL -c3h2s-mz-120.5-
XU.bin"
cisco WS-C2924-XL (PowerPC403GA) processor (revision
0x11) with 8192K/1024K bytes of memory.
. . . .
24 FastEthernet/IEEE 802.3 interface(s)
32K bytes of flash-simulated non-volatile configuration
memory.
Base ethernet MAC Address: 00:02:FD:49:7B:80
Motherboard assembly number: 73-3382-08
Power supply part number: 34-0834-01
Motherboard serial number: FAB04301ANJ
Power supply serial number: PHI04150042
Model revision number: A0
Motherboard revision number: B0
Model number: WS-C2924-XL-EN
System serial number: FAB0432S2GJ
Configuration register is 0xF
ALSwitch#
LAB 2-2:
VLAN
1. Mô tả
Cấu hình trên switch Catalyst 2900 XL hỗ trợ 4 VLAN: Marketing, Accounting,
Enginerring và Network Management theo bảng sau:
VLANs VLAN 1: Network Management VLAN 10: Accounting
VLAN 20: Marketing VLAN 30: Engineering
Port Numbers Fa0/1 – Fa0/3 Fa0/4 – Fa0/6 Fa0/7 – Fa0/9
Fa0/10 – Fa0/12
+ Trong khi triển khai VLAN trong một hệ thống mạng cục bộ, ng ười quản trị có thể thiết
kế VLAN theo hai cách thức:
* Thiết kế VLAN theo dạng end-to-end: còn gọi là campus-wide.
Trong kiểu chia VLAN này, VLAN sẽ trải rộng trên toàn campus. Một thành viên
của VLAN đó di chuyển trong mạng, thuộc tính l à thành viên của VLAN đó không thay
đổi. Điều này có nghĩa là, mỗi VLAN phải sẵn có ở từng switch, đặc biệt l à những switch
nằm ở layer access trong mô hình 3-layer: core-distribution-access.
Như vậy, trong end-to-end VLAN, các người dùng sẽ được nhóm vào thành
những nhóm dựa theo chức năng, theo nhóm dự án hoặc theo cách m à những người dùng
đó sử dụng tài nguyên mạng.
*Chia VLAN dạng cục bộ:
VLAN được giới hạn trong một switch hoặc một khu vực địa lý hẹp (trong một
wiring closet). Ly do để dùng dạng VLAN này là các VLAN dạng end-to-end trở nên khó
duy trì. Các người dùng thường xuyên yêu cầu nhiều tài nguyên khác nhau. Các tài
nguyên này thường nằm trong nhìều VLAN khác nhau.
2. Thực hiện
a. Trước tiên phải tạo cơ sở dữ liệu VLAN. Mỗi VLAN có một số phân biệt là vlan-id,
có thể từ 1 đến 1001. Để tạo cơ sở dữ liệu VLAN (VLAN database) thực hiện các bước
như sau:
Vào mode cấu hình cho VLAN database:
Switch#vlan database
Tạo mới VLAN bằng câu lệnh vlan vlan-id [name name]. Nếu không đặt tên cho
VLAN thì tên sẽ được lấy mặc định
Switch(vlan)# vlan 20 name marketing
Cập nhật dữ liệu VLAN vào cơ sở dữ liệu VLAN, và thoát về priviledge mode.
Switch(vlan)# exit
Kiểm tra cấu hình VLAN bằng lệnh show vlan
Switch# vlan database
Switch(vlan)# vlan 20 name marketing
VLAN 20 added:
Name: marketing
Switch(vlan)# exit
APPLY completed.
Exiting....
Switch# show vlan name marketing
VLAN Name Status Ports
---- -------------------------------- --------- -------
--------------
20 marketing active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp Trans1
Trans2
---- ----- ---------- ----- ------ ------ -------- ----
------ ------
20 enet 100003 1500 - - - - 0 0
Việc tạo ra các VLAN khác sẽ được thực hiện tương tự.
b. Gán các port cho VLAN tương ứng.
Trước tiên cần cấu hình tất cả các port là “access” ports. Các port trên switch 2900
có thể ở 1 trong 3 chế độ: trunk port, multi-VLAN port và access port. Trunk port và
multi-VLAN port được dùng để nối với switch khác (hoặc thiết bị khác có tạo VLAN
trunking). Do kết nối các workstation với các port này nên cần phải cấu hình tất cả các
port này ở chế độ access port.
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode access
Gán các port vào VLAN theo yêu cầu bằng cách sử dụng lệnh switchport access vlan n (n
là số hiệu VLAN)
Switch(config)#interface fa0/4
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fa0/5
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fa0/6
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fa0/7
Switch(config-if)#switchport access vlan 20
Switch(config)#interface fa0/8
Switch(config-if)#switchport access vlan 20
Switch(config)#interface fa0/9
Switch(config-if)#switchport access vlan 20
Switch(config)#interface fa0/10
Switch(config-if)#switchport access vlan 30
Switch(config)#interface fa0/11
Switch(config-if)#switchport access vlan 30
Switch(config)#interface fa0/12
Switch(config-if)#switchport access vlan 30
Bạn không cần phải cấu hình port fa0/1-fa0/3 là VLAN 1 vì mặc định các port được gán
vào VLAN 1.
Ví dụ cấu hình gán port 07 cho VLAN 20 và kiểm tra lại cấu hình
Switch# configure terminal
Enter configuration commands, one per line. End with
CNTL/Z.
Switch(config)# interface fa0/7
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# end
Switch# show interface fa0/7 switchport
Name: Fa0/7
Switchport: Enabled
Administrative mode: static access
Operational Mode: static access
Administrative Trunking Encapsulation: isl
Operational Trunking Encapsulation: isl
Negotiation of Trunking: Disabled
Access Mode VLAN: 20 (marketing)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: NONE
Pruning VLANs Enabled: NONE
c. Thực hiện kiểm tra các VLAN trên switch bằng lệnh show vlan
Switch# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------
--------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/13,
Fa0/14, Fa0/15, Fa0/16
10 Accounting active Fa0/4 – Fa0/6
20 maketing active Fa0/7 – Fa0/9
30 Engineering active Fa0/10 – Fa0/12
40 VLAN0040 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
LAB 2-3
ĐỊNH TUYẾN GIỮA CÁC VLAN
1. Cấu hình đầy đủ
2900XL switch
!
hostname 2900xl
!
interface FastEthernet0/1
switchport mode trunk
!
!-- Nếu bạn cấu hình trunking theo chuẩn 802.1q thì
phải cấu hình trên cổng giao tiếp Fa0/1 là:
!-- interface FastEthernet0/1
!-- switchport trunk encapsulation dot1q
!-- switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 2
!
interface VLAN1
ip address 10.10.10.2 255.255.255.0
no ip directed-broadcast
no ip route-cache
!
ip default-gateway 10.10.10.1
!
end
Router 2600 Series:
!
hostname c2600
!
no logging console
enable password mysecret
!
ip subnet-zero
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation isl 1
ip address 10.10.10.1 255.255.255.0
!-- Nếu cấu hình theo chuẩn 802.1Q thì sẽ cấu hình trên cổng giao tiếp F0/0.1 là:
!-- interface FastEthernet0/0.1
!-- encapsulation dot1Q 1 native
!-- ip address 10.10.10.1 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation isl 2
ip address 10.10.11.1 255.255.255.0
!
! Nếu cấu hình theo chuẩn 802.1Q thì sẽ cấu hình trên cổng giao tiếp F0/0.2 là:
!-- interface FastEthernet0/0.2
!-- encapsulation dot1Q 2
!-- ip address 10.10.11.1 255.255.255.0
!
end
2. Các bước thực hiện
2.1.Switch2900
a. Vào chế độ privileged mode, cấu hình mật khẩu telnet cho switch
switch#configure terminal
Enter configuration commands, one per line. End with
CNTL/Z.
switch(config)#hostname 2900xl
2900xl(config)#enable password mysecret
2900xl(config)#line vty 0 4
2900xl(config-line)#login
2900xl(config-line)#password mysecret
2900xl(config-line)#exit
2900xl(config)#no logging console
2900xl(config)#^Z
b. Gán địa chỉ IP và default gateway cho VLAN1 cho tiện việc quản trị
2900xl#configure terminal
Enter configuration commands, one per line. End with
CNTL/Z.
2900xl(config)#int vlan 1
2900xl(config-if)#ip address 10.10.10.2 255.255.255.0
2900xl(config-if)#exit
2900xl(config)#ip default-gateway 10.10.10.1
2900xl(config)#end
c. Thiết lập vtp transparent mode
2900xl#vlan database
2900xl(vlan)#vtp transparent
Setting device to VTP TRANSPARENT mode.
d. Tạo mới VLAN2 trong cơ sở dữ liệu VLAN của switch. VLAN1 mặc định đã có
sẵn
2900xl(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
2900xl(vlan)#exit
APPLY completed.
Exiting....
e. Kích hoạt trunking trên cổng giao tiếp Fa0/1
2900xl#configure terminal
Enter configuration commands, one per line. End with
CNTL/Z.
2900xl(config)#int fastEthernet 0/1
2900xl(config-if)#switchport mode trunk
f. Encapsulation trunking bằng sử dụng isl hay dot1q
2900xl(config-if)#switchport trunk encapsulation isl
(2900xl(config-if)#switchport trunk encapsulation
dot1q)
+ Trong trường hợp switch 2950 chỉ hỗ trợ 802.1q encapsulation và tự động kích hoạt khi
thiết lập trunking cho cổng giao tiếp này bằng cách sử dụng lệnh switchport mode trunk.
+ Trên switch 2900xl, mặc định native VLAN là 1, bạn có thể thay đổi native VLAN
bằng lệnh: 2900xl(config-if)#switchport trunk native vlan <vlan ID>
g. Cho phép tất cả các VLAN được chuyển qua kết nối trunk:
2900xl(config-if)#switchport trunk allowed vlan all
2900xl(config-if)#exit
h. Gán cổng Fa0/2 và VLAN 2.
2900xl(config)#int fastEthernet 0/2
2900xl(config-if)#switchport access vlan 2
2900xl(config-if)#spanning-tree portfast
2900xl(config-if)#exit
+ Cổng fa0/3 mặc định đã thuộc VLAN1 nên không cần thực hiện apply vào VLAN 1
i. Lưu cấu hình
2900xl#write memory
Building configuration...
2900xl#
2.2. Router 2600 Series
a. Vào privileged mode cấu hình mật khẩu telnet cho router
Router#configure terminal
Enter configuration commands, one per line. End with
CNTL/Z.
Router(config)#hostname c2600
c2600(config)#enable password mysecret
c2600(config)#line vty 0 4
c2600(config-line)#login
c2600(config-line)#password mysecret
c2600(config-line)#exit
c2600(config)#no logging console
c2600(config)#^Z
c2600#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
b. Chọn cổng fa0/0 để cấu hình trunk,
c2600(config)#int fastEthernet 0/0
c2600(config-if)#no shut
c2600(config-if)#exit
c. Kích hoạt trunking trên sub-interface Fa0/0.1 và encapsulation bằng isl
c2600(config)#int fastEthernet 0/0.1
c2600(config-subif)#encapsulation isl 1
+ Trong trường hợp dùng giao thức dot1q, bạn cần đảm bảo native VLAN ở hai đầu kết
nối trunk là giống nhau (mặc định trên switch 2900XL là VLAN 1).
c2600(config-subif)#encapsulation dot1Q 1 ?
native Make this is native vlan
<cr>
c2600(config-subif)#encapsulation dot1Q 1 native
d. Cấu hình thông tin lớp 3 cho sub-interface Fa0/0.1
c2600(config-subif)#ip address 10.10.10.1 255.255.255.0
c2600(config-subif)#exit
e. Kích hoạt trunking trên sub-interface Fa0/0.2 và encapsulation bằng isl
c2600(config)#int fastEthernet 0/0.2
c2600(config-subif)#encapsulation isl 2
(hay bằng dot1q: c2600(config-subif)#encapsulation
dot1Q 2)
f. Cấu hình thông tin Layer 3 cho sub-interface Fa0/0.2
c2600(config-subif)#ip address 10.10.11.1 255.255.255.0
c2600(config-subif)#exit
c2600(config)#^Z
g. Lưu cấu hình
c2600#write memory
Building configuration...
[OK]
c2600#
3. Kiểm tra
3.1.Catalyst 2900xl Switch
a. Dùng lệnh show int FastEthernet <module/port> switchport để kiểm tra trạng thái
port và đảm bảo native VLAN ở cả 2 đầu kết nối trunk là giống nhau:
2900xl#show int fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: isl
Operational Trunking Encapsulation: isl
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,2
Pruning VLANs Enabled: 2-1001
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
Trong trường hợp 802.1q trunking, output sẽ như sau
2900xl#show int fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,2
Pruning VLANs Enabled: 2-1001
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
b. Dùng lệnh show vlan để kiểm tra các cổng của switch (ports) xem có thuộc về đúng
VLAN. Trong bài này, ta chú ý chỉ có cổng Fa0/2 là thuộc về VLAN 2, các cổng còn lại
của switch thuộc về VLAN 1
2900xl#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- ---------
----------------------
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6,
Fa0/7, Fa0/8, Fa0/9, Fa0/10,
Fa0/11, Fa0/12, Gi0/1, Gi0/2
2 VLAN0002 active Fa0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
...
c. Lệnh show vtp status dùng để kiểm tra VLAN trunking protocol (VTP) trên switch.
Trong bài lab này, ta dùng transparent mode.
2900xl#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 254
Number of existing VLANs : 6
VTP Operating Mode : Transparent
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xC3 0x71 0xF9 0x77 0x2B 0xAC 0x5C 0x97
Configuration last modified by 0.0.0.0 at 0 -0-00 00:00:00
3.2.Cisco 2600 Router
a. Lệnh show vlan cho biết thông tin Layer2/Layer3 được cấu hình cho mỗi VLAN:
c2600#show vlan
Virtual LAN ID: 1 (Inter Switch Link Encapsulation)
vLAN Trunk Interface: FastEthernet0/0.1
Protocols Configured: Address: Received: Transmitted:
IP 10.10.10.1 40 38
Virtual LAN ID: 2 (Inter Switch Link Encapsulation)
vLAN Trunk Interface: FastEthernet0/0.2
Protocols Configured: Address: Received: Transmitted:
IP 10.10.11.1 9 9
Đối với 802.1Q trunking, output có dạng sau:
c2600#show vlan
Virtual LAN ID: 1 (IEEE 802.1Q Encapsulation)
vLAN Trunk Interface: FastEthernet0/0.1
This is configured as native Vlan for the following
interface(s): FastEthernet0/0
Protocols Configured: Address: Received: Transmitted:
IP 10.10.10.1 0 2
Virtual LAN ID: 2 (IEEE 802.1Q Encapsulation)
vLAN Trunk Interface: FastEthernet0/0.2
Protocols Configured: Address: Received: Transmitted:
IP 10.10.11.1 42 19
Đối với Cisco IOS version trước 12.1(3)T, output có dạng sau:
c2600#show vlan
Virtual LAN ID: 2 (IEEE 802.1Q Encapsulation)
vLAN Trunk Interface: FastEthernet0/0.2
Protocols Configured: Address: Received: Transmitted:
IP 10.10.11.1 6 4
b. Kiểm tra trạng thái các cổng bằng lệnh show interface:
c2600#show interfaces fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
Hardware is AmdFE, address is 0003.e36f.41e0 (bia
0003.e36f.41e0)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:07, output hang never
Last clearing of "show interface" counters never
Queueing strategy: fifo
...
c2600#show interfaces fastEthernet 0/0.1
FastEthernet0/0.1 is up, line protocol is up
Hardware is AmdFE, address is 0003.e36f.41e0 (bia
0003.e36f.41e0)
Internet address is 10.10.10.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ISL Virtual LAN, Color 1.
ARP type: ARPA, ARP Timeout 04:00:00
c2600#show interfaces fastEthernet 0/0.2
FastEthernet0/0.2 is up, line protocol is up
Hardware is AmdFE, address is 0003.e36f.41e0 (bia
0003.e36f.41e0)
Internet address is 10.10.11.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ISL Virtual LAN, Color 2.
ARP type: ARPA, ARP Timeout 04:00:00
Đối với 802.1Q trunking, output có dạng:
c2600#show interfaces fastEthernet 0/0.1
FastEthernet0/0.1 is up, line protocol is up
Hardware is AmdFE, address is 0003.e36f.41e0 (bia
0003.e36f.41e0)
Internet address is 10.10.10.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 1.
ARP type: ARPA, ARP Timeout 04:00:00
c2600#show interfaces fastEthernet 0/0.2
FastEthernet0/0.2 is up, line protocol is up
Hardware is AmdFE, address is 0003.e36f.41e0 (bia
0003.e36f.41e0)
Internet address is 10.10.11.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 2.
ARP type: ARPA, ARP Timeout 04:00:0 0
LAB 2-4
VLAN TRUNKING
1. Mô tả
VLAN cho phép kết hợp các port trên switch thành các nhóm để giảm lưu lượng
broadcast trên mạng. Các lưu lượng này được giới hạn trong phạm vi được xác định
bởi VLAN.
Kết nối trunk là liên kết point-to-point giữa các port trên switch với router hoặc với
switch khác. Kết nối trunk sẽ vận chuyển thông tin của nhiều VLAN thông qua 1 liên
kết đơn và cho phép mở rộng VLAN trên hệ thống mạng.
VTP (VLAN Trunking Protocol ) là giao thức hoạt động ở Layer 2 trong mô hình OSI.
VTP giúp cho việc cấu hình VLAN luôn đồng nhất khi thêm, xoá, sửa thông tin về
VLAN trong hệ thống mạng.
Bài thực hành này mô tả cách thức tạo trunk giữa 2 switch. Trunking được cấu hình
trên port F0/1 của hai switch. Ta nên dùng cáp chéo để nối hai port này.
2. Cấu hình
Switch DL1
!
hostname DL1
!
enable password cisco
!
interface FastEthernet0/1
switchport trunk encapsulation isl
switchport mode trunk
!
interface FastEthernet0/4
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/8
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/9
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/10
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/11
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 30
switchport mode access
!
interface Vlan1
ip address 192.168.1.2 255.255.255.0
!
interface Vlan10
ip address 192.168.10.2 255.255.255.0
!
interface Vlan20
ip address 192.168.20.2 255.255.255.0
!
interface Vlan30
ip address 192.168.30.2 255.255.255.0
!
line vty 0 4
password cisco
login
line vty 5 15
password cisco
login
!
end
SwitchAL1
!
hostname AL1
!
enable password cisco
!
interface FastEthernet0/1
switchport trunk encapsulation isl
switchport mode trunk
!
interface FastEthernet0/4
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/8
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/9
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/10
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/11
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 30
switchport mode access
!
interface VLAN1
ip address 192.168.1.3 255.255.255.0
no ip directed-broadcast
no ip route-cache
!
line vty 0 4
mật khẩu cisco
login
line vty 5 15
mật khẩu cisco
login
!
end
3. Thực hiện
3.1. Cấu hình trên Switch DL1 làm VTP Server
a. Đặt hostname, mật khẩu và cấu hình cổng vlan trên DL1:
Switch#conf t
Enter configuration commands, one per line. End with
CNTL/Z.
Switch(config)#hostname DL1
DL1(config)#enable password cisco
DL1(config)#line vty 0 15
DL1(config-line)#password cisco
DL1(config-line)#login
DL1(config-line)#exit
DL1(config)#int vlan 1
DL1(config-if)#ip address 192.168.1.3 255.255.255.0
DL1(config-if)#end
DL1#
b. Thiết lập VTP domain là VNPRO, VTP mode là SERVER, tạo ra các VLAN 10
(SALES), 20 (ACCOUNTING), 30 (ENGINEERING)
DL1#vlan database
Thiết lập chế độ VTP server modeDL1(vlan)#vtp server
DL1(vlan)#vtp domain VNPRO đặt switch DL1 vào domain
VNPRO
Tạo VLAN 10 và đặt tên là SALESDL1(vlan)#vlan 10
name SALES
VLAN 10 added:
Name: SALES
DL1(vlan)#vlan 20 name ACCOUNTING
VLAN 20 added:
Name: ACCOUNTING
DL1(vlan)#vlan 30 name ENGINEERING
VLAN 30 added:
Name: ENGINEERING
Lưu cấp hình vào file vlan.datDL1(vlan)#apply
APPLY completed.
DL1(vlan)#exit
APPLY completed.
Exiting....
DL1#
+ Một switch chỉ thuộc 1 VTP domain
Mặc định switch ở chế độ VTP server mode
c. Kích hoạt trunking trên cổng Fa0/1 và cho phép tất cả các VLAN qua trunk:
DL1#conf t
Enter configuration commands, one per line. End with
CNTL/Z.
DL1(config)#int f0/1
DL1(config-if)#switchport mode trunk
đóng gói kiểu isl (hoặc dot1q) để đi qua đường
trunkDL1(config-if)#switchport trunk encapsulation
isl
Cho phép tất cả các VLAN qua trunkDL1(config-
if)#switchport trunk allowed vlan all
DL1(config-if)#exit
DL1(config)#
+ Giả sử ta chỉ muốn cho phép các VLAN 10, 20, 30 ta dùng lệnh:
DL1(config-if)#switchport trunk allowed vlan 10
DL1(config-if)#switchport trunk allowed vlan 20
DL1(config-if)#switchport trunk allowed vlan 30
d. Gán các port vào VLAN tương ứng
DL1(config)#int f0/4
Cấu hình cổng ở access modeDL1(config-if)#switchport
mode access
cấu hình cổng vào vlan 10DL1(config-if)#switchport
access vlan 10
!–– Mỗi access port chỉ phục vụ cho một VLAN
DL1(config-if)#int f0/5
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 10
DL1(config-if)#int f0/6
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 10
DL1(config)#int f0/7
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 20
DL1(config-if)#int f0/8
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 20
DL1(config-if)#int f0/9
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 20
DL1(config)#int f0/10
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 30
DL1(config-if)#int f0/11
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 30
DL1(config-if)#int f0/12
DL1(config-if)#switchport mode access
DL1(config-if)#switchport access vlan 30
e. Xem cấu hình vừa thực hiện
DL1#sh vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------
-----------------------
1 default active Fa0/2, Fa0/3, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gi0/1, Gi0/2
10 SALES active Fa0/4, Fa0/5, Fa0/6
20 ACCOUNTING active Fa0/7, Fa0/8, Fa0/9
30 ENGINEERING active Fa0/10, Fa0/11, Fa0/12
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
DL1#
3.2. Cấu hình trên Switch AL1 làm VTP Client
a. Đặt hostname, mật khẩu và cấu hình management vlan trên DL1:
Switch#conf t
Enter configuration commands, one per line. End with
CNTL/Z.
Switch(config)#hostname AL1
AL1(config)#enable mật khẩu cisco
AL1(config)#line vty 0 15
AL1(config-line)#mật khẩu cisco
AL1(config-line)#login
AL1(config-line)#exit
AL1(config)#int vlan 1
AL1(config-if)#ip address 192.168.1.2 255.255.255.0
AL1(config-if)#end
AL1#
b. Thiết lập VTP domain là VNPRO, VTP mode là CLIENT
AL1#vlan database
AL1(vlan)#vtp client
AL1(vlan)#vtp domain VNPRO
AL1(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
AL1#
c. Kích hoạt trunking trên cổng Fa0/1 và cho phép tất cả các VLAN qua trunk:
AL1#conf t
Enter configuration commands, one per line. End with
CNTL/Z.
AL1(config)#int f0/1
AL1(config-if)#switchport mode trunk
đóng gói kiểu isl (hoặc dot1q) để đi qua đường
trunkAL1(config-if)#switchport trunk encapsulation
isl
Cho phép tất cả các VLAN qua trunkAL1(config-
if)#switchport trunk allowed vlan all
AL1(config-if)#exit
AL1(config)#
d. Áp đặt các port chỉ định vào VLAN tương ứng
AL1(config)#int f0/4
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 10
AL1(config-if)#int f0/5
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 10
AL1(config-if)#int f0/6
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 10
AL1(config)#int f0/7
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 20
AL1(config-if)#int f0/8
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 20
AL1(config-if)#int f0/9
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 20
AL1(config)#int f0/10
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 30
AL1(config-if)#int f0/11
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 30
AL1(config-if)#int f0/12
AL1(config-if)#switchport mode access
AL1(config-if)#switchport access vlan 30
e. Xem cấu hình vừa thực hiện
AL1#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------
--------------------
1 default active Fa0/2, Fa0/3
10 SALES active Fa0/4, Fa0/5, Fa0/6
20 ACCOUNTING active Fa0/7, Fa0/8, Fa0/9
30 ENGINEERING active Fa0/10, Fa0/11, Fa0/12
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode
Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ----
-------- ------ ------
1 enet 100001 1500 - - - - - 0 0
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
1002 fddi 101002 1500 - 0 - - - 0 0
1003 tr 101003 1500 - 0 - - srb 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0
AL1#
4. Kiểm tra
a. Kiểm tra cổng Fa0/1 đã hoạt động chưa
AL1#show int f0/1
Cổng đã hoạt độngFastEthernet0/1 is up, line
protocol is up
Hardware is Fast Ethernet, address is 00b0.64c9.cd41
(bia 00b0.64c9.cd41)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not set
Auto-duplex (Full), Auto Speed (100), 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
...
b. Kiểm tra cổng Fa0/1 đã kích hoạt trunking và đúng kiểu encapsulation chưa
AL1#sh int f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative mode: trunk
Cổng F0/1 hoạt động ở chế độ trunk modeOperational
Mode: trunk
Administrative Trunking Encapsulation: isl
Kiểu đóng gói là islOperational Trunking
Encapsulation: isl
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Cho phép tất cả các VLAN qua kết nối trunkTrunking
VLANs Enabled: ALL
Các VLAN hiện hành đang hoạt độngTrunking VLANs
Active: 1,10,20,30
Pruning VLANs Enabled: 2-1001
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
AL1#
c. Kiểm tra revision number trên client có đồng bộ với server chưa
AL1#sh vtp status
VTP Version : 2
Configuration Revision số revision number: 2
Maximum VLANs supported locally : 68
Number of existing VLANs : 8
VTP Operating Mode Switch hoạt động ở chế độ client:
Client
VTP Domain Name Switch thuộc domain VNPRO: VNPRO
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xDC 0x45 0xB2 0xD9 0x5B 0x7A 0x50 0x19
Configuration last modified by 192.168.1.2 at 3 -1-93
01:54:06
AL1#
DL1#sh vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 1005
Number of existing VLANs : 8
VTP Operating Mode : Server
VTP Domain Name : VNPRO
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xDC 0x45 0xB2 0xD9 0x5B 0x7A 0x50 0x19
Configuration last modified by 192.168.1.2 at 3 -1-93
01:54:06
Local updater ID is 192.168.1.2 on interface Vl1
(lowest numbered VLAN interface
found)
DL1#
+ Revision number là một trong những thông số quan trọng của VTP. Mỗi khi VTP
server thay đổi VLAN database thì sẽ tăng giá trị revision lên 1 và thực hiện quảng cáo
VLAN database này. Các thiết bị có số revision nhỏ hơn phải chấp nhận VLAN database
có số revision lớn hơn.
Nếu VTP server xoá bỏ tất cả các VLAN & có số revision cao nhất thì các thiết bị khác
cũng sẽ bị xoá VLAN.
d. Kiểm tra số lần gửi và nhận thông tin trunking
DL1#sh vtp counters
VTP statistics:
Summary advertisements received : 18
Subset advertisements received : 5
Request advertisements received : 1
Summary advertisements transmitted : 12
Subset advertisements transmitted : 2
Request advertisements transmitted : 0
Number of config revision errors : 0
Number of config digest errors : 0
Number of V1 summary errors : 0
VTP pruning statistics:
Trunk Join Transmitted Join Received Summary advts
received from
non-pruning-capable device
---------------- ---------------- ---------------- ----
-----------------------
Fa0/1 0 0 0
DL1#
AL1#sh vtp counters
VTP statistics:
Summary advertisements received : 13
Subset advertisements received : 2
Request advertisements received : 0
Summary advertisements transmitted : 20
Subset advertisements transmitted : 6
Request advertisements transmitted : 1
Number of config revision errors : 0
Number of config digest errors : 0
Number of V1 summary errors : 0
VTP pruning statistics:
Trunk Join Transmitted Join Received Summary advts
received from
non-pruning-capable device
---------------- ---------------- ---------------- ----
-----------------------
Fa0/1 1 0 0
AL1#
LAB 2-5
LÀM VIỆC VỚI TFTP SERVER
1. Mô tả
Backup các file cấu hình của switch vào TFTP server
Nạp lại file backup từ TFTP server.
2. Thực hiện
a. Đặt IP address cho host có TFTP server
b. Đặt IP address cho management VLAN
Switch#conf t
Enter configuration commands, one per line. End with
CNTL/Z.
Switch(config)#hostname ALSwitch
ALSwitch(config)#int vlan 1
ALSwitch(config-if)#ip address 10.1.1.251 255.255.255.0
ALSwitch(config-if)#no shut
c. Cấu hình cho port gắn với TFTP server ở access mode (giả sử là port f0/9)
ALSwitch(config-if)#int f0/9
ALSwitch(config-if)#switchport mode access
ALSwitch(config-if)#switchport access vlan 1
ALSwitch(config-if)#no shut
ALSwitch(config-if)#
01:38:36: %LINK-3-UPDOWN: Interface FastEthernet0/9,
changed state to up
01:38:36: %LINK-3-UPDOWN: Interface FastEthernet0/9,
changed state to up
d. Kiểm tra kết nối giữa switch với tftp server
ALSwitch#ping 10.1.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.10, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 1/2/5 ms
ALSwitch#
e. Xem nội dung flash:
ALSwitch#show flash
Directory of flash:/
2 -rwx 1645824 Mar 01 1993 00:27:37 bootfile
4 -rwx 1180 Mar 01 1993 00:26:01 config.text
8 -rwx 976 Mar 01 1993 00:41:54 config.old
9 -rwx 17 Jan 01 1970 00:00:20 env_vars
3612672 bytes total (1960448 bytes free)
ALSwitch#
f. Copy cấu hình hiện tại vào tftp server
ALSwitch#copy running-config tftp
Address or name of remote host []? 10.1.1.10
Destination filename [running-config]? running-
config.txt
!!
685 bytes copied in 1.106 secs (685 bytes/sec)
ALSwitch#
g. Copy startup-config vào tftp server
ALSwitch#copy startup-config tftp
Address or name of remote host []? 10.1.1.10
Destination filename [startup-config]? startup-
config.txt
!!
685 bytes copied in 0.84 secs
ALSwitch#
h. Copy file config.text từ flash vào tftp server
ALSwitch#copy flash:config.text tftp
Address or name of remote host []? 10.1.1.10
Ấn EnterDestination filename [config.text]?
!!
685 bytes copied in 0.89 secs
Chú ý file startup-config.txt và config.text có nội dung giống nhau.
i. Copy biến môi trường vào tftp server để xem tham số
ALSwitch#copy env_vars tftp
Address or name of remote host []? 10.1.1.10
Destination filename [env_vars]?
!!
17 bytes copied in 0.79 secs
ALSwitch#
j. Copy bootfile vào tftp server
ALSwitch#copy bootfile tftp
Address or name of remote host []? 10.1.1.10
Destination filename [bootfile]? switch2900XL.bin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!
1645824 bytes copied in 13.657 secs (126601 bytes/sec)
Xem version của switch
ALSwitch#show version
Cisco Internetwork Operating System Software
IOS (tm) C2900XL Software (C2900XL -C3H2S-M), Version
12.0(5.2)XU, ROM: Bootstrap program is C2900XL boot
loader
System image file is "flash:bootfile"
cisco WS-C2912-XL (PowerPC403GA) processor (revision
0x11) with 8192K/1024K
...
File Switch2900XL.bin có kích thước giống file c2900XL-c3h2s-mz-120.5.2-XU.bin có
sẵn trong flash
k. Upload lại file từ tftp lên switch
ALSwitch#copy tftp:c2900XL-c3h2s-mz-120.5.2-XU.bin
flash
Address or name of remote host []? 10.1.1.10
Ấn EnterDestination filename [c2900XL-c3h2s-mz-
120.5.2-XU.bin]?
Accessing tftp://10.1.1.10/c2900XL -c3h2s-mz-120.5.2-
XU.bin...
Loading c2900XL-c3h2s-mz-120.5.2-XU.bin from 10.1.1.10
(via VLAN1): !!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!
[OK - 1645810 bytes]
1645810 bytes copied in 55.266 secs (29923 bytes/sec)
ALSwitch#
l. Xem cấu hình sau khi upload
ALSwitch#sh flash
Directory of flash:/
2 -rwx 1645824 Mar 01 1993 00:27:37 bootfile
4 -rwx 685 Mar 01 1993 01:53:49 config.text
5 -rwx 1645810 Mar 01 1993 02:07:53 c2900XL -c3h2s-mz-
120.5.2-XU.bin
9 -rwx 17 Jan 01 1970 00:00:20 env_vars
3612672 bytes total (314880 bytes free)
ALSwitch#
PHẦN 3 : ĐỊNH TUYẾN TRÊN ROUTER
LAB 3-1:
ĐỊNH TUYẾN TRÊN ROUTER CISCO
- Định tuyến IP được cho phép mặc định trên Cisco router. Lệnh để cho phép hay vô
hiệu hoá định tuyến: [no] ip routing
- Vì lệnh này mặc định nên khi xem cấu hình đang chạy bằng lệnh show running–
config sẽ không thấy hiển thị lệnh này.
- Để kiểm tra tác động của câu lệnh cho router nối với PC1 và PC2 qua hai cổng
Ethernet 0 và Ethernet 1 như hình vẽ.
– Router A với 2 cổng Ethernet sẽ được cấu hình như sau:
RouterA(config)#interface Ethernet0
RouterA(config–if)#ip address 172.108.1.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#exit
RouterA(config)#interface Ethernet1
RouterA(config–if)#ip address 172.108.2.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#exit
RouterA(config)#ip routing <- lệnh này mặc định trên
Cisco router
RouterA(config)# Ctrl+z
RouterA#
– Đặt địa chỉ IP cho PC1 và PC2 cùng mạng với cổng Ethernet0 và Ethernet1, như trên
hình.
Lưu ý :
Win2000,XP:Start -Settings -Connection -LocalAreaConnection -
Properties -lnternetProtocol(TCP/lP)
Win98:Start -Settings -ControlPanel -Networks -TCP/lP -TCP/lP
Properties
PC1:
PC2:
–Thực hiện lệnh ping trên PC1 và PC2, lệnh ping phải thành công: Gói IP từ PC1 tới PC2
sẽ được định tuyến bởi R1 mà không cần giao thức định tuyến vì các mạng được kết nối
trực tiếp với RouterA.
Win2000,XP:Start -Run:cmd.exe
Win98:Start -Run:command.exe
Tại PC1
MicrosoftWindowsXP[Version5.1.2600]
(C)Copyright1985-2001Microsoft Corp.
C:\>ping172.108.2.2
Pinging172.108.2.2with32bytesofdata:
Replyfrom172.108.2.2:bytes=32time&lt;1msTTL=127
Replyfrom172.108.2.2:bytes=32time&lt;1msTTL=127
Replyfrom172.108.2.2:bytes=32time&lt;1msTTL=127
Replyfrom172.108.2.2: bytes=32time&lt;1msTTL=127
Pingstatisticsfor172.108.2.2:
Packets:Sent=4,Received=4,Lost=0(0%loss),
Approximateroundtriptimesinmilli -seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
C:\>_
Tại PC2
MicrosoftWindowsXP[Version5. 1.2600]
(C)Copyright1985-2001MicrosoftCorp.
C:\>ping172.108.1.2
Pinging172.108.2.2with32bytesofdata:
Replyfrom172.108.1.2:bytes=32time&lt;1msTTL=127
Replyfrom172.108.1.2:bytes=32time&lt;1msTTL=127
Replyfrom172.108.1.2:bytes=32t ime&lt;1msTTL=127
Replyfrom172.108.1.2:bytes=32time&lt;1msTTL=127
Pingstatisticsfor172.108.1.2:
Packets:Sent=4,Received=4,Lost=0(0%loss),
Approximateroundtriptimesinmilli -seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
–Xem bảng định tuyến RouterA bằng lệnh show ip route. Chữ C ở phía trái bảng định
tuyến tượng trưng cho các mạng nối trực tiếp.
RouterA#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M
- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external
type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E
- EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * -
candidate default
U - per-user static route, o - ODR
Gateway of last resort is not set
172.100.0.0 is subnetted, 2 subnets
C 172.108.1.0 is directly connected, Ethernet0
C 172.108.2.0 is directly connected, Ethernet1
LAB 3-2:
CẤU HÌNH ĐỊNH TUYẾN TĨNH
1. Mô tả và yêu cầu:
- Cấu hình static route trên các router A, router B và router C.
- Router C hoạt động như DCE router, Router A là DTE router.
- Từ các router, ta phải có thể ping được tất cả các địa chỉ trong mạng.
2. Cấu hình:
Router A:
!
hostname RouterA
no ip domain-lookup
!
interface s0
ip address 10.0.3.2 255.255.255.0
no shutdown
!
interface E0
ip address 10.0.2.2 255.255.255.0
no shutdown
!
end
Router B:
!
hostname RouterB
no ip domain-lookup
!
interface E0
ip address 10.0.2.1 255.255.255.0
no shutdown
!
ip route 10.0.3.0 255.255.255.0 e0
!
end
Router C:
!
hostname RouterC
no ip domain-lookup
!
interface s0
ip address 10.0.3.100 255.255.255.0
no shutdown
!
ip route 10.0.2.0 255.255.255.0 10.0.3.2
!
end
3. Các bước thực hiện:
Bước 1: Cấu hình Router A.
RouterA(config)#hostname RouterA
RouterA(config)#no ip domain-lookup
RouterA(config)#interface s0
RouterA(config-if)#ip address 10.0.3.2 255.255.255.0
RouterA(config-if)#no shutdown
Chú ý: Khi thực hiện lệnh no shutdown, sẽ xuất hiện dòng thông báo:
01:31:19: %LINK-3-UPDOWN: Interface Serial0/0, changed
state to up
RouterA(config-if)#interface E0
RouterA(config-if)#ip address 10.0.2.2 255.255.255.0
RouterA(config-if)#no shutdown
01:34:38: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
RouterA(config-if)#end
01:35:39: %SYS-5-CONFIG_I: Configured from console by
console
RouterA#
Bước 2: Cấu hình Router B.
RouterB(config)#hostname RouterB
RouterB(config)#no ip domain-lookup
RouterB(config-if)#interface e0
RouterB(config-if)#ip address 10.0.2.1 255.255.255.0
RouterB(config-if)#no shut
0138: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
RouterB(config-if)#end
0139: %SYS-5-CONFIG_I: Configured from console by
console
RouterB#
Bước 3: Cấu hình cơ bản Router C.
RouterC(config)#hostname RouterC
RouterC(config)#no ip domain-lookup
RouterC(config)#interface s0
RouterC(config-if)#ip address 10.0.3.100 255.255.255.0
RouterC(config-if)#no shutdown
0119: %LINK-3-UPDOWN: Interface Serial0/0, changed
state to up
RouterC(config-if)#end
0139: %SYS-5-CONFIG_I: Configured from console by
console
RouterC#
Bước 4: Kiểm tra kết nối giữa các Router A, Router B, Router C
RouterC#ping 10.0.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.2, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 1/3/4 ms
Chú ý: Nếu không ping được, kiểm tra lại cấu hình bằng lệnh show running-
config, show interface để bảo đảm cấu hình đúng, giải quyết sự cố nếu cần.
RouterB#ping 10.0.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.2, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 1/3/4 ms
RouterB#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 1/3/4 ms
RouterA#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout
is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 1/3/4 ms
RouterC#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is
2 seconds:
.....
Success rate is 0 percent (0/5)
RouterB#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout
is 2 seconds:
.....
Success rate is 0 percent (0/5)
- Trên Router C, xem bảng định tuyến bằng lệnh show ip route
RouterC#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M
- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external
type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E
- EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia -
IS-IS inter area
* - candidate default, U - per-user static route, o -
ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.3.0 is directly connected, Serial0/ 0
Bước 5: Cấu hình static routes.
- Tại Router C, cấu hình static route đến Router B:
RouterC(config)#ip route 10.0.2.0 255.255.255.0
10.0.3.2
RouterC(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by
console
Chú ý: Khi cấu hình next hop router là địa chỉ IP thì AD=1; ta cấu hình next hop router
sử dụng outgoing interface thì AD =0.
- Tại Router B, định tuyến static route đến Router C.
RouterB(config)#ip route 10.0.3.0 255.255.255.0 e0
RouterB(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by
console
- Tại Router C, ping Router B bằng lệnh ping 10.0.2.1
RouterC#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 1/3/4 ms
- Tại Router B, ping Router C bằng lệnh ping 10.0.3.100
RouterB#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout
is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 1/4/8 ms
- Xem bảng định tuyến trên Router C bằng lệnh show ip route:
RouterC#show ip route
...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S 10.0.2.0 [1/0] via 10.0.3.2
C 10.0.3.0 is directly connected, Serial0/0
Chú ý: "S" biểu thị cho kết nối static với AD =1 v à hop count là 0 [1/0]
- Xem bảng định tuyến trên router B:
RouterB#show ip route
...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.0.2.0 is directly connected, FastEthernet0/1
S 10.0.3.0 is directly connected, FastEthernet0/1
Chú ý: AD=0 khi ta chọn outgoing interface để cấu hình static route. Ở đây ta không thấy
entry [1/0] trong cấu hình.
LAB 3-3:
CẤU HÌNH RIP CƠ BẢN
1. Mô tả & yêu cầu
–Router A, B, C sử dụng RIP để quảng cáo thông tin định tuyến
–Router B hoạt động như DCE cung cấp xung clock cho router A và C
–Các router cấu hình RIP và quảng cáo tất cả các mạng nối trực tiếp.
–Từ router A, B và C, ta ping được hết các địa chỉ trong mạng.
2. Cấu hình
Router A
!
hostname Router A
no ip domain-lookup
!
interface Loopback0 ← Định nghĩa interface ảo để làm
điểm kiểm tra
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0
ip address 148.1.1.1 255.255.255.0
no shutdown
no keepalive ← cho phép cổng Ethernet vẫn up khi không
kết nối với bên ngoài
!
interface Serial0
ip address 192.1.1.1 255.255.255.0
no shutdown
!
router rip ← kích hoạt quá trình định tuyến RIP trên
router
network 10.0.0.0 ← chỉ ra mạng sẽ quảng cáo và xác định
interface nào sẽ gởi và nhận thông tin định tuyến RIP
network 148.1.0.0
network 192.1.1.0
!
no ip classless
!
end
Router B
!
hostname RouterB
no ip domain-lookup
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clock rate 64000 ← hoạt động như DCE cung cấp xung
clock
no shutdown
!
interface Serial1
ip address 193.1.1.1 255.255.255.0
clock rate 64000 ← hoạt động như DCE cung cấp xung
clock
no shutdown
!
router rip
network 192.1.1.0
network 193.1.1.0
!
end
+ Để xác định router nào cung cấp xung clock tức là thiết bị DCE dùng câu lệnh: show
controller [type number]
Router C
!
hostname RouterC
no ip domain-lookup
!
interface Ethernet0
ip address 152.1.1.1 255.255.255.0
no shutdown
no keepalive ← vô hiệu hóa keepalive trên router cho
phép interface ethernet0 vẫn up khi không kết nối ra
bên ngoài
!
interface Serial0
ip address 193.1.1.2 255.255.255.0
no shutdown
!
router rip
network 152.1.0.0
network 193.1.1.0
!
no ip classless
!
end
3. Các bước thực hiện
Đặt hostname, đặt địa chỉ IP cho các cổng Loopback, Serial, Ethernet
Đối với RouterA
Router>en
Router#config terminal
Router(config)#hostname RouterA
RouterA(config)#interface Loopback
RouterA(config–if)# ip address 10.1.1.1 255.255.255.0
RouterA(config–if)#exit
RouterA(config)#interface Ethernet0
RouterA(config–if)#ip address 148.1.1.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#no keepalive
RouterA(config–if)#exit
RouterA(config)#interface Serial0
RouterA(config–if)#ip address 192.1.1.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#end
RouterA#
Cấu hình tương tự đối với RouterB và RouterC. Lưu ý tại RouterB có lệnh clock rate khi
cấu hình cổng Serial.
RouterB(config)#interface Serial0
RouterB(config–if)#ip address 192.1.1.2 255.255.255.0
RouterB(config–if)#clock rate 64000
RouterB(config–if)#no shutdown
RouterB(config–if)#interface Serial1
RouterB(config–if)#ip address 193.1.1.1 255.255.255.0
RouterB(config–if)#clock rate 64000
RouterB(config–if)#no shutdown
RouterB(config–if)#end
RouterB#
Kiểm tra hoạt động cổng Serial tại các router bằng lệnh show interface [Type Number]
RouterA#show interface Serial0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 192.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:06, output 00:00:08, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total
output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max
total/threshold/drops)
Conversations 0/3/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/ma x allocated)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
489 packets input, 30563 bytes, 0 no buffer
Received 473 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignor ed, 0
abort
524 packets output, 33973 bytes, 0 underruns
0 output errors, 0 collisions, 26 interface resets
0 output buffer failures, 0 output buffers swapped out
15 carrier transitions
--More—-
RouterB#sh int s0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 192.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...
RouterB#show interface serial1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 193.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...
RouterC#show interface Serial0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 193.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...
Chạy giao thức định tuyến RIP trên mỗi router
RouterA(config)#router rip
RouterA(config–router)#network 10.0.0.0
RouterA(config–router)#network 148.1.0.0
RouterA(config–router)#network 192.1.1.0
RouterB(config)#router rip
RouterB(config–router)#network 192.1.1.0
RouterB(config–router)#network 193.1.1.0
RouterC(config)#router rip
RouterC(config–router)#network 152.1.0.0
RouterC(config–router)#network 193.1.1.0
4. Kiểm tra
Xem bảng định tuyến bằng lệnh show ip route
RouterA# show ip route
...
Gateway of last resort is not set
10.0.0.0 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
148.1.0.0/24 is subnetted, 1 subnets
C 148.1.1.0 is directly connected, Ethernet0
R 152.1.0.0/16 [120/2] via 192.1.1.2, 00:00:20, Serial0
C 192.1.1.0/24 is directly connected, Serial0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:20, Serial0
+ Dùng lệnh show ip route rip nếu chỉ muốn xem các route học từ RIP.
RouterA# show ip route rip
R 152.1.0.0/16 [120/2] via 192.1.1.2, 00:00:20, Serial0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:20, Serial0
Từ router ping các địa chỉ trên mạng
RouterC#ping 192.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.1.1.1 timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 4/4/4 ms
RouterC#ping 192.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.1.1.2 timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 4/4/4 ms
RouterA#ping 148.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 148.1.1.1 timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round -trip
min/avg/max = 4/4/4 ms
RouterC#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1 timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 4/4/4 ms
Ta có thể xem quá trình cập nhật định tuyến của RIP bằng cách dùng lệnh debug ip rip.
Chú ý tại cổng serial0, RouterA không quảng cáo network học từ RouterB (152.1.0.0 và
193.1.1.0) nhưng ở các router còn lại các network này được quảng cáo. Đây là hoạt động
của cơ chế split horizon: khi split horizone hoạt động, router sẽ không quảng cáo route
ngược trở lại nơi nó đến.
RouterA#debug ip rip
RIP: sending v1 update to 255.255.255.255 via Ethernet0
(148.1.1.1)
network 10.0.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Loopback0
(10.1.1.1)
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Serial0
(192.1.1.1)
network 10.0.0.0, metric 1
network 148.1.0.0, metric 1
Khi debug chạy, router sẽ đưa ra thông tin định tuyến RIP, để ngừng debug dùng lệnh:
RouterA#undebug all
Vô hiệu hoá split horizon tại RouterA dùng lệnh tại interface mode
RouterA(config)#int s0
RouterA(config–if)#no ip split–horizon
Lúc này, để kiểm tra thông tin định tuyến tại RouterA dùng lệnh debug ip rip. Thông tin
xuất hiện dưới đây (chú ý tất cả các route được quảng cáo ra cổng serial , bao gồm cả các
route học từ RouterB và RouterC):
RouterA#debug ip rip
RIP: sending v1 update to 255.255.255.255 via Ethernet0
(148.1.1.1)
network 10.0.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Loopback0
(10.1.1.1)
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Serial0
(192.1.1.1)
network 10.0.0.0, metric 1
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
LAB 3-4: GIAO THỨC ĐỊNH TUYẾN RIP
1. Mô tả và yêu cầu:
- Lab này cấu hình định tuyến IP dùng địa cỉ mạng lớp B (131.108.0.0/16), với subnet
mask lớp C (255.255.255.0 hay /24).
- Cấu hình giao thức định tuyến RIP trên R1 và R2 để từ Router ping được tất cả địa chỉ
trên mạng.
2. Cấu hình:
R1:
!
hostname R1
!
interface loopback0
ip address 131.108.4.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.5.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.6.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.1 255.255.255.0
clock rate 64000
no shut
exit
!
router rip
network 131.108.0.0
!
end
R2:
!
hostname R2
!
interface loopback0
ip address 131.108.7.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.8.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.9.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.2.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.2 255.255.255.0
no shut
exit
!
router rip
network 131.108.0.0
!
end
3. Các bước thực hiện:
- Đặt hostname, cấu hình cho các cổng loopback, Ethernet và serial trên R1 và R2.
Đặt Hostname:
Router(config)#hostname R1
R1(config)# _
Router(config)#hostname R2
R2(config)# _
Xác định thiết bị nào là DCE và DTE:
R1#show controllers S0
Interface Serial0
Hardware is PowerQuiCC MPC860
DCE V.35, no clock
...
R2#show controllers S1
HD unit 0, idb = 0xFBDB0, driver structure at 0x1020C8
buffer size 1524 HD unit 0, V.35 DTE cable
cpb = 0x1, eda = 0x483C, cda = 0x4850
...
Cấu hình địa chỉ IP cho các cổng của R1:
R1(config)#interface loopback0
R1(conig–if)# ip address 131.108.4.1 255.255.255.0
R1(config–if)#interface loopback1
R1(conig–if)# ip address 131.108.5.1 255.255.255.0
R1(config–if)#interface loopback2
R1(conig–if)# ip address 131.108.6.1 255.255.255.0
R1(conig–if)# exit
R1(config)#interface Ethernet0
R1(conig–if)#ip address 131.108.1.1 255.255.255.0
R1(conig–if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to
up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0,
changed state to up
R1(conig–if)#no keepalive
R1(conig–if)# exit
R1(config)#interface Serial0
R1(conig–if)#ip address 131.108.3.1 255.255.255.0
R1(conig–if)#clock rate 128000
R1(conig–if)#no shut
Tương tự đối với R2:
R2(config)#interface loopback0
R2(conig–if)# ip address 131.108.7.1 255.255.255.0
R2(config)#interface loopback1
R2(conig–if)# ip address 131.108.8.1 255.255.255.0
R2(config)#interface loopback2
R2(conig–if)# ip address 131.108.9.1 255.255.255.0
R2(config)#interface Ethernet0
R2(conig–if)#ip address 131.108.2.1 255.255.255.0
R2(conig–if)#no shutdown
R2(conig–if)#no keepalive
R2(conig–if)# exit
R2(config)#interface Serial1
R2(conig–if)#ip address 131.108.3.2 255.255.255.0
R2(conig–if)#no shut
- Kiểm tra bảng định tuyến IP tr ên các Router
R1# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
- Chạy giao thức định tuyến RIP tr ên cả hai router:
R1(config)#router rip
R1(config–router)#network 131.108.0.0
R1(config–router)#end
R1#copy run start ← lưu cấu hình vào NVRAM
R2(config)#router rip
R2(config–router)network 131.108.0.0
R2(config–router)#end
R2#copy run start
Xem quá trình cập nhật định tuyến trên Router
R1#debug ip rip
RIP protocol debugging is on
R1#debug ip rip events
RIP event debugging is on
- Xem bảng định tuyến trên R1 và R2:
R1# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
R 131.108.9.0/24 [120/1] via 131.108.3.2, 00:00:00,
Serial0
R 131.108.8.0/24 [120/1] via 131.108.3.2, 00:00:00,
Serial0
R 131.108.7.0/24 [120/1] via 131.108.3.2, 00:00:00,
Serial0
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
R 131.108.2.0/24 [120/1] via 131.108.3.2, 00:00:00,
Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
R 131.108.6.0/24 [120/1] via 131.108.3.1, 00:00:00,
Serial1
R 131.108.5.0/24 [120/1] via 131.108.3.1, 00:00:00,
Serial1
R 131.108.4.0/24 [120/1] via 131.108.3.1, 00:00:00,
Serial1
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
R 131.108.1.0/24 [120/1] via 131.108.3.1, 00:00:00,
Serial1
- Kiểm tra hoạt động bằng cách ping các mạng ở xa (tất cả các lệnh ping phải th ành công)
R1#ping 131.108.9.1
R1#ping 131.108.8.1
R1#ping 131.108.7.1
R1#ping 131.108.2.1
R2#ping 131.108.4.1
R2#ping 131.108.5.1
R2#ping 131.108.6.1
R2#ping 131.108.1.1
Ví dụ ping thành công:
R1#ping 131.108.9.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 131.108.9.1, timeout
is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 32/32/32 ms
LAB 3-5: CẤU HÌNH PASSIVE INTERFACE
1. Mô tả và yêu cầu:
- Bài thực hành này mô tả cách dùng lệnh passive interface; lệnh này cho phép router có
chạy RIP nhận, nhưng không gởi thông tin định tuyến ra ngoài cổng chỉ định.
- Các Router cấu hình RIP.
- Không cho gởi thông tin định tuyến qua cổng Serial 0 của router A.
- Router B và C quảng cáo tất cả các mạng nối trực tiếp.
2. Cấu hình:
Router A:
!
hostname Router A
!
interface Loopback0 <- Định nghĩa interface ảo để làm
điểm kiểm tra
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0
ip address 148.1.1.1 255.255.255.0
no shutdown
no keepalive <- cho phép interface ethernet vẫn up khi
không kết nối với HUB hoặc Switch.
!
interface Serial0
ip address 192.1.1.1 255.255.255.0
no shutdown
!
!
router rip <- kích hoạt quá trình định tuyến RIP trên
router.
passive–interface Serial0 <- không cho gởi thông tin
định tuyến RIP trên Serial 0
network 10.0.0.0 <- chỉ ra mạng sẽ quảng cáo và xác
định cổng nào sẽ gởi và nhận thông tin định tuyến RIP.
network 148.1.0.0
network 192.1.1.0
!
no ip classless
!
end
Router B:
!
hostname RouterB
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clock rate 64000 <- hoạt động như DCE cung cấp xung
clock
no shutdown
!
interface Serial1
ip address 193.1.1.1 255.255.255.0
clock rate 64000 <- hoạt động như DCE cung cấp xung
clock
no shutdown
!
router rip
network 192.1.1.0
network 193.1.1.0
!
end
Router C:
!
hostname RouterC
!
interface Ethernet0
ip address 152.1.1.1 255.255.255.0
no shutdown
no keepalive <- vô hiệu hóa keepalive trên Router cho
phép cổng Ethernet 0 vẫn up khi không kết nối ra b ên
ngoài.
!
interface Serial0
ip address 193.1.1.1 255.255.255.0
no shutdown
!
router rip
network 152.1.0.0
network 193.1.1.0
!
no ip classless
!
end
3. Kiểm tra:
- Xem quá trình gởi nhận thông tin định tuyến bằng lệnh dubug ip rip trên router A.
Chú ý cập nhật RIP chỉ gởi ra cổng Ethernet0 v à Loopback0, Serial0 chỉ nhận thông tin
định tuyến RIP.
RouterA#debug ip rip
RIP: received v1 update from 192.1.1.2 on Serial0
152.1.0.0 in 2 hops
193.1.1.0 in 1 hops
RIP: sending v1 update to 255.255.255.255 via Ethernet0
(148.1.1.1)
network 10.0.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Loopback0
(10.1.1.1)
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
- Xem bảng định tuyến trên router A và router C bằng lệnh show ip route. Chú ý
router A học tất cả các route từ Router C, router C không có route từ Router A.
RouterA# show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M
- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external
type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E
- EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * -
candidate default
U - per-user static route, o - ODR
Gateway of last resort is not set
10.0.0.0 /24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
148.1.0.0/24 is subnetted, 1 subnets
C 148.1.1.0 is directly connected, Ethernet0
R 152.1.0.0/16 [120/2] via 192.1.1.2, 00:00:20, Serial0
C 192.1.1.0/24 is directly connected, Serial0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:20, Serial0
RouterC# show ip route
...
Gateway of last resort is not set
152.1.0.0/24 is subnetted, 1 subnets
C 152.1.1.0 is directly connected, Ethernet0
R 192.1.1.0/24 [120/1] via 193.1.1.2, 00:00:20, Serial0
C 193.1.1.0/24 is directly connected, Serial0
Chú ý: Debug ip rip events: lệnh này dùng để hiển thị quá trình trao đổi định
tuyến RIP, nó hiển thị tất cả cập nhật định tuyế n RIP được gởi và nhận bởi router. clear
ip route [route | *]: loại bỏ một hoặc nhiều route từ bảng định tuyến. Lệnh n ày
cho phép bạn xóa route chỉ định hay xóa toàn bộ route từ bảng định tuyến (dùng *).
LAB 3-6:
CẤU HÌNH IGRP CƠ BẢN
1. Mô tả và yêu cầu:
- Router 1, router 2 sử dụng IGRP để quảng cáo thông tin định tuyến.
- Router 1 hoạt động như DCE cungca61p xung clock cho router 2.
- Các router cấu hình IGRP và quảng bá tất cả các mạng nối trực tiếp.
- Từ router 1, router 2 ping được hết các địa chỉ trong mạng.
2. Cấu hình:
Router R1:
!
hostname R1
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 131.108.4.1 255.255.255.0
!
interface Loopback1
ip address 131.108.5.1 255.255.255.0
!
interface Loopback2
ip address 131.108.6.1 255.255.255.0
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.0
!
interface Serial0
ip address 131.108.3.1 255.255.255.0
clock rate 64000
!
router igrp 234
network 131.108.1.0
network 131.108.3.0
network 131.108.4.0
network 131.108.5.0
network 131.108.6.0
!
end
Router R2:
!
hostname R2
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 131.108.7.1 255.255.255.0
!
interface Loopback1
ip address 131.108.8.1 255.255.255.0
!
interface Loopback2
ip address 131.108.9.1 255.255.255.0
!
interface Ethernet0
ip address 131.108.2.1 255.255.255.0
!
interface Serial0
ip address 131.108.3.2 255.255.255.0
!
router igrp 234
network 131.108.2.0
network 131.108.3.0
network 131.108.7.0
network 131.108.8.0
network 131.108.9.0
!
end
3. Các bước thực hiện:
- Đặt hostname, cấu hình cho các cổng loopback, ethernet và serial trên router R1.
Router> en
Router# conf t
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# int e0
R1(config-if)#ip addr 131.108.1.1 255.255.255.0
R1(config-if)#no keepalive <- cho phép cổng Ethernet
vẫn up khi không kết nối với bên ngoài.
R1(config-if)# no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to
up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0,
changed state to up
R1(config-if)# exit
R1(config)# int lo0 <- Định nghĩa cổng ảo để làm điểm
kiểm tra.
R1(config-if)# ip addr 131.108.4.1 255.255.255.0
R1(config-if)# int lo1
R1(config-if)# ip addr 131.108.5.1 255.255.255.0
R1(config-if)# int lo2
R1(config-if)# ip addr 131.108.6.1 255.255.255.0
R1(config-if)# exit
R1(config-if)# int s0
R1(config-if)# ip addr 131.108.3.1 255.255.255.0
R1(config-if)# clock rate 64000 <- hoạt động như DCE
cung cấp xung clock
R1(config-if)# no shut
- Đặt hostname, cấu hình cho các cổng loopback, ethernet và serial trên router R2.
Router> en
Router# conf t
Router(config)# hostname R2
R2(config)# no ip domain-lookup
R2(config)#int e0
R2(config-if)# ip addr 131.108.2.1 255.255.255.0
R2(config-if)# no shut
R2(config-if)# int lo0
R2(config-if)# ip addr 131.108.7.1 255.255.255.0
R2(config-if)# int lo1
R2(config-if)# ip addr 131.108.8.1 255.255.255.0
R2(config-if)# int lo2
R2(config-if)# ip addr 131.108.9.1 255.255.255.0
R2(config-if)# int s0
R2(config-if)# ip addr 131.108.3.2 255.255.255.0
R2(config-if)# no shut
- Cấu hình giao thức định tuyến IGRP và sau đó lưu cấu hình vào NVRAM trên router
R1.
R1(config)# router igrp 234 <- kích hoạt quá trình định
tuyến IGRP trên router.
R1(config-router)# network 131.108.1.0 <- chỉ ra mạng
sẽ quảng cáo và xác định cổng nào sẽ gởi và nhận thông
tin định tuyến RIP
R1(config-router)# network 131.108.3.0
R1(config-router)# network 131.108.4.0
R1(config-router)# network 131.108.5.0
R1(config-router)# network 131.108.6.0
R1(config-router)# end
R1#copy run start
- Cấu hình giao thức định tuyến IGRP và sau đó lưu cấu hình vào NVRAM trên router
R2.
R2(config)# router igrp 234
R2(config-router)# network 131.108.2.0
R2(config-router)# network 131.108.3.0
R2(config-router)# network 131.108.7.0
R2(config-router)# network 131.108.8.0
R2(config-router)# network 131.108.9.0
R2(config-rputer)# end
R2# copy run start
4. Kiểm tra & giải quyết sự cố:
- Dùng lệnh clear ip route * để xóa toàn bộ route từ bảng định tuyến.
R1# clear ip route *
- Xem quá trình gửi nhận thông tin định tuyến IGRP bằng lệnh debug ip rip
events, debug ip igrp transactions .
R1# debug ip igrp events
IGRP event debugging is on
R1# debug ip igrp transactions
IGRP protocol debuging is on
R1#
IGRP: received update from 131.108.3.2 on R2
IGRP: Update contains 0 interior, 4 system, and 0
exterior routes.
IGRP: Total routes in update: 4
- Tắt chế độ debug bằng lệnh undebug all
R1# undebug all
All possible debugging has been tu rned off
- Xem bảng định tuyến trên R1 và R2 bằng lệnh show ip route
R1# show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M
- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external
type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E
- EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * -
candidate default
U - per-user static route, o - ODR
Gateway of last resort is not set
I 131.108.9.0/24 [100/8976] via 131.108.3.2, 00:00:46,
Serial0
I 131.108.8.0/24 [100/8976] via 131.108.3.2, 00:00:46,
Serial0
C 131.108.3.0/24 is directly connected, Serial0
I 131.108.2.0/24 [100/8576] via 131.108.3.2, 00:00:46,
Serial0
C 131.108.1.0/24 is directly connected, Ethernet0
I 131.108.7.0/24 [100/8976] via 131.108.3.2, 00:00:47,
Serial0
C 131.108.6.0/24 is directly connected, Loopback2
C 131.108.5.0/24 is directly connected, Loopback1
C 131.108.4.0/24 is directly connected, Loopback0
- Từ R1, bạn có thể thấy có 4 route IGRP học từ next-hop 131.108.3.2 và đi qua cổng S0.
Chú ý số AD trong trường hợp IGRP là 100 (RIP là 120 và OSPF là 110). I có ngh ĩa là
route đó được học qua routing protocol l à IGRP.
R2# show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M
- mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external
type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E
- EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * -
candidate default
U - per-user static route, o - ODR
Gateway of last resort is not set
I 131.108.4.0/24 [100/8976] via 131.108.3.1, 00:00:46,
Serial0
I 131.108.5.0/24 [100/8976] via 131.108.3.1, 00:00:46,
Serial0
C 131.108.3.0/24 is directly conne cted, Serial0
I 131.108.1.0/24 [100/8576] via 131.108.3.1, 00:00:46,
Serial0
C 131.108.2.0/24 is directly connected, Ethernet0
I 131.108.6.0/24 [100/8976] via 131.108.3.1, 00:00:47,
Serial0
C 131.108.9.0/24 is directly connected, Loopback2
C 131.108.8.0/24 is directly connected, Loopback1
C 131.108.7.0/24 is directly connected, Loopback0
LAB 3-7:
CẤU HÌNH IGRP PASSIVE INTERFACE
1. Mô tả & yêu cầu:
- Router A, B, C sử dụng IGRP để quảng bá thông tin định tuyến.
- Router B hoạt động như DCE cung cấp xung clock cho router A và C.
- Các router cấu hình IGRP và quảng bá tất cả các mạng nối trực tiếp.
- Cổng S0 của router A không gửi thông tin định tuyến m à chỉ nhận thông tin định tuyến.
- Router B và C quảng bá tất cả các mạng nối trực tiếp.
2. Cấu hình:
Router A:
!
hostname Router A
!
interface Loopback0 <- Định nghĩa interface ảo để làm
điểm kiểm tra
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0
ip address 148.1.1.1 255.255.255.0
no shutdown
no keepalive <- cho phép interface Ethernet vẫn up khi
không kết nối với bên ngoài.
!
interface Serial0
ip address 192.1.1.1 255.255.255.0
no shutdown
!
!
router igrp 64 <- kích hoạt quá trình định tuyến IGRP
trên router
passive–interface Serial0 <- không cho gởi thông tin
định tuyến IGRP trên Serial0
network 10.0.0.0 <- chỉ ra mạng sẽ quảng bá và xác định
cổng nào sẽ gởi và nhận thông tin định tuyến IGRP
network 148.1.0.0
network 192.1.1.0
!
no ip classless
!
end
Router B:
!
hostname RouterB
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clock rate 64000 <- hoạt động như DCE cung cấp xung
clock
no shutdown
!
interface Serial1
ip address 193.1.1.1 255.255.255.0
clock rate 64000 <- hoạt động như DCE cung cấp xung
clock
no shutdown
!
router igrp 64
network 192.1.1.0
network 193.1.1.0
!
end
Router C:
!
hostname RouterC
!
interface Ethernet0
ip address 152.1.1.1 255.255.255.0
no shutdown
no keepalive <- vô hiệu hóa Keepalive trên router cho
phép interface ethernet vẫn up khi không kết nối ra bên
ngoài
!
interface Serial0
ip address 193.1.1.1 255.255.255.0
no shutdown
!
router igrp 64
network 152.1.0.0
network 193.1.1.0
!
no ip classless
!
end
3. Kiểm tra:
- Xem thông tin về IGRP bằng lệnh show ip protocols, chú ý rằng cổng Serial trên
router ở trạng thái passive.
RouterA#show ip protocols
Routing Protocol is “igrp 64”
Sending updates every 90 second, next due in 31 seconds
Invalid after 270 seconds, hold dow 280, flushed after
630
Outgoing update filter list for all interface is not
set
Incoming update filter list for all interface is not
set
Default networks flagged in outgoing updates
Default networks accepted from incoming updates
IGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
IGRP maximum hopcount 100
IGRP maximum metric variance 1
Redistributing: IGRP 64
Routing for Network:
10.0.0.0
148.1.0.0
192.1.1.0
Passive Interface(s):
Serial0
Routing Information Sources:
Gateway Distance Last Update
192.1.1.2 100 00:00:48
Distance: (default is 100)
- Xem quá trình gởi nhận thông tin đị nh tuyến bằng lệnh debug ip igrp
transactions trên router a. Chú ý cập nhật IGRP chỉ gởi ra cổng Ethernet0 l à
Loopback0, cổng serial0 chỉ nhận chứ không gởi đi thông tin định tuyến IGRP.
RouterA# debug ip igrp transactions
IGRP: sending update to 255.255.255.255 via Ethernet0
(148.1.1.1)
network 10.0.0.0, metric=501
network 152.1.0.0, metric=10576
network 192.1.1.0, metric=8476
network 193.1.1.0, metric=10476
IGRP: sending update to 255.255.255.255 via Loopback0
(10.1.1.1)
network 148.1.0.0, metric=1100
network 152.1.0.0, metric=10576
network 192.1.1.0, metric=8476
network 193.1.1.0, metric=10476
IGRP: received update from 192.1.1.2 on Serial0
network 152.1.0.0, metric 10576 (neighbor 8576)
network 193.1.1.0, metric 10476 (neighbor 8476)
- Xem bảng định tuyến trên Router A và router C bằng lệnh show ip route. Chú ý
router A học tất cả các route từ Router C, router C không có route từ router A.
RouterA#show ip route
Codes: C – connected, S – static, I – IGRP, R – RIP, M
– mobile, B – BGP
D – EIGRP, EX – EIGRP external, 0 – OSPF, IA – OSPF
inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external
type 2
E1 – OSPF external type 1, E2 – OSPF external type 2, E
– EGP
i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, * -
candidate default
U – per-user static route, o – ODR
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
148.1.0.0/24 is subnetted, 1 subnets
C 148.1.1.0 is directly connected, Ethernet0
I 152.1.0.0/16 [100/10576] via 192.1.1.2 , 00:00:29,
Serial0
C 192.1.1.0/24 is directly connected, Serial0
I 193.1.1.0/24 [100/10476] via 192.1.1.2, 00:00:29,
Serial0
RouterC#show ip route
Codes: C – connected, S – static, I – IGRP, R – RIP, M
– mobile, B – BGP
D – EIGRP, EX – EIGRP external, 0 – OSPF, IA – OSPF
inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external
type 2
E1 – OSPF external type 1, E2 – OSPF external type 2, E
– EGP
i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, * -
candidate default
U – per-user static route, o – ODR
Gateway of last resort is not set
152.1.0.0/24 is subnetted, 1 subnets
C 152.1.1.0 is directly connected, Ethernet0
Route fromI 192.1.1.0/24 [100/10476] via 193.1.1.2,
00:00:13, Serial0
RouterB
C 193.1.1.0/24 is directly connected, Serial0
Chú ý: debug ip igrp transactions: lệnh này dùng để hiện thị quá trình trao
đổi định tuyến IGRP, nó hiển thị tất cả cập nhật định tuyến IGRP đ ược gởi và nhận gởi
router. clear ip route [route | * ]: loại bỏ một hoặc nhiều route từ bảng
định tuyến. Lệnh này cho phép bạn xóa route chỉ định hay xóa toàn bộ route từ bảng định
tuyến (dùng *).
LAB 3-8:
CẤU HÌNH IGRP UNEQUAL-COST LOAD BALANCING
1. Mô tả & yêu cầu:
- Router A, B, C sử dụng IGRP để quảng bá các thông tin định tuyến.
- Router B hoạt động như DCE cung cấp xung clock cho router A và C.
- Các router cấu hình IGRP và quảng bá tất cả các mạng nối trực tiếp.
- Cấu hình router A và B sử dụng IGRP cân bằng tải tr ên cổng S0, E0.
- Từ router A, b, C ping được hết các địa chỉ trong mạng.
Chú ý: Mặc định router sẽ cân bằng tải 4 tuyến đ ường đi có cost bằng nhau. Ta có thể
cấu hình IGRP cân bằng tải được đến 4 tuyến đường đi có cost không bằng nhau để đến
đích bằng cách sử dụng biến varian x với x=highestcost/lowestcost . Ví dụ nếu router
A có 2 đường đi đến đích 3.3.3.3 một đường có cost là 4 và đường kia có cost là 8 thì
mặc định sẽ sử dụng đường đi có cost 4 để đến 3.3.3.3. Tuy nhi ên nếu ta thiết lập
variance là 2 thì router sẽ cân bằng tải trên cả hai tuyến đường này.
2. Cấu hình:
Router A:
!
hostname RouterA
!
interface Loopback0 <- Định nghĩa cổng ảo
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0
ip address 152.1.1.1 255.255.255.0
keepalive
!
interface Serial0
ip addres 192.1.1.1 255.255.255.0
no shut
!
!
router IGRP 64 <- kích hoạt quá trình định tuyến IGRP
trên router variance 2
network 10.0.0.0 <- chỉ ra mạng sẽ quảng bá và xác định
cổng nào sẽ gởi và nhận thông tin định tuyến IGRP
network 152.1.0.0
network 192.1.1.0
!
no ip classless
!
end
Router B:
!
hostname RouterB
!
interface Ethernet0
no ip address
ip address 152.1.1.2 255.255.255.0
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clockrate 64000 <- hoạt động như DCE cung cấp xung
clock
no shut
!
interface Serial1
ip address 193.1.1.2 255.255.255.0
clockrate 64000 <- hoạt động như DCE cung cấp xung
clock
no shut
!
router igrp 64 <-kích hoạt quá trình định tuyến IGRP
trên router
network 192.1.1.0 <- chỉ ra mạng sẽ quảng bá và xác
định cổng nào sẽ gởi và nhận thông tin định tuyến IGRP
network 193.1.1.0
network 152.1.0.0
!
no ip classless
!
end
Router C:
!
hostname RouterC
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface serial0
ip address 193.1.1.1 255.255.255.0
!
!
router igrp 64 <- kích hoạt quá trình định tuyến IGRP
trên router, số 64 là số AS
network 193.1.1.0 <- chỉ ra mạng sẽ quảng bá và xác
định cổng nào sẽ gởi và nhận thông tin định tuyến IGRP
network 3.0.0.0
!
no ip classless
!
end
3. Kiểm tra:
- Xem bảng định tuyến trên Router A bằng lệnh show ip route
RouterA#show ip route
Codes: C – connected, S – static, I – IGRP, R – RIP, M
– mobile, B – BGP
D – EIGRP, EX – EIGRP external, 0 – OSPF, IA – OSPF
inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external
type 2
E1 – OSPF external type 1, E2 – OSPF external type 2, E
– EGP
i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, * -
candidate default
U – per-user static route, o – ODR
Gateway of last report is not set
I 3.0.0.0/8 [100/9076] via 152.1.1.1, 00:00:04,
Ethernet0
[100/10976] via 192.1.1.2, 00:00:04, Serial0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
152.1.0.0/24 is subnetted, 1 subnets
C 152.1.1.0 is directly connected, Ethernet0
C 192.1.1.0/24 is directly connected, Serial0
I 193.1.1.0/24 [100/10476] via 192.1.1.2, 00:00:27,
Serial0
[100/8576] via 152.1.1.1, 00:00:27, Ethernet0
Chú ý: Có 2 đường đi đến mạng 3.0.0.0, một đường qua Ethernet cổng (cost l à 9076),
đường kia qua cổng Serial (cost l à 10976). Cost của 2 tuyến đường không bằng nhau, khi
thiết lập variance là 2, tuyến đường qua Serial cổng có cost nhỏ h ơn giá trị này
(10976<18152=90786*2) nên s ẽ được sử dụng.
- Từ Router A xem đường đi đến host 3.3.3.3 bằng lệnh show ip route 3.3.3.3
RouterA#show ip route 3.3.3.3
Routing entry for 3.0.0.0/8
Known via “igrp 64”, distance 100, metric 9076
Redistributing via igrp 64
Advertised by igrp 64 (self originated)
Last update from 192.1.1.2 on Serial0, 00:00:18 ago
Routing Descriptor Blocks:
* 152.1.1.1, from 152.1.1.1, 00:00:18 ago, via
Ethernet0
Route metric is 9076, traffic share count is 1
Total delay is 26000 microseconds, minimum bandwith is
1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
192.1.1.2, from 192.1.1.2,00:00:18 ago, via Serial0
Route metric is 10976, traffic share count is 1
Total delay is 45000 microseconds, minimum bandwith is
1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
Ta thấy cả 2 tuyến đường đến host 3.3.3.3. Dấu * cho biết gói tin từ Router A sẽ sử dụng
đường này để đến host 3.3.3.3
- Từ router A ping host 3.3.3.3. Phép ping phải th ành công
RouterA#ping 3.3.3.3
Type the escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2
second:
!!!!!
- Bây giờ xem lại tuyến đường đi đến host 3.3.3. 3 bằng lệnh show ip route
3.3.3.3
RouterA#show ip route 3.3.3.3
Routing entry for 3.0.0.0/8
Known via “igrp 64”, distance 100, metric 9076
Redistributing via igrp 64
Advertised by igrp 64 (self originated)
Last update from 192.1.1.2 on Serial0, 00:00:06 ag o
Routing Descriptor Blocks:
152.1.1.1, from 152.1.1.1, 00:00:06 ago, via Ethernet0
Route metric is 9076, traffic share count is 1
Total delay is 26000 microseconds, minimum bandwith is
1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
* 192.1.1.2, from 192.1.1.2, 00:00:07 ago, via Serial0
Route metric is 10976, traffic share count is 1
Total delay is 45000 microseconds, minimum bandwith is
1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
Ta thấy dấu * bây giờ ở tuyến đường thứ hai. điều này do router thực hiện cân bằng tải
cho cả 2 tuyến đường để đến mạng 3.0.0.0
- Loại bỏ variance từ router A bằng lệnh no variance
RouterA#configuration terminal
RouterA(config)#router igrp 64
RouterA(config-router)#no variance
- Từ router A xem lại đường đi đến host 3.3.3.3 bằng lệnh show ip route
3.3.3.3. Chú ý rằng chỉ có 1 tuyến đường được sử dụng sau khi loại bỏ variance
đường này sẽ có metric nhỏ hơn vì ta không thực hiện cân bằng tải.
LAB 3-9:
RIP & DISCONTIGUOUS NETWORKS
1. Mô tả:
- Router R1, R2 sử dụng RIP để quảng bá thông tin định tuyến.
- Router R1 hoạt động như DCE cung cấp xung clock cho R2.
- Từ Router R1, R2 ping được các địa chỉ trong mạng.
Chú ý: Discontiguous network là mạng bao gồm nhiều mạng con thuộc c ùng một mạng
chính (major network) bị phân cách bởi một mạng khác. ví dụ nh ư hình trên, mạng con
130.1.1.0/24 trên router R1 được phân cách với mạng 130.1.2.0/24 ở R2 bởi mạng
10.1.1.0
2. Cấu hình:
Router R1:
hostname R1
!
enable password vnpro
!
ip subnet-zero
no ip domain-lookup
!
interface Ethernet0
ip address 130.1.1.1 255.255.255.0
no keepalive
!
interface Serial0
ip address 10.1.1.1 255.255.255.0
clock rate 64000
!
router rip
network 130.1.0.0
network 10.0.0.0
!
end
Router R2:
hostname R2
!
enable password vnpro
!
ip subnet-zero
no ip domain-lookup
!
interface Ethernet0
ip address 130.1.2.1 255.255.255.0
no keepalive
!
interface Serial0
ip address 10.1.1.2 255.255.255.0
!
router rip
network 130.1.0.0
network 10.0.0.0
!
end
3. Các bước thực hiện:
1. Đặt hostname, cấu hình cho loopback, ethernet và serial trên router R1.
Router> en
Router# conf t
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# int e0
R1(config-if)# ip addr 130.1.1.1 255.255.255.0
R1(config-if)# no keepalive <- cho phép cổng Ethernet
vẫn up khi không kết nối với bên ngoài
R1(config-if)# no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to
up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0,
changed state to up
R1(config-if)# exit
R1(config)# int s0
R1(config-if)# ip addr 10.1.1.1 255.255.255.0
R1(config-if)# clock rate 64000 <- hoạt động như DCE
cung cấp xung clock
R1(config-if)# no shut
2. Đặt hostname, cấu hình cho cổng loopback, ethernet và serial trên router R2.
Router> en
Router# conf t
Router(config)# hostname R2
R2(config)# no ip domain-lookup
R2(config)#int e0
R2(config-if)# ip addr 130.1.2.1 255.255.255.0
R1(config-if)# no keepalive
R2(config-if)# no shut
R2(config-if)# int s0
R2(config-if)# ip addr 10.1.1.2 255.255.255.0
R2(config-if)# no shut
3. Cấu hình giao thức định tuyến RIP trên router R1, R2 và lưu cấu hình lên NVRAM.
R1(config)# router rip <- kích hoạt quá trình định
tuyến RIP trên router
R1(config-router)# network 130.1.0.0 <- chỉ ra mạng nào
sẽ chạy RIP
R1(config-router)# network 10.0.0.0
R1(config-router)# end
R1# copy run start
R2(config)# router rip
R2(config-router)# network 130.1.0.0
R2(config-router)# network 10.0.0.0
R2(config-rputer)# end
R2# copy run start
4. Kiểm tra và giải quyết sự cố:
- Xem quá trình gửi nhận thông tin định tuyến RIP bằng lệnh debug ip rip
R2#debug ip rip
R2#
00:12:19: RIP: received v1 update from 10.1.1.1 on
Serial0
00:12:19: 130.1.0.0 in 1 hops
- Tắt chế độ debug bằng lệnh undebug all hoặc viết gọn là u all
R2# u all
All possible debugging has been turned off
- Xem bảng định tuyến trên R2 bằng lệnh show ip route
R2# show ip route
Gateway of last resort is not set
130.1.0.0/24 is subnetted, 1 subnets
C 130.1.2.0 is directly connected, Ethernet0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial0
R2#
- Ta thấy trên R2 không có mạng 130.1.1.0 trong bảng định tuyến. Lý do là RIP chỉ hỗ
trợ classfull nên không gửi đi thông tin về subnet mask tron g các routing update. Khi R1
gửi thông tin về mạng 130.1.1.0 đến R2, R1 sẽ thực hiện summary mạng này về dạng
classfull – 130.1.0.0. R2 kết nối trực tiếp với 130.1.2.0 thì sẽ hiểu mạng này là 130.1.0.0.
Do đó, khi R2 nhận thông tin về mạng 130.1.0.0, nó sẽ loại bản tin update này vì mạng
này đã có trong bảng định tuyến với metric cao hơn.
- Để giải quyết vấn đề này ta sử dụng địa chỉ secondary tr ên cổng kết nối giữa R1 và R2,
địa chỉ này phải thuộc major network trong mạng discontiguous network v à phải cùng
subnetmask.
R1(config)# int s0
R1(config-if)# ip address 130.1.3.1 255.255.255.0
secondary
R2(config)#int s0
R2(config-if)# ip address 130.1.3.2 255.255.255.0
secondary
- Dùng lệnh clear ip route * để xóa toàn bộ route từ bảng định tuyến.
R1# clear ip route *
- Xem quá trình gửi nhận thông tin định tuyến RIP bằng lệnh debug ip rip . Chú ý rằng
R2 bây giờ nhận update về mạng 131.1.1.0 từ R1.
R2#debug ip rip
R2#
00:15:10: RIP: received v1 update from 130.1.3.1 on
Serial0
00:15:10: 130.1.1.0 in 1 hops
- Xem bảng định tuyến trên R2 bằng lệnh show ip route
R2# show ip route
Gateway of last resort is not set
130.1.0.0/24 is subnetted, 4 subnets
C 130.1.3.0 is directly connected, Serial0
C 130.1.2.0 is directly connected, Ethernet0
R 130.1.1.0[120/1] via 130.1.3.1, 00:00:25, Serial0
R 130.1.0.0 [120/1] via 10.1.1.1, 00:00:25, Serial0
10.0.0.0/24 is subnetted, 2 subnets
R 10.1.0.0 [120/1] via 130.1.3.1, 00:00:25, Serial0
C 10.1.1.0 is directly connected, Serial0
R2#
LAB 3-10:
REDISTRIBUTE GI ỮA RIP & IGRP
1. Mô tả:
- Router R1, R3 sử dụng IGRP để quảng bá thông tin định tuyến.
- Router R1, R2 sử dụng RIP để quảng bá thông tin định tuyến.
- Router R1 hoạt động như DCE cung cấp xung clock cho R2 và R3.
- Từ router R1, R2, R3 phải ping được hết các địa chỉ trong mạng.
2. Cấu hình:
Router R1:
hostname R1
!
enable password vnpro
!
ip subnet-zero
no ip domain-lookup
!
interface Serial0
ip address 9.1.1.1 255.255.255.0
clock rate 64000
!
interface Serial1
ip address 9.1.2.1 255.255.255.0
clock rate 64000
!
router rip
redistribute igrp 10 metric 1
passive-interface Serial1
network 9.0.0.0
!
router igrp 10
redistribute rip metric 128 20000 255 1 1500
passive-interface Serial0
network 9.0.0.0
!
end
Router R2:
hostname R2
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Ethernet0
ip address 10.1.1.1 255.255.255.0
!
interface Serial0
ip address 9.1.1.2 255.255.255.0
!
router rip
network 9.0.0.0
network 10.0.0.0
!
end
Router R3:
hostname R3
!
enable password vnpro
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 10.1.2.1 255.255.255.0
!
interface Ethernet0
ip address 9.1.3.1 255.255.255.0
!
interface Serial0
ip address 9.1.2.2 255.255.255.0
!
router igrp 10
network 9.0.0.0
network 10.0.0.0
!
end
3. Các bước thực hiện:
1. Đặt hostname, cấu hình cho các cổng trên R1:
Router> en
Router# conf t
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# int Serial0
R1(config-if)# ip addr 9.1.1.1 255.255.255.0
R1(config-if)# clock rate 64000 <- hoạt động như DCE
cung cấp xung clock
R1(config-if)# no shut
R1(config-if)# exit
R1(config)# int Serial1
R1(config-if)# ip addr 9.1.2.1 255.255.255.0
R1(config-if)# clock rate 64000 <- hoạt động như DCE
cung cấp xung clock
R1(config-if)# no shut
2. Đặt hostname, cấu hình cho cổng trên R2:
Router> en
Router# conf t
Router(config)# hostname R2
R2(config)# no ip domain-lookup
R2(config)#int e0
R2(config-if)# ip addr 10.1.1.1 255.255.255.0
R2(config-if)# no keepalive
R2(config-if)# no shut
R2(config-if)# int s0
R2(config-if)# ip addr 9.1.1.2 255.255.255.0
R2(config-if)# no shut
3. Đặt hostname, cấu hình cho cổng trên router R3.
Router> en
Router# conf t
Router(config)# hostname R3
R3(config)# no ip domain-lookup
R3(config-if)# int Ethernet0
R3(config-if)# ip address 9.1.3.1 255.255.255.0
R3(config-if)# no keepalive
R3(config-if)# no shut
R3(config-if)# int s0
R3(config-if)# ip addr 9.1.2.2 255.255.255.0
R3(config-if)# no shut
4. Cấu hình giao thức định tuyến IGRP với AS là 100 trên router R3.
R3(config)# router igrp 100 <- kích hoạt quá trình định
tuyến IGRP trên router với AS là 100
R3(config-router)# network 9.0.0.0 <- chỉ ra mạng nào
sẽ chạy IGRP
R3(config-router)# end
R3#
Lưu ý: Vì IGRP và RIP thuộc dạng classfull nên sẽ tự động thực hiện sumarization về địa
chỉ classfull lớp A.
5. Cấu hình giao thức định tuyến RIP trên router R2.
R2(config)# router rip
R2(config-router)# network 9.0.0.0
R2(config-router)# network 10.0.0.0
R2(config-rputer)# end
R2#
6. Cấu hình giao thức định tuyến RIP và IGRP cho mạng 9.0.0.0 trên router R1.
R1(config)# router rip
R1(config-router)# network 9.0.0.0
R1(config-router) router igrp 100
R1(config-router)# network 9.0.0.0
R1(config-rputer)# end
R1#
7. Trên router R1, ta cần đảm bảo rằng RIP updates không gửi sang R3 (chạy IGRP) v à
đảm bảo IGRP updates từ R3 không gửi sang R2 (chạy RIP). Do đó ta cần thực hiện
passive interface trên R1 để đảm bảo không quảng cáo các thông tin update ra mạng
ngoài.
R1(config)# router rip
R1(config-router)# passive-interface Serial1 <- Đảm bảo
RIP updates không gửi sang R3
R1(config-router)# router igrp 100
R1(config-router)# passive-interface Serial0 <- Đảm bảo
IGRP updates không gửi sang R2
8. Kiểm tra bảng định tuyến.
- Dùng lệnh clear ip route * để xóa toàn bộ route từ bảng định tuyến. Tr ước khi
xóa bảng route, ta nên dùng lệnh debug ip routing để quan sát trạng thái cập nhật
route.
R1# clear ip route *
- Xem bảng định tuyến trên R1 bằng lệnh show ip route
R1# show ip route
...
Gateway of last resort is not set
9.0.0.0/24 is subnetted, 3 subnets
C 9.1.1.0 is directly connected, Serial0
C 9.1.2.0 is directly connected, Serial1
I 9.1.3.0 [100/80225] via 9.1.2.2, 00:00:31, Serial1
R 10.0.0.0/8 [120/1] via 9.1.1.2, 00:00:15, Serial0
R1#
- Xem bảng định tuyến trên R2 bằng lệnh show ip route.
R2# show ip route
...
9.0.0.0/24 is subnetted, 2 subnets
C 9.1.1.0 is directly connected, Serial0
R 9.1.2.0 [120/1] via 9.1.1.1, 00:00:27, Serial0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Ethernet0
R2#
Xem bảng định tuyến trên R2 ta thấy R2 không kết nối được với mạng 9.1.3.0/24. Do đó,
ta cần cấu hình redistribute trên router R1 để cho phép R2 thấy mạng 9.1.3.0/24.
Chú ý:Redistribution định nghĩa cách thức trao đổi routing updates gi ữa các giao thức
định tuyến khác nhau. Mỗi giao thức định tuyến có cách định nghĩa về metric khác nhau,
do đó khi thực hiện redistribution ta cần phải chuyển đổi dạng metric sao cho phù hợp với
giao thức định tuyến đó.
9. Để R2 thấy được R3 ta thực hiện redistribute IGRP trong RIP với hop count là 1
R1(config)# router rip
R1(config-router)# redistribute igrp 100 metric 1
10. Để R3 thấy được R2 ta thực hiện redistribute RIP trong IGRP, sử dụng ký tự giúp đỡ
? để hiển thị IGRP metric.
R1(config)# router igrp 100
R1(config-router)# redistribute rip ?
Metric Metric for redistributed routed
route-map Route map reference
R1(config-router)# redistribute rip metric ?
&lt;1-4294967295> Bandwidth metric in Kbits per second
R1(config-router)# redistribute rip metric 128 ?
&lt;0-4294967295> IGRP delay metric, in 10 microsecond
units
R1(config-router)# redistribute rip metric 128 20000 ?
&lt;0-255> IGRP reliability metric where 255 is 100%
reliable
R1(config-router)# redistribute rip metric 128 20000
255 ?
&lt;0-255> IGRP effective bandwidth metric (Loading)
where 255 is 100% loaded
R1(config-router)# redistribute rip metric 128 20000
255 1 ?
&lt;0-4294967295> IGRP MTU of the path
R1(config-router)# redistribute rip metric 128 20000
255 1 1500
11. Sau khi cấu hình, thực hiện clear ip route * và xem lại bảng định tuyến trên router R2.
Ping mạng 9.1.3.0 để kiểm tra đã kết nối được với mạng IGRP chưa.
R2# show ip route
9.0.0.0/24 is subnetted, 3 subnets
C 9.1.1.0 is directly connected, Serial0
R 9.1.2.0 [120/1] via 9.1.1.1, 00:00:09, Serial0
R 9.1.3.0 [120/1] via 9.1.1.1, 00:00:09, Serial0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Ethernet0
R2#
R2#ping 9.1.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 9.1.3.1, timeout is 2
seconds:
! ! ! ! !
Success rate is 100 percent (5/5), round -trip
min/avg/max = 28/29/32 ms
12. Xem bảng định tuyến trên router R3. Ping mạng 10.1.1.0 để kiểm tra đã kết nối với
mạng RIP chưa.
R3# show ip route
9.0.0.0/24 is subnetted, 3 subnets
I 9.1.1.0 [100/84000] via 9.1.2.1, 00:00:58, Serial0
C 9.1.2.0 is directly connected, Serial0
C 9.1.3.0 is directly connected, Ethernet0
I 10.0.0.0/8 [100/102000] via 9.1.2.1, 00:00:58,
Serial0
R3#
R3#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 9.1.3.1, timeout is 2
seconds:
! ! ! ! !
Success rate is 100 percent (5/5), round -trip
min/avg/max = 28/29/32 ms
13. Mở rộng vấn đề hơn, ta thêm một subnet mới vào R3 bằng cách cấu hình interface
loopback 10.1.2.1/24 sử dụng IGRP.
R3(config)# int loopback0
R3(config-if)# ip address 10.1.2.1 255.255.255.0
R3(config-if)# router igrp 100
R3(config-router)# network 10.0.0.0
Ban đầu, R3 sẽ không quảng cáo mạng 10.0.0.0 đến router R1 vì R1 chỉ biết đến mạng
10.0.0.0/8 thông qua quảng cáo RIP với AD là 120 từ R2.
R1# show ip route
Gateway of last resort is not set
9.0.0.0/24 is subnetted, 3 subnets
C 9.1.1.0 is directly connected, Serial0
C 9.1.2.0 is directly connected, Serial1
I 9.1.3.0 [100/80225] via 9.1.2.2, 00:00:31, Serial1
R 10.0.0.0/8 [120/1] via 9.1.1.2, 00:00:15, Serial0
R1#
Khi IGRP update từ R3 gửi đến R1, bảng định tuyến trên R1 sẽ thay đổi như sau:
R1# show ip route
Gateway of last resort is not set
9.0.0.0/24 is subnetted, 3 subnets
C 9.1.1.0 is directly connected, Serial0
C 9.1.2.0 is directly connected, Serial1
I 9.1.3.0 [100/80225] via 9.1.2.2,00:00:53, Serial1
I 10.0.0.0/8 [100/80225] via 9.1.1. 2, 00:00:53, Serial1
R1#
Nguyên do của sự thay đổi này là do R3 sử dụng IGRP nên có AD=100 thấp hơn RIP
(AD=120) nên R1 sẽ gửi tất cả các lưu lượng cho mạng 10.0.0.0 qua router R3.
R1#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is
2 seconds:
. . . . .
Success rate is 0 percent (0/5)
R1#ping 10.1.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is
2 seconds:
! ! ! ! !
Success rate is 100 percent (5/5), round-trip
min/avg/max = 12/14/16 ms
14. Để giải quyết vấn đề này ta cấu hình static route đến R2:
R1(config)# ip route 10.1.1.0 255.255.255.0 Serial0
15. Kiểm tra kết quả thực hiện
R1# show ip route
Gateway of last resort is not set
9.0.0.0/24 is subnetted, 3 subnets
C 9.1.1.0 is directly connected, Serial0
C 9.1.2.0 is directly connected, Serial1
I 9.1.3.0 [100/80225] via 9.1.2.2, 00:00:53, Serial1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 10.1.1.0/24 is directly connected, Se rial0
I 10.0.0.0/8 [100/80225] via 9.1.1.2, 00:00:53, Serial1
R1#
R1#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is
2 seconds:
! ! ! ! !
Success rate is 0 percent (5/5), round -trip min/avg/max
= 16/16/16 ms
R1#pi ng 10.1.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is
2 seconds:
! ! ! ! !
Success rate is 100 percent (5/5), round -trip
min/avg/max = 12/14/16 ms
LAB 3-11:
CẤU HÌNH EIGRP CƠ BẢN
1. Mô tả:
- Router R1, R2 sử dụng EIGRP để quảng bá thôngtin định tuyến.
- Router R1 hoạt động như DCE cung cấp xung clock cho router R2.
- Từ router R1, R2 ping được hết các địa chỉ trong mạng.
Chú ý:
- Mặc định, EIGRP cho phép summarization n ên bạn kg cần sử dụng lệnh no
auto-summarization để kg cho phép tự động thực hiện summarization.
- EIGRP hỗ trợ VLSM. Chú ý rằng mạng ethernet tr ên R1 và R2 sử dụng khoảng
địa chỉ khác nhau là 131.108.1.0/25 và 131.108.1.128/25.
- Metric của EIGRP bằng metric của IGRP nhân với 256.
2. Cấu hình:
Router R1:
hostname R1
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 199.100.4.1 255.255.255.0
!
interface Loopback1
ip address 199.100.5.1 255.255.255.0
!
interface Loopback2
ip address 199.100.6.1 255.255.255.0
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.128
!
interface Serial0
ip address 199.100.3.1 255.255.255.0
clock rate 64000
!
router eigrp 234
network 131.108.0.0
network 199.100.3.0
network 199.100.4.0
network 199.100.5.0
network 199.100.6.0
no auto-summary
!
end
Router R2:
hostname R2
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 199.100.7.1 255.255.255.0
!
interface Loopback1
ip address 199.100.8.1 255.255.255.0
!
interface Loopback2
ip address 199.100.9.1 255.255.255.0
!
interface Ethernet0
ip address 131.108.1.129 255.255.255.128
!
interface Serial0
ip address 199.100.3.2 255.255.255.0
!
router eigrp 234
network 131.108.0.0
network 199.100.3.0
network 199.100.7.0
network 199.100.8.0
network 199.100.9.0
no auto-summary
!
end
3. Các bước thực hiện:
1. Đặt hostname, cấu hình cho cổng loopback, ethernet và serial trên router R1.
Router> en
Router# conf t
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# int e0
R1(config-if)# ip addr 131.108.1.1 255.255.255.128
R1(config-if)# no keepalive <- cho phép cổng ethernet
vẫn up khi kg kết nối với bên ngoài.
R1(config-if)# no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to
up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0,
changed state to up
R1(config-if)# exit
R1(config)# int lo0 <- Định nghĩa interface ảo để làm
điểm kiểm tra
R1(config-if)# ip addr 199.100.4.1 255.255.255.0
R1(config-if)# int lo1
R1(config-if)# ip addr 199.100.5.1 255.255.255.0
R1(config-if)# int lo2
R1(config-if)# ip addr 199.100.6.1 255.255.255.0
R1(config-if)# exit
R1(config-if)# int s0
R1(config-if)# ip addr 199.100.3.1 255.255.255.0
R1(config-if)# clock rate 64000 <- hoạt động như DCE
cung cấp xung clock
R1(config-if)# no shut
2. Đặt hostname, cấu hình cho cổng loopback, ethernet và serial trên router R2.
Router(config)# hostname R2
R2(config)# no ip domain-lookup
R2(config)#int e0
R2(config-if)# ip addr 131.108.1.129 255.255.255.128
R2(config-if)# no keepalive
R2(config-if)# no shut
R2(config-if)# int lo0
R2(config-if)# ip addr 199.100.7.1 255.255.255.0
R2(config-if)# int lo1
R2(config-if)# ip addr 199.100.8.1 255.255.255.0
R2(config-if)# int lo2
R2(config-if)# ip addr 199.100.9.1 255.255.255.0
R2(config-if)# int s0
R2(config-if)# ip addr 192.100.3.2 255.255.255.0
R2(config-if)# no shut
3. Cấu hình giao thức định tuyến EIGRP và lưu cấu hình vào NVRAM trên router R1.
R1(config)# router eigrp 234 <- kích hoạt quá trình
định tuyến EIGRP trên router
R1(config-router)# network 131.108.1.0 <- chỉ ra mạng
nào sẽ quảng bá và xác định cổng nào sẽ gởi và nhận
thông tin định tuyến
R1(config-router)# network 199.100.4.0
R1(config-router)# network 199.100.5.0
R1(config-router)# network 199.100.6.0
R1(config-router)# network 199.100.3.0
R1(config-router)# end
R1# copy run start
4. Cấu hình giao thức định tuyến EIGRP và lưu cấu hình vào NVRAM trên router R2.
R2(config)# router eigrp 234
R2(config-router)# network 199.100.7.0
R2(config-router)# network 199.100.8.0
R2(config-router)# network 199.100.9.0
R2(config-router)# network 131.108.1.0
R2(config-router)# network 199.100.3.0
R2(config-rputer)# end
R2# copy run start
4. Kiểm tra:
1. Dùng lệnh clear ip route * để xóa toàn bộ route từ bảng định tuyến.
R1# clear ip route *
2. Xem quá trình gửi nhận thông tin định tuyến EIGRP bằng lệnh debug ip eigrp
events
R1# debug ip igrp events
EIGRP event debugging is on
3. Tắt chế độ dubug bằng lệnh undebug all
R1# undebug all
All possible debugging has been turned off
4 Xem bảnh định tuyến EIGRP tr ên R1 và R2 bằng lệnh show ip route eigrp
R1# show ip route eigrp
D 199.100.9.0/24 [90/2297856] via 199.100.3.2,
00:00:55, Serial0
D 199.100.8.0/24 [90/2297856] via 199.100.3.2,
00:00:55, Serial0
131.108.0.0/16 is variably subnetted, 2 subnets, 2
masks
D 131.108.0.0/16 is a summary, 00:00:55, Null0
D 199.100.7.0/24 [90/2297856] via 199.100.3.2 00:00:55,
Serial0
R1#
Dựa vào bảng định tuyến, bạn có thể thấy có các route EIGRP học từ next -hop
199.100.3.2 và đi qua cổng S0. Trong các tuyến đường, có 1 tuyến đi đến Null0. Chú ý số
AD trong từng trường hợp EIGRP là 90 (RIP là 120, IGRP là 100 và OSPF là 110). Ký t ự
D có nghĩa là loại định tuyến là EIGRP. Metric của EIGRP bằng 256 lần metric của
IGRP.
Chú ý:
- Mặc định EIGRP cho hpép tự động thực hiện summarization. Router R1 không thấy
mạng 131.108.1.128/25 bởi vì router R1 kết nối trực tiếp với mạng 131.108.1.0/25. Ta
thấy tất cả các route đến từ mạng 131.108.0.0/16 đều gởi đến Null0.
5. Từ router R1, ta thực hi ện ping mạng 131.108.1.129/25
R1#ping 131.108.1.129
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 131.108.1.130,
timeout is 2 seconds:
. . . . .
Success rate is 0 percent (0/5)
R1#
Kết quả là không có hồi đáp do các gói gửi đến null0 sẽ bị loại bỏ.
6. Để giải quyết vấn đề này ta cần thực hiện lệnh no auto-summary để không cho
phép router tự động thực hiện summarization.
R1(config)#router eigrp 234
R1(config-router)#no auto-summary
R2(config)#router eigrp 234
R2(config-router)#no auto-summary
7. Kiểm tra kết quả thực hiện.
R1# show ip route eigrp
D 199.100.9.0/24 [90/2297856] via 199.100.3.2,
00:00:01, Serial0
D 199.100.8.0/24 [90/2297856] via 199.100.3.2,
00:00:01, Serial0
131.108.0.0/16 is variably subnetted, 2 subnets, 2
masks
D 131.108.1.128/25 [90/2195456] via 199.100.3.2,
00:00:01, Serial0
D 199.100.7.0/24 [90/2297856] via 199.100.3.2 00:00:01,
Serial0
R1#
R1#ping 131.108.1.129
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 131.108.1.130,
timeout is 2 seconds:
! ! ! ! !
Success rate is 100 percent (5/5), round -trip
min/avg/max = 16/16/16 ms
R1#
Chú ý:
Mạng 131.108.1.128/25 có trong bảng định tuyến. Từ router R1 ta ping th ành công cổng
ethernet trên router R2. Để hiểu sâu thêm về vấn đề này, bạn cần tìm hiểu thêm về các
chủ đề classful, classless và VLSM.
LAB 3-12:
REDISTRIBUTE GI ỮA EIGRP & IGRP
1. Mô tả:
- Giao thức định tuyến EIGRP được sử dụng trên Router A, B, C. Router B đóng
vai trò là DCe cung cấp xungclock hoạt động cho router A v à C.
- Giao thức định tuyến IGRP được sử dụng trên Router C, D. router C đóng vai tr ò
là DCE cung cấp xung clock hoạt động cho router D.
- Bài Lab này sẽ mô tả cách thức redistribution giữa IGRP & EI GRP.
2. Cấu hình:
Router A:
!
hostname RouterA
!
interface Loopback0
ip address 192.1.1.1 255.255.255.0
!
interface Serial0
ip address 192.1.1.1 255.255.255.0
!
router eigrp 100
network 192.1.1.0
network 1.0.0.0
!
end
Router B:
!
hostname RouterB
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clock rate 64000
!
interface Serial1
ip address 194.1.1.2 255.255.255.0
clock rate 64000
!
router eigrp 100
network 192.1.1.0
network 194.1.1.0
!
end
Router C:
!
hostname RouterC
!
interface Serial0
ip address 194.1.1.1 255.255.255.0
!
interface Serial1
ip address 195.1.1.1 255.255.255.0
clock rate 64000
!
router eirgp 100
network 194.1.1.0
!
router igrp 200
network 195.1.1.0
!
end
Router D:
!
hostname RouterD
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Serial0
ip address 195.1.1.2 255.255.255.0
!
router igrp 200
network 195.1.1.0
network 4.0.0.0
!
end
3. Các bước thực hiện:
1. Cấu hình trên Router A:
Router> en
Router# conf t
Router(config)# hostname RouterA
RouterA (config)# int lo0
RouterA (config-if)# ip addr 1.1.1.1 255.255.255.0
RouterA (config-if)# int s0
RouterA (config-if)# ip addr 192.1.1.1 255.255.255.0
RouterA (config-if)# no shut
RouterA (config-if)#exit
RouterA (config)# router eigrp 100
RouterA (config-router)# network 192.1.1.0
RouterA (config-router)# network 1.0.0.0
RouterA (config-router)# end
RouterA# copy run start
RouterA#
2. Cấu hình trên Router B:
Router(config)# hostname RouterB
RouterB (config)# int s0
RouterB (config-if)# ip addr 192.1.1.2 255.255.255.0
RouterB (config-if)# clock rate 64000
RouterB (config-if)# no shut
RouterB (config-if)# int s1
RouterB (config-if)# ip addr 194.1.1.2 255.255.255.0
RouterB (config-if)# clock rate 64000
RouterB (config-if)# no shut
RouterB (config-if)#exit
RouterB (config)# router eigrp 100
RouterB (config-router)# network 192.1.1.0
RouterB (config-router)# network 194.1.1.0
RouterB (config-router)# end
RouterB# copy run start
RouterB#
3. Cấu hình trên Router C:
Router> en
Router# conf t
Router(config)# hostname RouterC
RouterC (config)# int s0
RouterC (config-if)# ip addr 194.1.1.1 255.255.255.0
RouterC (config-if)# no shut
RouterC (config-if)# int s1
RouterC (config-if)# ip addr 195.1.1.1 255.255.255.0
RouterC (config-if)# clock rate 64000
RouterC (config-if)# no shut
RouterC (config-if)#exit
RouterC (config)# router eigrp 100
RouterC (config-router)# network 194.1.1.0
RouterC (config-router)# router igrp 200
RouterC (config-router)# network 195.1.1.0
RouterC (config-router)# end
RouterC# copy run start
RouterC#
4. Cấu hình trên Router D:
Router> en
Router# conf t
Router(config)# hostname RouterD
RouterD(config)# int lo0
RouterD(config-if)# ip addr 4.4.4.4 255.255.255.0
RouterD(config-if)# int s0
RouterD(config-if)# ip addr 195.1.1.2 255.255.255.0
RouterD(config-if)# no shut
RouterD(config-if)#exit
RouterD(config)# router igrp 200
RouterD(config-router)# network 195.1.1.0
RouterD(config-router)# network 4.0.0.0
RouterD(config-router)# end
RouterD# copy run start
RouterD#
4. Kiểm tra:
1. Xem bảng định tuyến trên router C bằng lệnh show ip route
RouterC# show ip route
D 1.0.0.0/8 [90/2809856] via 194.1.1.2, 00:00:55,
Serial0
I 4.0.0.0/8 [100/8976] via 195.1.1.2, 00:00:10, Serial1
D 192.1.1.0/24 [90/2681856] via 194.1.1.2, 00:00:55,
Serial0
C 194.1.1.0/24 is directly connected, Serial0
C 195.1.1.0/24 is directly connected, Serial1
RouterC#
Chú ý rằng Router C học các route của router A qua giao thức định tuyến EIGRP.
2. Xem bảng định tuyến trên router B bằng lệnh show ip route
RouterB# show ip route
D 1.0.0.0/8 [90/2297856] via 192.1.1.1, 00:01: 50,
Serial0
C 192.1.1.0/24 is directly connected, Serial0
C 194.1.1.0/24 is directly connected, Serial1
RouterB#
Chú ý rằng Router B không học các route xuất phát từ các mạng đ ược quảng bá bởi giao
thức IGRP.
3. Xem bảng định tuyến trên router D bằng lệnh show ip route
RouterD# show ip route
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 195.1.1.0/24 is directly connected, Serial0
RouterD#
Chú ý:
- Router B kg học các route xuất phát từ các mạng đ ược quảng bá bởi giao thức
IGRP. Tại sao IGRP và EIGRP không thực hiện automatic redistribution? Nguyên
do là IGRP và EIGRP có số AS number khác nhau, tính năng automatic
resdistribution chỉ thực hiện khi IGRP và EIGRP có cùng số AS number.
- EIGRP và IGRP sử dụng metric có cấu trúc giống nhau. Do đó nếu các router
chạy IGRP và các router khác chạy EIGRP và cả hai đều có cùng số autonomous
system thì thông tin định tuyến sẽ tự động chia sẻ giữa hai hệ thống.
- EIGRP dùng 32 bit để lưu trữ metric và IGRP dùng 24 bit để lưu trữ metric. Khi
đó các tuyến đường EIRGP được chia cho 256 để chuyển về cấu trúc 24 bit của
IGRP và các tuyến đường IGRP được nhân cho 256 để chuyển về cấu trúc 32 bit
của EIGRP.
4. Do đó cần thay đổi số AS number của IGRP trên Router C và router D là 100.
RouterC(config)# no router igrp 200
RouterC(config)# router igrp 100
RouterC(config-router)# network 195.1.1.0
RouterD(config)# no router igrp 200
RouterD(config)# router igrp 100
RouterD(config-router)# network 195.1.1.0
RouterD(config-router)# network 4.0.0.0
5. Kiểm tra lại bảng định tuyến tr ên Router D bằng lệnh show ip route
RouterD# show ip route
I 1.0.0.0/8 [100/12976] via 195.1.1.1, 00:00:05,
Serial0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
I 192.1.1.0/24 [100/12476] via 195.1.1.1, 00:00:05,
Serial0
I 194.1.1.0/24 [100/12476] via 195.1.1.1, 00:00:05,
Serial0
RouterD#
Ta thấy Router D đã học các route xuất phát từ Router A.
6. Nếu kg thay đổi số AS number của IGRP t hì ta có thể thực hiện reditribution từ EIRGP
sang IGRP và ngược lại trên Router C.
RouterC#config t
Enter configuration commands, one per line. End with
CNTL/Z.
RouterC(config)#router igrp 200
RouterC(config-router)#redistribute eigrp 100 metric
2000 200 255 1 1500
RouterC(config-router)#exit
RouterC(config)#router eigrp 100
RouterC(config-router)#redistribute igrp 200 metric
2000 200 255 1 1500
RouterC(config-router)#
7. Cuối cùng, kiểm tra lại bảng định tuyến để xem sự thay đổi route tr ên mỗi router.
LAB 3-13:
CẤU HÌNH OSPF CƠ BẢN
1. Mô tả:
– Router Ra, R2 sử dụng OSPF để quảng bá thông tin định tuyến
– Router R1 hoạt động như DCE cung cấp xung clock cho R2
– Các router cấu hình giao thức định tuyến OSPF để liên lạc giữa các area.
– Từ router R1, R2 ping được hết các địa chỉ trong mạng.
OSPF dùng giải thuật SPF để tính tóan đường đi. Giải thuật này còn được gọi là giải thuật
Dijkstra. Các routing protocol nhóm link state không broadcast tòan bộ thông tin về bảng
định tuyến giống như RIP/IGRP và thay vào đó, OSPF s ẽ dùng một quá trình để khám
phá các láng giềng (neighbor). Các láng giềng cũng có thể đ ược định nghĩa tĩnh.
Router láng giềng là các router khác, cũng chạy OSPF, có chung subnet với router hiện
hành. Khi các router đã thiết lập quan hệ láng giềng với nhau, các router bắt đầu trao đổi
các thông tin về đồ hình (topology) của mạng. Giải thuật SPF sẽ chạy tr ên các database
này để tính ra các đường đi tốt nhất.
Trong ospf định nghĩa một số vùng cơ bản sau:
1. Stub Area: đây là vùng sẽ không nhận những routing update từ b ên ngoài (Type 5)
nhưng vẫn nhận update từ những Area láng giềng (Type 3)
2. Totaly stub Area: đây có thể coi là vùng cực đoan nhất nó không nhận bất cứ routing
update nào, và trong bảng routing của nó chỉ có một routing ra ngoai duy nhất l à default
route. vùng này thích hợp cho những site ở xa có ít network v à cần sự giới hạn kết nối ra
bên ngoài.
3. NSSA Stub Area: đây là vùng được sử dụng khi kết nối đến ISP hoặc khi có sự
redistribute giữa các routing protocol khác nhau. v ùng này sẽ nhận các route từ bên ngoài
dưới dạng type 7 và sẽ chuyển đổi type 7 này thành type 5 để quảng bá vào các Area khác
tại con NNSA ABR.
4. Backbone Area: đây chính là vùng Area 0 và nó connect t ới tất cả các area khác còn
lại, nếu một area nào đó muốn nối tới Area0 nhưng không nối trực tiếp được thì lúc đó ta
phải tao virtual link cho Area này.
2. Cấu hình:
Router R1
hostname R1
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 131.108.4.1 255.255.255.255
!
interface Loopback1
ip address 131.108.4.2 255.255.255.255
!
interface Loopback2
ip address 131.108.4.3 255.255.255.255
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.0
!
interface Serial0
ip address 131.108.3.1 255.255.255.252
clock rate 64000
!
router ospf 1
network 131.108.1.0 0.0.0.255 area 1
network 131.108.3.1 0.0.0.0 area 0
network 131.108.4.1 0.0.0.0 area 1
network 131.108.4.2 0.0.0.0 area 1
network 131.108.4.3 0.0.0.0 area 1
!
end
Router R2
hostname R2
!
enable password cisco
!
ip subnet-zero
no ip domain-lookup
!
interface Loopback0
ip address 131.108.4.4 255.255.255.255
!
interface Loopback1
ip address 131.108.4.5 255.255.255.255
!
interface Loopback2
ip address 131.108.4.6 255.255.255.255
!
interface Ethernet0
ip address 131.108.2.1 255.255.255.0
!
interface Serial0
ip address 131.108.3.2 255.255.255.252
!
router ospf 2
network 131.108.2.0 0.0.0.255 area 2
network 131.108.3.2 0.0.0.0 area 0
network 131.108.4.4 0.0.0.0 area 2
network 131.108.4.5 0.0.0.0 area 2
network 131.108.4.6 0.0.0.0 area 2
!
end
3. Các bước thực hiện:
1. Đặt hostname, cấu hình cho interface loopback, ethernet và serial trên Router R1.
Router> en
Router# conf t
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# int e0
R1(config-if)# ip addr 131.108.1.1 255.255.255.0
R1(config-if)# no keepalive
R1(config-if)# no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to
up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0,
changed state to up
R1(config-if)# exit
R1(config)# int lo0
R1(config-if)# ip addr 131.108.4.1 255.255.255.255
R1(config-if)# int lo1
R1(config-if)# ip addr 131.108.4.2 255.255.255.255
R1(config-if)# int lo2
R1(config-if)# ip addr 131.108.4.3 255.255.255.255
R1(config-if)# exit
R1(config-if)# int s0
R1(config-if)# ip addr 131.108.3.1 255.255.255.252
R1(config-if)# clock rate 64000
R1(config-if)# no shut
2. Đặt hostname, cấu hình cho interface loopback, ethernet và serial trên Router R2.
Router> en
Router# conf t
Router(config)# hostname R2
R2(config)# no ip domain-lookup
R2(config)#int e0
R2(config-if)# ip addr 131.108.2.1 255.255.255.0
R1(config-if)# no keepalive
R2(config-if)# no shut
R2(config-if)# int lo0
R2(config-if)# ip addr 131.108.4.4 255.255.255.255
R2(config-if)# int lo1
R2(config-if)# ip addr 131.108.4.5 255.255.255.255
R2(config-if)# int lo2
R2(config-if)# ip addr 131.108.4.6 255.255.255.255
R2(config-if)# int s0
R2(config-if)# ip addr 131.108.3.2 255.255.255.252
R2(config-if)# no shut
3. Cấu hình giao thức định tuyến OSPF với process number l à 1 trên router R1 và lưu cấu
hình lên NVRAM.
R1(config)# router ospf 1
R1(config-router)# network 131.108.1.0 0.0.0.255 area 1
R1(config-router)# network 131.108.4.1 0.0.0.0 area 1
R1(config-router)# network 131.108.4.2 0.0.0.0 area 1
R1(config-router)# network 131.108.4.3 0.0.0.0 area 1
R1(config-router)# network 131.108.3.1 0.0.0.0 area 0
R1(config-router)# end
R1# copy run start
Chú ý:
- Giá trị process chỉ mang ý nghĩa cục bộ tr ên mỗi router, có thể chạy cùng lúcn hiều
process ospf khác nhau.
- Wildcard mask 0.0.0.0 s ẽ chỉ chính xác địa chỉ nào được kiểm tra
Wildcard mask 0.0.0.255 nghĩa là chỉ 3 octet đầu sẽ bị kiểm tra
- Ví dụ network 131.108.1.0 0.0.0.255 nghĩa là sẽ kiểm tra các địa chỉ từ 131.108.1.1 đến
131.108.1.254.
4. Cấu hình giao thức định tuyến OSPF với process number l à 2 trên router R2 và lưu cấu
hình lên NVRAM.
R2(config)# router ospf 2
R2(config-router)# network 131.108.2.1 0.0.0.255 area 2
R2(config-router)# network 131.108.4.4 0.0.0.0 area 2
R2(config-router)# network 131.108.4.5 0.0.0.0 area 2
R2(config-router)# network 131.108.4.6 0.0.0.0 area 2
R2(config-router)# network 131.108.3.2 0.0.0.0 area 0
R2(config-router)# end
R2# copy run start
- Trong ospf có sử dụng ba ID:
Router ID: Được gửi đi từ các router trong các gói tin hello.Nó có độ d ài
32bit.No có giá trị bằng địa chỉ địa chỉ IP lớn nhất đ ược sủ dụng trên router.Nếu
trên router có giao di ện loopback được cấu hình thì router ID bằng địa chỉ IP của
giao diện loopback đó.Trong tr ường hợp có nhiều giao diện loopback th ì nó lấy
địa chỉ lớn nhất của giao diện loopback l àm router ID.Router ID được sử dụng để
phân biệt các router nằm trong cùng một autonmous system.
Process ID: là tham số cấu hình khi ta đánh lệnh router ospf prcess-id.
Area ID: là tham số để group một nhóm các router vào cùng một area.Các router
này cùng chia sẻ hiểu biết về các đường học được trong miền OSPF. Việc chia
thành nhiều area là để tiện việc quản lý đồng thời nó giúp ta giới hạn kích thước
của topology database, giả sử nếu ta có duy nhất một v ùng với kích thước lớn thì
lúc đó ta cũng sẽ có một topology database rất lớn t ương ứng khiến cho việc xử lý
của router chậm đi.......
4. Kiểm tra và giải quyết sự cố:
–Dùng lệnh clear ip route * để xoá toàn bộ route từ bảng định tuyến.
R1# clear ip route *
–Dùng lệnh clear ip ospf process hoặc reload để kích hoạt lại quá trình định
tuyến ospf.
R1#clear ip ospf process
–Xem quá trình gửi nhận thông tin định tuyến OSPF bằng lệnh debug ip ospf events,
debug ip ospf packet.
R1#debug ip ospf events
OSPF:hello with invalid timers on interface Ethernet0
hello interval received 10 configured 10
net mask received 255.255.255.0 configured
255.255.255.0
dead interval received 40 configured 30
R1# debug ip ospf packet
OSPF: rcv. v:2 t:1 l:48 rid:200.0.0.117
aid:0.0.0.0 chk:6AB2 aut:0 auk:
R1#debug ip ospf packet
OSPF: rcv. v:2 t:1 l:48 rid:200.0.0.116
aid:0.0.0.0 chk:0 aut:2 keyid:1 seq:0x0
–Tắt chế độ debug bằng lệnh undebug all.
R1# undebug all
All possible debugging has been turned off
–Xem bảng định tuyến trên R1 bằng lệnh show ip route.
R1# show ip route
...
Gateway of last resort is not set
131.108.0.0/16 is variably subnetted, 9 subnets, 3
masks
C 131.108.4.3/32 is directly connected, Loopback2
C 131.108.4.2/32 is directly connected, Loopback1
C 131.108.4.1/32 is directly connected, Loopback0
C 131.108.3.0/30 is directly connected, Serial0
O IA 131.108.4.6/32 [110/65] via 131.108.3.2, 00:01:29,
Serial0
O IA 131.108.2.0/24 [110/74] via 131.108.3.2, 00:01:29,
Serial0
O IA 131.108.4.5/32 [110/65] via 131.108.3.2, 00:01:29,
Serial0
C 131.108.1.0/24 is directly connected, Ethernet0
O IA 131.108.4.4/32 [110/65] via 131.108.3.2, 00:01:29,
Serial0
R1#
Từ R1, bạn có thể thấy có 4 route OSPF học từ next-hop 131.108.3.2 và đi qua cổng S0.
Chú ý số AD trong trường hợp OSPF là 110 (RIP là 120 và IGRP là 100). Ký tự O chỉ ra
đây là route loại OSPF, IA chỉ rằng mạng ở xa thuộc area khác.
–Dùng lệnh show ip route ospf trên router R2 để xem các route OSPF
R2# show ip route ospf
131.108.0.0/16 is variably subnetted, 9 subnets, 3
masks
O IA 131.108.4.3/32 [110/782] via 131.108.3.2,
00:13:09, Serial0
O IA 131.108.1.0/24 [110/791] via 131.108.3.2,
00:12:54, Serial0
O IA 131.108.4.2/32 [110/782] via 131.108.3.2,
00:13:09, Serial0
O IA 131.108.4.1/32 [110/782] via 131.108.3.2,
00:13:09, Serial0
R2#

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close