CCNA là viết tắt của Cisco Certified Network Associate, đây là chứng chỉ quốc tế do Cisco Systems hãng sản xuất thiết bị mạng hàng đầu thế giới, trụ sở tại Mỹ cấp, chiếm > 54% thị phần công nghệ thiết bị hạ tầng mạng Internet trên thế giới. Chứng chỉ CCNA được công nhận trên toàn thế giới. Các kỹ sư, chuyên viên mạng qua kỳ thi chứng chỉ CCNA (CCNA 200301) có chứng chỉ CCNA sẽ được chứng nhận là có nền tảng kiến thức mạng (networking) gồm mạng cục bộ (LAN), mạng diện rộng (WAN) và Internet. Mục tiêu của chứng chỉ CCNA đem đến cho người học những kiến thức về mạng, thiết bị mạng, có khả năng lắp đặt bộ chuyển mạch (Switch), bộ định tuyến (Router), wifi, bảo mật mạng trong môi trường mạng với cấu trúc LAN, WAN của Cisco và các sản phẩm mạng khác.
Trang 1
MỤC LỤC
CHUONG |: STAND ALONE LABS
LAB1: KET NOI VA DANG NHAP VAO CISCO ROUTER
LAB 2: Introduction to the Basic User Interface
Lab 3: Introduction to Basic Show Commands
LAB 4: CDP
LAB 5: CAC LENH CO BAN MG RONG
LAB 6: THIET LAP BANNER MOTD
LAB 7: LENH COPY
LAB 8: GIGI THIEU VE CAU HINH INTERFACE
LAB 9: GIGI THIEU VE IP (INTERNET PROTOCOL)
Lab 12: Static Routes
Lab 13: RIP
Lab 14: Troubleshooting RIP
Lab 28: Standard Access List
Lab 29: Verify Standard Access Lab 30: Extended Access List
Lab 31: Verify Extended Access Lists
Lab 32: Named Access Control Lists Lab 33: Advanced Extended Access Lists
LAB 35: GIGI THIEU VE VLAN
LAB 36: VLAN TRUNKING PROTOCOL (VTP)
CHUONG 2: SEQUENTIAL LABS
Lab 1: Cau hinh Router co ban
Trang 2
CHƯƠNG 3: SCENARIO LABS
LAB 4: STATIC ROUTES
LAB 5: DEFAULT ROUTES
LAB 6: RIP ROUTES
Lab 22 -2950 Vlan
Lab 23 — 2950 Deleting VLAN
Lab 24 - 2950 VTP
Lab 25 ~ 2950VTP w-client
Lab: KHÔI PHỤC MẬT KHAU CHO ROUTER CISCO
LAB BONUS: THIẾT KÉ HỆ THÓNG MẠNG TÒA NHÀ
Trang 3
CHƯƠNG 1: STAND ALONE LABS
LAB1: KẾT NOI VA DANG NHAP VAO CISCO ROUTER
A Giới thiệu về Cisco Router
B Chuan bi cho bai lab:
C Các bước thực hiện:
1 Từ giao diện của Packet Tracer bạn kéo vào Router 281 1
2 Double-click vao Router 2811 va chuyén sang tab CLI dé cau hinh bang dong lệnh Bây giờ ban dang 6 user mode Dau nhắc được chia ra thành hai phần:
phần tên (hostname) của Router và phần mode “Router” là tên của Router, còn
dau “>” nghia la ban dang 6 user mode
Press RETURN to get started!
Router>enable
3 Tiếp theo bạn sẽ dùng lệnh enable đẻ vào privileged mode
Press RETURN to get started!
Router>enable Routert
4 Để quay lại user mode, bạn sẽ dùng lệnh disable Từ user mode bạn dùng lệnh logout hoặc exit để ra khỏi router
Routertdisable Router>exit
Router con0 is now available
Press RETURN to get started
Trang 4
LAB 2: Introduction to the Basic User Interface
Giới thiệu các lệnh cơ bản
A Mục tiêu của bài lab:
Giới thiệu về giao diện dòng lệnh (CLD); 2 chế độ là user mode và privileged mode; co
2 Bay gid ban dang 6 user mode Ban sé ding lệnh ? để xem tất cả các câu lệnh
có thể sử dụng tại mode này
Router>?
Exec commands:
<1-99> Session number to resume connect Open @ terminal connection disable Turn off privileged commands
disconnect Disconnect an existing network connection enable Turn on privileged commands
exit Exit from the EXEC logout Exit from the EXEC ping Send echo messages resume Resume an active network connection
show Show running system information ssh Open a secure shell client connection
telnet Open 2 telnet connection terminal Set terminal line parameters
traceroute Trace route to destination
3 Ding lénh enable dé vio privileged mode
Router>enable Roucert
Trang 5
cloek Manage the system clock configure Enter configuration mode connect Open a terminal connection copy Copy from one file to another debug Debugging functions (see also ‘undebug') delete Delete a file
diz List files on a filesystem disable Turn off privileged commands disconnect Disconnect an existing network connection enable Turn on privileged commands
erase Erase a filesystem exit Exit from the EXEC legout Exit from the EXEC mkdir Create new directory more Display the contents of a file
Disable debugging informations Send echo messages
Halt and perform a cold restart
5 Dùng lệnh show ? để xem tất cả các câu lệnh show
Routertshow ?
access-lists List access lists
class-map Show QoS Class Map cleck Display the system clock controllers Interface controllers status crypte Encryption module
debugging State of each debugging option dhep Dynamic Host Configuration Protocol status dov11 IEEE 802.11 show information
ephone Show all or one ephone status file Show filesystem information flash: display information about flash: file system frame-relay Freme-Relay information
history Display the session command history hosts IP domain-name, lookup style, nameservé and host table interfaces Interface status and configuration
legging Show the contents of logging buffers legin Display Secure Login Configurations and State More
Trang 6
6 Dùng lệnh show running-config đê xem câu hình hiện tai (running-config)
Routertshow running-config Building configuration
Current configuration : 450 bytes '
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption hostname Router
~-More
7 Để xem thêm thông tin từ câu lệnh show, ban ding phim Space Bar
8 Dùng lệnh exit hoặc disable để ra khỏi router
Router#exit
Trang 7
Lab 3: Introduction to Basic Show Commands
Giới thiệu các lệnh show cơ bản
A Mục tiêu của bai lab Lầm quen với các câu lệnh show cơ bản
B Chuẩn bị cho bài lab:
Routerf#show xunning-config Building configuration
Current configuration : 450 bytes version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
! hostname Router
!
!
~-More
4 Bộ nhớ Flash là một loại bộ nhớ đặc biệt trên router dùng để chứa file ảnh của
hệ điều hành (operating system image file) Không như các bộ nhớ thông thường của router, bộ nhớ Flash vẫn duy trì file ảnh thậm chí sau khi router bị
mat nguồn
Trang 8
Bộ nhớ Flash là một loại bộ nhớ đặc biệt trên router ding để chứa file ảnh của
hệ điều hành (operating system image file) Không như các bộ nhớ thông thường của router, bộ nhớ Flash vẫn duy trì file ảnh thậm chí sau khi router bị
mat nguồn
5 Giao diện dòng lệnh của router mặc định lưu giữ trong bộ nhớ 10 câu lệnh mà bạn đã gõ vào Dùng show history đê xem các lệnh này
Routertshow history enable
show running-config show flash:
show flash show history
6 Hai câu lệnh giúp bạn gọi lại lệnh mà bạn đã gõ trước đó là phím mũi tên lên
(up arrow) hoac Ctrl+P
7 Hai câu lệnh giúp bạn gọi lệnh tiếp theo trong history buffer là phím mũi tên xuống (down arrow) hoặc Ctrl+N
8 Dùng lệnh show profocols để xem trạng thái hiện tại của các giao thức định tuyên Layer 3 dang chay trén router
Routertshow protocols Global values:
Internet Protocol routing is enabled FastEthernet0/0 is administratively down, line protocol is down FastEthernet0/1 is administratively down, line protocol is down Vianl is administratively dow, line protocol is down
9 Ding lénh show version dé xem các thông tin quan trọng của router như:
platform, hệ điều hành, thời điểm boot lần cuối, dung lượng bộ nhớ, số lượng
interface va thanh ghi cấu hình
Routertshow version Ciseo IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T
1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc
Compiled Wed 18-Jul-07 06:21 by pt_rel_team ROM: System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1) Copyright (c) 2000 by cisco Systems, Inc
System returned to ROM by power-on System image file is "c28900nm-advipservicesk9-mz.124-15.T1.bin"
cisco 2811 (MPC860) processor (revision 0x200) with 60416K/S120K bytes of memory Processor board ID JADOS190MTZ (4292891495)
MB60 processor: part number 0, mask 49
2 FastEthernet/IEEE 802.3 interface(s) 239K bytes of NVRAM
62720K bytes of processor board System flash (Read/Write) Configuration register is 0x2102
Trang 9
10 Dùng lệnh show clock dé xem đồng hồ của router RouterEshow clock
*0:26:37.128 UTC Mon Mar 1 1993
11 Dùng lệnh show hosts để xem danh sách các host và tất cả địa chỉ ip các công của host
Routertshow hosts Default Domain is not set Name/address lookup uses domain service Name servers are 255.255.255.255
Code: UN - unknown, EX - expired, OK - OK, ?? - revalidate
temp - temporary, perm - permanent
NA - Not Applicable None - Not defined
12 Dùng lệnh show users dé xem tat ca cdc user két ndi vao router Routertshow users
13 Dùng lệnh show interfaces để xem thông tin chỉ tiết của mdi interface Reurer#show interfaces
FastEthernet0/0 is administratively down, line protocol is down (disabled) Hardware is Lance, address is 00e0.b055.4d01 (bia 00e0.b05S.4d01)
MIU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/258, rxload 1/285 Encapsulation ARPA, loopback not set
ARP type: ARPA, ARP Timeout 04:00:00, Last input 00:00:08, output 00:00:05, output hang never Last clearing of “show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0 Queueing strategy: fifo
Output queue -0/40 (size/max)
§ minute input rate 0 bits/sec, 0 packets/sec
S minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 input packets with dribble condition detected
0 packets output, 0 bytes, 0 underruns
lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
~-More
14 Dùng lệnh show protocols để xem trạng thái chung và trạng thái cụ thể của bất
cứ giao thức nào của Layer 3
Routertshow protocols Global values:
Internet Protecol routing is enabled FastEthernet0/0 is administratively down, line protocol is down FastEthernet0/1 is administratively down, line protocol is down Vieni is administratively down, line protocol is down
Trang 10
Enter configuration commands, one per line End with CNTL/Z
Router (config) ¢
2 Trén Router 2620XM, đổi tên router thành R2620
Router (config) #hostname R2620
2620 (con£fig) #
4 Trén Router 2811, đổi tên router thành R2811 Router>enable
Routerfconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) #hostname R2811 R2811 (config) ¢
Chú ý: Mặc định tất cả các inferface là shutdown (disabled)
4, Enable Serial 1/0 trên R2620 R2620(config)#int s1/0
R2620(config-if)#no shutdown
5 Enable Serial 1/0 trén R2811 R2811 (config) #int 31/0
R211 (config-if)#no shutdown
6 Enable FastEthernet 0/0 trén R2620 R2620(config)#int £0/0
R2620(config-if)#no shutdown
CDP cho phép các thiết bị chia sẻ thông tin cấu hình cơ bản CDP sẽ hoạt động
mà không cần phải cầu hình bất kỳ giao thức nào CDP mặc định được enable trén tat
cả các interface CDP là giao thức data link diễn ra tại Layer 2 của mô hình OSI Điều
này quan trọng vì giúp cho ta hiểu CDP không thê định tuyến được Nó chỉ có thê đi
đến các thiết bị kết nói trực tiếp
Trang 11
7 Trén R2620, ding Iénh show cdp interface dé xem trang thai tat ca cdc interface dang chay CDP
R2620¢show cdp interface FastEthernet0/0 is up, line protocol is down Sending CDP packets every 60 seconds
Holdtime is 180 seconds Seriall/O is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds
"Theo hình trên ta thấy Serial 1/0 đang ở trang thái up-up và đang gửi các gói CDP
Bây giờ router đã có interface quảng bá và nhận CDP updates nên ta có thé ding CDP
đê tim théng tin vé cdc hang x6m (neighbors) két nôi trực tiêp
R2620¢show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
Thiết bị đầu tiên được tìm thấy trong danh sách của R2620 là R2811 thông qua
đường Serial 1/0 R2620 dang nhan updates tir R2811, g6i tin update cho R2620 biết
để giữ các thông tin trong một khoảng thời gian xác định Vào thời điểm lệnh này được gõ thì thời gian hold time còn lại của R2620 là 177 giây Nêu khoảng thời gian
này kết thúc trước khi nhận được gói update mới thì thông tin về R2811 sẽ được xóa
khoi bang R2811 14 router series 2800, được hién thị ở cột Platform Cột cuối cùng, Port ID, là port trên router 2811 mà nó dùng để gửi gói update
8 Trên R2620, dùng lénh show cdp neighbors detail dé xem théng tỉn chỉ tiết về
hang xóm kết nói trực tiếp đến nó
R2620¢show cdp neighbors detail Device ID: R2811
Entry address(es):
Platform: cisco C2800, Capabilities: Router Interface: Serial1/0, Port ID (outgoing port): Seriali/0 Holdtime: 167
Version : Cisco I0S Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T
1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc
Compiled Wed 18-Jul-07 06:21 by pt_rel_team
advertisement version: 2 Duplex: full
Trang 12
Lệnh này dùng để hiển thị thông tin địa chỉ tầng Network Hiện tại thì chưa có
địa chỉ IP, IPX hay AppleTalk nào được cấu hình cho nên field này vẫn còn trồng
Lệnh này cũng hiễn thị thông tin IOS version Chú ý rằng các thiết bị được liệt kê
theo thứ tự Nếu muốn xem thông tin của các thiết bị khác trong danh sách, bạn chỉ cần nhắn phim Space bar
9 Trên R2620, gõ lệnh show cdp entry R2811 dé xem riéng thông tin về R2811
R2620¢show cdp entry R2811
Device ID: R2811 Entry address(es):
Platform: cisco C2800, Capabilities: Router Interface: Seriali/0, Port ID (outgoing port): Seriall/0 Holdtime: 154
Version : Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T
1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc
Compiled Wed 18-Jul-07 06:21 by pt_rel_team advertisement version: 2
Duplex: full
Lệnh này cho ta biết các thông tin giống như lệnh show cdp neighbors detail,
nhưng nó chỉ hiển thị thông tin của một thiết bị cụ thể là R2811 Chú ý rằng đây là
câu lệnh phân biệt chữ hoa - chữ thường
10 Trên R2620, gõ lệnh show cdp đề xem sau bao lâu thì các gói CDP updates được
gửi đi và bên nhận sẽ giữ gói update trong bao lâu
R2620$show cdp Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled
11 Trên R2620, gõ lệnh cdp timer 45 đẻ điều chỉnh thời gian giữa các gói CDP updates thành 45 giây (cứ sau 45 giây sẽ gửi CDP updates).Ngoài thời gian gửi
update, ta cũng có thể điều chỉnh giá trị holdime Giá trị này cho bên nhận biết sẽ
giữ thông tin về CDP update này trong bao lâu
12 Trên R2620, gõ lệnh cdp holdtime 60 đẻ điều chỉnh thời gian holdtime thành 60
giây
13 Trên R2620, gõ lệnh show cđp để đảm bảo rằng các giá trị cdp timer và cdp
holdtime đã được thay đồi
Trang 13
Nếu không có thiết bị Cisco nào kết nói trực tiếp trong mạng, hoặc đơn giản chỉ dé
tiết kiệm băng thông thì CDP có thể được disabled
14 Trên R2620, gõ lệnh no cdp run dé disable CDP trên toàn router
R2620#conf + Enter configuration commands, one per line End with CNTL/Z
R2620 (config) #no edp run
15 Trên R2620, gõ lệnh cdp run dé enable CDP trén toan router
R2620£conf t Enter configuration commands, one per line End with CNTL/Z
R2620 (config) edp run
16 Trên R2620, gõ lệnh no cdp enable trên cổng FastEthernet 0/0 đẻ disable CDP chỉ
riêng trên cổng này
2620 (config)#int £0/0 R2620(config-if)#no cdp enable
17 Trên R2620, gõ lệnh show cdp interface đề xác nhận rằng công FastEthernet 0/0 không còn gửi các gói CDP updates nữa (vì trong thông tin hiển thị không có entry
nào của FastEthernet 0/0)
R2620¢show cdp interface Seriall/O is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds
Trang 14
2 Xem tat cả các lệnh có thê dùng trong user mode bằng lệnh ?
3 Vào privileged mode bằng lệnh enable Tại mode này bạn sẽ điều khiển hoàn toàn
router
Router>enable Router#
4, Xem cdc lénh cé thé ding tai privileged mode bang lénh ?
5 Để có thể cấu hinh cho router, ban g6 Iénh configure terminal dé vio mode config
Routertconfigure terminal Enter configuration commands, one per line End with CNIL/Z Router (config) ¢
6 Dùng lệnh hostname để đồi tên cho router (nếu như trong mạng có nhiều router thì lệnh này giúp bạn nhận biết các router)
Router (config) fhostname Krang rang (config) ¢
7 Lénh enable password diéu khién viéc truy cập vao privileged mode Day la password rat quan trong vi 6 privileged mode bạn có thê thay đổi các cấu hình của router Ban sé dat password 1a boson
Krang (config) tenable password boson
8 Bây giờ hãy thir password Ban thot khoi router và sau đó vao privileged mode
Bạn sẽ thấy router hiện ra dấu nhắc yêu cau nhap password
Krang>enable Password:
9, Vấn đề duy nhất đối với enable password là nó hiên thị password dui dang plain text (không mã hóa) trong file cấu hình của router Nếu bạn vô tình để cho ai đó nhìn thấy password này thì sẽ gây nguy hiểm cho hệ thống mạng của bạn Để vừa
Trang 15
thiết lập password vừa mã héa password, ban sé ding Iénh enable secret Ở đây ban dat password 1a cisco
Krang(config)#enable secret cisco
10 Bay giờ bạn có thể thử password bằng cách thoát khỏi router và sau đó gõ lệnh enable Password mà bạn vừa thiết lập bằng câu lệnh enable secret cisco sẽ ghi đè lên password cũ là boson Nghĩa là nêu bạn thiết lập cả hai password thì enable secret sé 1a password ban ding dé vao privileged mode Password enable
password vẫn tồn tại nhưng nó đã bị vô hiệu hóa
Trang 16
2 Vao configuration mode
Routerfconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) ¢
3 Tai configuration mode, ban gé lénh banner motd, theo sau là ký tự phân cách
Router sẽ dùng ký tự này để biết khi nào thì ta kết thúc việc thiết lập banner Cách
dễ nhất là dùng ký tự z
Router (config) #banner motd z Enter TEXT message End with the character ‘2’
4, Bay gid ban go vao banner, va muén kết thúc banner thì gõ z Ví dụ bạn gõ You
do not have permission to be here This router eats hackers for lunch! z va nhấn enter thì câu You do not have permission to be here This router eats hackers for lunch! sé duge ding 1am banner
Router (config) #banner motd z Enter TEXT message End with the character ‘z'
You do not have permission to be here This router eats hackers for lunch! z Router (config) ¢
5 Để xem banner thì bạn hãy thoát khỏi configuration mode và sau đó thoát khỏi
router, sau đó nhấn return thì bạn sẽ thấy banner
You do not have permission to be here This router eats hackers for lunch!
Router>
Trang 17
1 Vào dấu nhắc Router
2 Vao privileged mode
3 Hiên thị cấu hình đang sử dụng (active) trong bộ nhớ bằng lệnh show running-config Cấu hình hiện tại đang chạy trên router được gọi là running-config trên giao diện dòng lệnh của router Chú ý rằng cần phải vào privileged mode mới xem được nội dung của running-config, và running-config không được tự động lưu trên router — nó sẽ bị mắt khi router
bj mat nguồn Running-config cần phải được lưu thủ công bằng lệnh copy Routertsh running-config
Building configuration
Current configuration : 450 bytes version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption hostname Router
4 Hiển thị cấu hình được lưu trong NVRAM bằng lệnh show startup-config
Cấu hình này được gọi là startup-config Cho đến lúc này chúng ta vẫn chưa lưu cấu hình nên khi dùng lệnh show startup-config ta sẽ không thay
gì
Routerfsh startup-config startup-config is not present
5 Ta sé copy cấu hình hiện tại vào trong NVRAM bằng lệnh copy running- config startup-config Cấu hình hiện tại của ta được lưu trong RAM và ta cần phải lưu nó lại để phòng khi router bị mất nguồn thì ta vẫn còn giữ lại
được cấu hình trước đó
Trang 18
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption '
hostname Router
7 Néu ta muén bắt đầu cấu hình router ngay từ đầu, thì ta sẽ dùng lệnh erase startup-config va reload lai router Lệnh này sẽ giúp ta xóa hoàn toàn cấu hình trong router và cấu hình lại router từ đầu
Routerterase startup-config Erasing the nvram filesystem will remove all configuration files! Continue? [con firm]
[0K]
Erase of nvram: complete SSYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
8 Sau khi đã xóa cấu hình thì ta sẽ reload lại router Router sẽ hỏi ta có muốn
lưu lại cấu hình trước khi reload không, và ta chọn no
Routertreload Proceed with reload? [confirm]
$SYS-S-RELOAD: Reload requested by console Reload Reason: Reload Command
System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1) Copyright (c) 2000 by cisco Systems, Inc
cisco 2811 (MPC860) processor (revision 04200) with 60416K/5120K bytes of memory
Self decompressing the image - YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE (OK!
Restricted Rights Legend
9 Sau khi router reload xong, ta xem lai startup-config, va sé thay không còn
gì ở trong đó
Routergsh startup-config startup-config is not present
Trang 19
10 Bây giờ ta sẽ đổi tên của router thành Boson
Routergconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) #ho Router (config) #hostname Boson
11.Sau khi đồi tên của router, chting ta sé reload lai router, và khi router hoi ta
có muôn lưu lại câu hình không thì ta sẽ chọn lưu
Trang 20Ta sẽ str dung hai router 2811
1 Trén Router dau tién, vao global configuration mode và cấu hình tên của Router là
RL
Router>
Router>en Router>enable Routerfconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) thos Router (config) fhostname 21
description Interface specific description duplex Configure duplex operation
exit Exit from interface configuration mode fair-queue Enable Fair Queuing on an Interface hold-queue Set hold queue depth
ip Interface Internet Protocol config commands ipv€ IPvé interface subcommands
mac-address Manually set interface MAC address
4 Trong số các lệnh hiện ra, ta sẽ thấy có lệnh shutdown
5 Chúng ta có thể gõ lệnh ngược với một lệnh, bằng cách dùng no phía trước lệnh
đó Do đó muốn kích hoạt một cổng thì ta sẽ gõ lệnh no shutdown
Ri (config-if)#no shutdown SLINK-S-CHANGED: Interface FastEthernet0/0, changed state to up
6 Bây giờ thêm một mô tả vào cho công này băng lệnh description R1 (config-i£) ‡description FastEthernet interface on Ri
Trang 21
7 Để xem mô tả mà ta đã thêm vảo công, ta về lại privileged mode và dùng lệnh show interfaces
Rigsh interfaces FastEthernet0/0 is up, line protocol is down (disabled) Hardware is Lance, address is 0001.c7Sd.8d01 (bia 0001.c75d.8d01) Description: FastEthernet interface on Ri
8 Bay gid vao Router thtr hai va vao céng f0/0 Router>
Router>en Router>enable Routergconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) thos Router (config) thostname R2 R2 (config)#int £0/0
9 Bây giờ hãy kích hoạt công f0/0
RZ (config-if)#no shutdown SLINK-S-CHANGED: Interface Fastthernet0/0, changed state to up
SLINEPROTO-S-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state t
o up
10 Bây giờ cả hai công FastEthernet 0/0 trên hai Router đều đã được kích hoạt Ban
có thể dùng lệnh show cdp neighbors để xem thông tin của tất cả các Router kết nối trực tiếp với nhau
B1#sh cáp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID
Trang 22
LAB 9: GIỚI THIEU VE IP INTERNET PROTOCOL)
A Muc dich:
Chúng ta sẽ cầu hình Router 1, 2 va 4 voi cdc dia chi IP va ping gitta chung dé
kiểm tra kết nói
Router (config) thos
Router (config) fhostname 21
SLINK-S-CHANGED: Interface Fastithernet0/0, changed state to up
5 Bay gid ta dat dia chi IP cho cong s1/0 trén RI 18 172.16.10.1 255.255.255.0
Ri (config-if)#int 51/0
Ri (config-if)#ip add 172.16.10.1 255.255.255.0 R1(config-if)#no sh
*LINE-S-CHANGED: Interface Seriall/0, changed state to down
Rl (config-if) ¢clock
Ri (config-if)#clock rate 64000
Trang 23
Router (config) fhost Router (config) #hostname 82 R2 (config) &
8 Dit địa chỉ IP cho công f0/0 của R2 là 10.1.1.2 255.255.255.0 R2(config-if)#ip add 10.1.1.2 255.255.255.0
9 Kích hoạt cổng
RZ(config-if)#no shutdown
10 Bay gid click chon Router thir ba trén man hinh
11 Dat tén Router nay là R4 và gán địa chỉ IP là 172.16.10.2 255.255.255.0 trên công s1/0
Router>
Router>en Router>enable Routertconf t Enter configuration commands, one per line End with CNTL/Z
Router (config) tho Router (config) hostname 24 R4 (config) #int 31/0
R4 (config-if)#ip add 172.16.10.2 255.255.255.0
12 Đảm bảo rằng bạn đã kích hoạt cổng
R4 (config-if) $no shutdown
‘SLINK-S-CHANGED: Interface Seriall/0, changed state to up
13 Vao lai R1
14 Thử ping đến công f0/0 của R2
Rigping 10.1.1.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
Trang 24
15 Thử ping đến công s1/0 của R4
Riiping 172.16.10.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.10.2, timeout is 2 seconds:
nin
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/6 ms
16 Ding Iénh show ip interface brief dé xem dia chi IP va trang thai của các công
Ri¢show ip interface brief
FastEthernet0/1 unassigned YES unset administratively down down
17 Xem running-config và xác nhận rằng địa chỉ IP mà ta đã cấu hình có trong running-config
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0 duplex auto
speed auto interface Fastithernet0/1
no ip address duplex auto speed auto shutdown interface Seria11/0
ip address 172.16.10.1 255.255.255.0 clock rate 64000
18 Dùng lệnh show ip interface đê xem thông tin chỉ tiết về IP của mỗi công
Ritsh ip interface FastEthernet0/0 is up, line protocol is up (connected) Internet address is 10.1.1.1/24
Broadcast address is 255.255.255.255 Address determined by setup command MTU is 1500
Trang 25
SLINK-S-CHANGED: Interface Seriel0/0/0, changed state to down xouter4 (config-if)#clock rate 64000
Trang 26
- Router 2:
Router (config) #hostname router?
router2(config)#int £0/0 router? (config-if)#ip add 10.1.1.2 255.255.255.0 router? (config-if)#no sh
SLINK-S-CHANGED: Interface FastEthernet0/0, changed state to up SLINEPROTO-S-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state t
° up
router2 (config-it)4|
2 Sau khi cầu hình địa chỉ IP chúng ta ping kiểm tra trên các router láng giềng
Nghĩa là từ router1 chúng ta có thể ping tới router 2 và router 4
routerlgping 10.1.1.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/6 ms routerl¢ping 12.5.10.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 12.5.10.2, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms
3 Sau khi cầu hình địa chỉ IP Chúng ta bắt đầu cấu hình static route Đầu tiên là kết
nối đến router1 Chúng ta cần cấu hình static route cho các router không có kết nối trực tiếp với nhau Router1 kết nối trực tiếp tới các router2 và 4 nên chúng ta
không cần cấu hình static route
4, Cấu hình static route cho router4
router4(config)#ip route 10 router4 (config) ¢|
5 Kiém tra ping thir tir router 4 t6i cdc serial va fasternet0 ciia router] va fasternet0 của router2
Trang 27
xzouter4§ping 12.5.10.1 Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 12.5.10.1, timeout is 2 seconds:
ree Success rate is 100 percent (5/5), round-trip min/avg/max
3/5/7 ms router4gping 10.1.1.1
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
reine Success rate is 100 percent (5/5), round-trip min/avo/max = 3/4/6 ms router4#ping 10.1.1.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
Success rate is 0 percent (0/5)
6 Tai sao chting ta khéng thé ping thành công tới địa chỉ router2(10.1.1.2)
Khi chúng ta ping tới 10.1.1.2 router sẽ nhìn trong bảng routing table va biét đường đi tới mạng 10.1.1.0 và gửi gói tin đi Router2 nhận được gói tin và muốn trả lời Router2 nhìn vào Source IP thấy 12.5 10.2( công serial router4) Nhưng khi
nó gửi đi thì gói tin sẽ bị hủy vì nó không biết đường đi tới mạng 12.5.10.2 Vì vậy mà chúng ta không nhận được !
7 Hién thi théng tin static route
router4#show ip route Codes: C - connected, S$ - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, © - OSPF, IA - OSPF inter area
Ni - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, £2 - OSPF external type 2, = - EGP
i - IS-IS, Li - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter are:
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route Gateway of last resort is not set
8 Cau hinh static route trên router2
router? (config) #ip route 1:
Trang 28
9, Kiểm tra lại kết nối ping từ router4 tới router 2
zouter4£ping 10.1.1.2 Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/7/9 ms
router4s|
10 Nhin vao bang routing table trén router2
routerzgsnow 1p 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
Ni - 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, Li - 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
Trang 29Router4 Raikes 2811 Router2 eee
2 Sau khi cấu hình IP address trên mỗi công Bạn kiêm tra chắc chắn là đã ping thành công trên mỗi router láng giềng
routerl¢ping 172.16.10.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.10.2, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max 2/3/7 ms routerl¢ping 10.1.1.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
ĐI Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms
Trang 30
3 Đầu tiên cau hinh RIP trén Router!
routerl (config) frouter rip routerl (config-router) §network 10.0.0.0 router (config-router) tnetwork 172.16.0.0 router (config-router) ¢
4 Router2
router? (config)#router rip router? (config-router) ¢network 10.0.0.0 router? (config-router) ¢|
6 Giao thức RIP đã hoạt động trên 3 router Kiểm tra kết nói bằng cách ping từ Router2
đến Router4 và ngược lại xzouter2£ping 172.16.10.2 Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.10.2, timeout is 2 seconds:
rite Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/10 ms xouter4£ping 10.1.1.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
reins Success rate is 100 percent (5/5), round-trip min/avg/max = 7/11/15 ms
7 Nếu ping tới các router thành công, thì bạn đã Routin thành công Nếu kết nối không
thành công Bạn kiểm tra lại theo từng bước đã hướng dẫn ở trên
8 Nhin thong tin vé IP routing
Trang 31
Default version control: send version 1, receive any version Interface Send Recv Triggered RIP Key-chain FastEthernet0/1 1 22
Routing Information Sources:
Gateway Distance Last Update Distance: (default is 120)
Trang 32
Lab 14: Troubleshooting RIP
A Mục đích: Chúng ta cài đặt IP address trên Router1,2 4 và sử dụng phương thức RIP Chúng sẽ quan sát hoạt động của Router thông qua quá trình debug ip rip
B Các bước thực hiện
1 Thiết lập cầu hình như bảng dưới:
2 Cấu hình RIProuting protocol
routerl(config-if)#do show ip int brief
FastEthernet0/0 unassigned YES unset administratively down down
Vian1 unassigned YES unset administratively down down
xouter2(config-if)#do show ip int br:
FastEthernet0/1 unassigned YES unset administratively down down Vian1 unassigned YES unset administratively down down
router4(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down Fastithernet0/1 unassigned YES unset administratively down down Seria10/0/0 192.168.2.2 YES manual up up Viani unassigned YES unset administratively down down
Trang 33
3 Kiểm tra việc nhận thông tin định tuyến trên tất cả router
router4(config-router)#do 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
Ni - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
El - OSPF external type 1, £2 - OSPF external type 2, E - EGP
i - IS-IS, Ll - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route Gateway of last resort is not set
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
Ni - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, £2 - OSPF external type 2, = - EGP
i - IS-IS, Li - 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
© 192.168.1.0/24 is directly connected, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:01, FastEthernet0/0
xouterl(config-router)#do 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
Ni - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, £2 - OSPF external type 2, = - EGP
i - IS-IS, Li - 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
C 192.168.1.0/24 is đirectly connected, FastEthernet0/1
C = 192.168.2.0/24 is directly connected, Serial0/0/0
4, Kiém tra việc nhận thông tin định tuyến thông qua lệnh debug ip rip tir mode privilege trên Routerl
Trang 34
routerl¢debug ip rip RIP protocol debugging is on xouterl¢RIP: sending vi update to 255.255.255.255 via FastEthernet0/1 (192.168
asa) RIP: build update entries
network 192.168.2.0 metric 1 RIP: sending vi update to 255.255.255.255 via Serial0/0/0 (192.168.2.1) RIP: build update entries
network 192.168.1.0 metric 1
5 Quan sát RIP: build update entries sẽ được gửi 60s 1 lần
6 Tắt debug bằng cách gõ “no debug ip rip” hoặc “undebug all” hoặc “u all"
RIP: build updete entries
network 192.168.2.0 metric 1 RIP: sending vi update to 255.255.255.255 via £ RIP: build update entries
network 192.168.1.0 metric 1
u all All possible debugging has been turned off
7 Xem bang routing trén Router2 va Router4 Chu y toi AD va metrics
router4#show ip route Codes: C - connected, § - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
Ni - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
El - OSPF external type 1, £2 - OSPF external type 2, E - EGP
i - IS-IS, Li - 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
Trang 35
router2#show ip route Codes: C - connected, 5 - 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
El - OSPF external type 1, £2 - OSPF external type 2, E - EGP
i - IS-IS, Ll - 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
© 192.168.1.0/24 is directly connected, FastEthernet0/0
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
Trang 36
Lab 28: Standard Access Lists
Access List co ban
A Mục tiêu của bài lab:
Tìm hiểu và thực hành các danh sách kiểm soát truy cập chuẩn (Standard ACL)
B Chuan bi cho bai lab:
Chúng ta sẽ sử dụng Router 1, 2 va 4 véi các công được kết nói và đặt địa chỉ IP theo
mô hình như sau:
SAAT Ze 24.172.1/28 29 4.17.2.17/28 24.17.2.18/28
2811 2811 2811 Router2 Router1 Router4
Routerl (config )#int s0/3/0 Routerl(config-if)# ip address 24.17.2.17 255.255.255.240
Router1(config-if)#no shut
Routerl(confis-iJ)#exit
2 Trên Router2, đặt địa chỉ IP cho công Fa0/0 như sau:
Router2(config)#im ƒ0/0 Router2(config-if)#ip address 24.17.2.2 255.255.255.240
Router2(config-if)#no shut Router2(config-iƒ)#exit
| Physical | Config | CLI
IOS Command Line Interface
Router2#ping 24.17.22
Type escape sequence to abort Ping thanh công Sending 5, 100-byte ICMP Echos to 24.17.2.2, timeout is 2 seconds:
rate is 100 percent (5/5)|, round-trip min/avg/max = 1/2/4 ms
4 Trên Router4, đặt địa chỉ IP cho céng Ser0/3/0 nhu sau:
Trang 37
Routerd(config Hint s0/3/0 Router4(config-if)# ip address 24.17.2.18 255.255.255.240
o rave is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
5 Cau hinh RIP cho Router! va thêm network dành cho các công Fa0/0 và Ser0/3/0
9 Giờ ta sẽ cấu hình ACL trên Router2 để chặn khả năng Router4 ping tới Router2
Vào chê độ Configuration Sau đó, tạo một access-list I chỉ để chặn địa chỉ IP 24.17.2.18 (công Ser0/3/0 của Router4) theo sau đó là lệnh access-list permit any dé cho phép tất cả các địa chỉ IP khác được gửi gói tin tới công Fa0/0 của Router2
Trang 38
công Fa0/0 của Router2) “in” có nghĩa là các gói tin đến từ mạng và sẽ đi vào router
và “out” có nghĩa rằng các gói tin di ra khỏi router và đi vào mạng Router2(config)#int fa0/0
IOS Command Line Interface
Router4>en
Routerstping 24.17.2.2 ping không thành công
Type escape sequence to abort => access Est hoel dong Ei Sending S, 100-byte ICMP Echos to 24.17.2.2, timeout is 2 seconds:
Success rate is 0 percent (0/)
Trang 39
Lab 29: Verify Standard Access Lists
Kiểm tra lại cấu hình Standard ACL
A Mục tiêu của bài lab:
Kiểm tra xem access-list đã được cầu hình đúng hay chưa
B Chuẩn bị cho bài lab:
'Yêu cầu: đã hoàn thành xong lab 28 (Standard Access List) Chúng ta sẽ tiếp tục làm việc với mô hình của lab 28
C Các bước thực hiện:
1 Ở bước đầu tiên này ta sẽ xem xét xem có thể ping tới Router2 từ Router4 không
Kết nói tới Router4 và thử ping tới công Fa0/0 của Router2 (có địa chỉ IPlà
24.17.2.2) Nếu bạn nhận được 5 dấu chấm như hình sau thì access-list mà ta đã tạo ở
Routerdtping 24.17.2.2 ping không thành công _
„ ype escape sequence to abort => access list hoạt động tốt
Sending 5, 100-byte ICMP Echos to 24.17.2.2, timeout is 2 seconds:
Success rate is 0 percent (0/5)
“Truy cập vao Router2 va thẩm tra xem cdc access-list cia ta dang chạy trên các
interface nào, xem nội dung của running-config
duplex auto speed auto
access-group 1 in
“Ta cũng có thể xem các access-list được áp dụng cho các interface nào bằng lệnh
Helper address is not set
Trang 40
4 Lénh show access-lists sẽ cho ta biết các access-list nào mà ta đã tạo trên router Nó
cũng sẽ cho ta biết các entry nào trong access-list đã được sử dụng và số lượng gói tin
mà router cho phép hoặc bị chặn
Router2# [snow sccess-lises]
Standard IP eccess list Geny host 24.17.2.18 (19 match (es) permit any (538 match (es:
Router2®