You are on page 1of 64

Bài tập thực hành Quản trị mạng

I. MỤC TIÊU THỰC HÀNH


Giới thiệu cho sinh viên các kiến thức căn bản về các kỹ thuật được sử dụng trong quá
trình quản trị mạng.
II. HỌC LIỆU
Học liệu :
- Phần mềm (Packet Tracer 5.0 hoặc GNS3)
- Bài tập thực hành của giảng viên cung cấp
Dụng cụ :
- Projector, màn chiếu
- Máy tính
- Bảng, phấn
- Hệ thống máy tính được kết nối mạng
III. NỘI DUNG
Gồm 9 bài thực hành (lab) với các nội dung sau:
Lab 1: 3h
- Giới thiệu về các chương trình giả lập thiết bị mạng Cisco (Packet Tracert, Dynamip
và GNS3).
- Cách cài đặt các chương trình giả lập và sử dụng.
- Cấu hình cơ bản thiết bị chuyển mạch Switch.
Lab 2: 3h
- Cách chia VLAN.
- Gán port vào VLAN.
- Kiểm tra VLAN.
- Cấu hình đường trung kế.
- Thiết lập hệ thống mạng đồng bộ thông tin VLAN.
- Kiểm tra sự đồng bộ.
Lab 3: 3h
- Cấu hình giao thức đồng bộ thông tin VLAN VTP
- Kiểm tra hoạt động của VTP
- Thiết lập các thông số VTP.

Trang 1
Bài tập thực hành Quản trị mạng

Lab 4: 3h
- Cấu hình cơ bản cho thiết bị định tuyến Cisco.
- Thực hiện kiểm tra kết nối giữa các thiết bị định tuyến.
- Cơ bản về định tuyến tĩnh.
- Kiểm tra bảng định tuyến.
Lab 5: 3h
- Định tuyến RIP.
- Kiểm tra bảng định tuyến.
Lab 6: 3h
- Định tuyến OSPF.
- Kiểm tra bảng định tuyến.
Lab 7: 3h
- Cấu hình DHCP trên thiết bị Cisco.
- Cấu hình DHCP trên Microsoft.
Lab 8: 3h
- Cấu hình ACL chuẩn để lọc gói tin theo yêu cầu.
- Kiểm tra việc lọc gói tin.
Lab 9: 3h
- Cấu hình NAT tĩnh.
- Kiểm tra cấu hình.

Trang 2
Bài tập thực hành Quản trị mạng

VI.TÀI LIỆU THAM KHẢO


Tài liệu chính
[1] Tập bài giảng Quản trị mạng,Võ Nhân Văn
Tài liệu tham khảo
Tài liệu tiếng Việt
[2] Nguyễn Thúc Hải, Mạng máy tính và các hệ thống mở, NXB GD, 1997
[3] MK.PUB, Giáo trình hệ máy tính CCNA2, Nhà sách Minh Khai, 2008
[4] Nguyễn Gia Như, Bài giảng mạng máy tính, 2010
[5] Trần Bàn Thạch, Quản trị mạng Window Server 2003, 2009
Tài liệu tiếng Anh
[6] CiscoPress CCNA ICND1 Official Exam Certification Guide
[7] Cisco Press CCNA ICND2 Official Exam Certification Guide
[8] Cisco Academy CCNA Explorer
[9] CCNP BCMSN Student Guide Version 4.0(2007)
[10] CCNP ROUTE 642-902 Official Certification Guide
[11] CCIE Network Design, Cisco Press
[12] Design a Microsoft Windows Server 2003 Active Directory and Nework
Infractructure, Microsoft Press, 2004
[13] Planning, Implementing, and Maintaining a Microsoft Windows Server 2003
Active Directory Infractructure, Microsoft Press, 2004
Website
[14] http://www.networkdictionary.com/networking/NetworkManagement.php
[15] http://sins.com.au/netman/osi_nms_model.html
[16] http://www.vnpro.org/forum
[17] http://www.tiemnangviet.com.vn

Trang 3
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN
BỘ MÔN KỸ THUẬT MẠNG
Bài số : 01
Số giờ : 03giờ

GVHD : Võ Nhân Văn


Chương 2.
LAB 01
CẤU HÌNH CĂN BẢN SWITCH
I. MÔ TẢ
- Cấu hình cơ bản thiết bị chuyển mạch Switch Cisco.
- Thiết lập các thông số cơ bản, bao gồm đặ ật khẩu.
II. NỘI DUNG

10.1.1.251/24
10.1.1.10/24

1. Cấu hình thiết bị: 6


-
stop bit, no flow control.
2. Khởi động switch: sau khi bật switch thì sẽ diễn ra
6

C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX,


RELEASE SOFTWARE (fc4)
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with
21039K bytes of memory.
2960-24TT starting...
Base ethernet MAC Address: 0001.9695.DA3D
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 1 files, 0 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories

Trang 4
Bài tập thực hành Quản trị mạng

flashfs[0]: Total bytes: 64016384


flashfs[0]: Bytes used: 4414921
flashfs[0]: Bytes available: 59601463
flashfs[0]: flashfs fsck took 1 seconds.
...done Initializing Flash.

Boot Sector Filesystem (bs:) installed, fsid: 3


Parameter Block Filesystem (pb:) installed, fsid: 4

Loading "flash:/c2960-lanbase-mz.122-25.FX.bin"...
#############################################################
############# [OK]
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 IOS Software, C2960 Software (C2960-LANBASE-M), Version


12.2(25)FX, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-05 22:05 by pt_team
Image text-base: 0x80008098, data-base: 0x814129C4

Cisco WS-C2960-24TT (RC32300) processor (revision C0) with


21039K bytes of memory.

24 FastEthernet/IEEE 802.3 interface(s)


2 Gigabit Ethernet/IEEE 802.3 interface(s)

63488K bytes of flash-simulated non-volatile configuration


memory.
Base ethernet MAC Address : 0001.9695.DA3D

Trang 5
Bài tập thực hành Quản trị mạng

Motherboard assembly number : 73-9832-06


Power supply part number : 341-0097-02
Motherboard serial number : FOC103248MJ
Power supply serial number : DCA102133JA
Model revision number : B0
Motherboard revision number : C0
Model number : WS-C2960-24TT
System serial number : FOC1033Z1EY
Top Assembly Part Number : 800-26671-02
Top Assembly Revision Number : B0
Version ID : V02
CLEI Code Number : COM3K00BRA
Hardware Board Revision Number : 0x01

Switch Ports Model SW Version SW


Image
------ ----- ----- ---------- --
--------
* 1 26 WS-C2960-24TT 12.2
C2960-LANBASE-M

Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version


12.2(25)FX, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-05 22:05 by pt_team
--- 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]:

Nh no và

Switch>

3. Chế độ privileged:

Switch>enable
Switch#

4. các mật khẩu truy cập cho Switch

Trang 6
Bài tập thực hành Quản trị mạng

Switch#config terminal
Switch(config)#host DuyTan
DuyTan(config)#

Đặt mật khẩu cho cổng Console (hay mật khẩu cho mode User)

DuyTan(config)#line con 0
DuyTan(config-line)#password cisco
DuyTan(config-line)#login

Đặt mật khẩu cho mode Privilege

DuyTan(config)#enable password class

5. witch: mục đích là


trên mạng. Switch là một thiết bị lớp 2 nên việc đặt IP address cho switch chỉ nhằm mục
đích quản trị.

DuyTan#config terminal
DuyTan(config)#interface vlan 1
DuyTan(config-if)#ip address 10.1.1.251 255.255.255.0
DuyTan(config-if)#no shutdown

DuyTan(config)#ip default-gateway 10.1.1.10

6. Telnet vào switch:


Để thực hiện việc telnet từ PC vào thiết bị thì phải đáp ứng được 2 điều kiện:
- PC ping thành công thiết bị: sao cho
bằng cáp thẳng

- Thiết bị phải cấu hình hỗ trợ telnet:

DuyTan(config-line)#line vty 0 15
DuyTan(config-line)#password cisco
DuyTan(config-line)#login

Trang 7
Bài tập thực hành Quản trị mạng

1 bằng cách: vào


Start/Run/Telnet 10.1.1.251.

7. Kiểm tra và lưu cấu hình

Kiểm tra trạng thái cổng của switch

Duytan#show interface
FastEthernet0/1 is down, line protocol is down (disabled)
Hardware is Lance, address is 000a.415c.8301 (bia
000a.415c.8301)
BW 100000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Half-duplex, 100Mb/s
input flow-control is off, output flow-control is off
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/0 (size/max/drops/flushes); Total
output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
956 packets input, 193351 bytes, 0 no buffer
Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0
abort
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
2357 packets output, 263570 bytes, 0 underruns
--More—

Kiểm tra

DuyTan#show version
Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version
12.2(25)FX, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-05 22:05 by pt_team

Trang 8
Bài tập thực hành Quản trị mạng

ROM: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX,


RELEASE SOFTWARE (fc4)

System returned to ROM by power-on

Cisco WS-C2960-24TT (RC32300) processor (revision C0) with


21039K bytes of memory.

24 FastEthernet/IEEE 802.3 interface(s)


2 Gigabit Ethernet/IEEE 802.3 interface(s)

63488K bytes of flash-simulated non-volatile configuration


memory.
Base ethernet MAC Address : 0001.9695.DA3D
Motherboard assembly number : 73-9832-06
Power supply part number : 341-0097-02
Motherboard serial number : FOC103248MJ
Power supply serial number : DCA102133JA
Model revision number : B0
Motherboard revision number : C0
Model number : WS-C2960-24TT
System serial number : FOC1033Z1EY
Configuration register is 0xF
DuyTan#

Lưu cấu hình:

DuyTan#copy running-config startup-config

Trang 9
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN MẠNG LAB số : 02
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03

GVHD :Võ Nhân Văn

LAB 02
VIRTUAL LAN
I.
-

+ VLAN 1: default, gồm Fa0/1 – Fa0/3


+ VLAN 2: Phòng kế toán gồm Fa0/4 – Fa0/7
+ VLAN 3: Phòng bán hàng gồm Fa0/8 – Fa0/15
+ VLAN 4: Phòng kỹ thuật gồm Fa0/16 – Fa0/23

II. NỘI DUNG

10.1.1.251/24
10.1.1.10/24

B.

.
-

Cách 1:
h cho VLAN database:

DuyTan#Config ter

Trang 10
Bài tập thực hành Quản trị mạng

DuyTan(config)# vlan 2
DuyTan(config)#name ketoan
Cách 2:

base:

DuyTan#vlan database

DuyTan(vlan)# vlan 2 name ketoan

edge mode.

DuyTan(vlan)# exit

2.

- -

máy trạm

Gán cổng một cổng fastEthernet0/4 vào VLAN 2


DuyTan(config)#interface fa0/4
DuyTan(config-if)#switchport mode access
DuyTan(config-if)#switchport access Vlan 2

Gán cổng nhiều cổng (fastEthernet0/5 - fastEthernet0/7) vào VLAN 2


DuyTan(config)#interface range fa0/5 - 7
DuyTan(config-if)#switchport mode access
DuyTan(config-if)#switchport access Vlan 2

Tương tự cho Vlan 3 và VLan 4:

DuyTan(config)#interface range fastEthernet 0/8 - 15


DuyTan(config-if-range)#switchport mode access
DuyTan(config-if-range)#switchport access vlan 3
DuyTan(config-if-range)#exit

Trang 11
Bài tập thực hành Quản trị mạng

DuyTan(config)#interface range fastEthernet 0/16 - 23


DuyTan(config-if-range)#switchport mode access
DuyTan(config-if-range)#switchport access vlan 4
DuyTan(config-if-range)#exit

K stEthernet 0/1 - fathEthernet


.

3.
Switch#sh vlan

VLAN Name Status Ports


---- -------------------------------- --------- -------------
------------------
1 default active Fa0/1, Fa0/2,
Fa0/3, Fa0/24
Gig1/1,
Gig1/2
2 ketoan active Fa0/4, Fa0/5,
Fa0/6, Fa0/7
3 banhang active Fa0/8, Fa0/9,
Fa0/10, Fa0/11
Fa0/12,
Fa0/13, Fa0/14, Fa0/15
4 kythuat active Fa0/16,
Fa0/17, Fa0/18, Fa0/19
Fa0/20,
Fa0/21, Fa0/22, Fa0/23
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp


BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -----
--- ------ ------
1 enet 100001 1500 - - - - -
0 0
2 enet 100002 1500 - - - - -
0 0
3 enet 100003 1500 - - - - -
0 0

Trang 12
Bài tập thực hành Quản trị mạng

4 enet 100004 1500 - - - - -


0 0
1002 fddi 101002 1500 - - - - -
0 0

Trang 13
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn

LAB 03
VLAN TRUNKING PROTOCOL
I.

VLAN. - -

trên port F0/24 và cấu hình giao thức VTP để 2 switch đồng bộ thông tin
VLAN với nhau.
II. Nội dung

TRUNK

192.168.1.1
192.168.1.2

1. Đặt tên và địa chỉ IP cho 2 switch

Switch(config)#hostname DuyTan1
DuyTan1(config)#int
DuyTan1(config)#interface vlan 1
DuyTan1(config-if)#ip add

Trang 14
Bài tập thực hành Quản trị mạng

DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0


DuyTan1(config-if)#no shut

Switch(config)#hostname DuyTan2
DuyTan2(config)#int
DuyTan2(config)#interface vlan 1
DuyTan2(config-if)#ip add
DuyTan2(config-if)#ip address 192.168.1.2 255.255.255.0
DuyTan2(config-if)#no shut

2 24

DuyTan1(config)#interface fastEthernet 0/24


DuyTan1(config-if)#switchport mode trunk

DuyTan2(config)#interface fastEthernet 0/24


DuyTan2(config-if)#switchport mode trunk

Kiểm tra kết nối trunk:


DuyTan1#show interfaces trunk
Port Mode Encapsulation Status Native
vlan
Fa0/24 on 802.1q trunking 1

Port Vlans allowed on trunk


Fa0/24 1-1005

Port Vlans allowed and active in management domain


Fa0/24 1

Port Vlans in spanning tree forwarding state and not


pruned
Fa0/24
1

3. Cấu hình 2 switch có cùng VTP domain

DuyTan1(config)#vtp domain DTU


Changing VTP domain name from NULL to DTU

DuyTan2(config)#vtp domain DTU


Changing VTP domain name from NULL to DTU

Trang 15
Bài tập thực hành Quản trị mạng

4. Cấu hình 2 switch cùng có chế độ VTP server

DuyTan1(config)#vtp mode server


DuyTan2(config)#vtp mode server

5. Kiểm tra thông tin VLAN trên Switch DuyTan1 và DuyTan2


DuyTan1#show vlan

VLAN Name Status Ports


---- -------------------------------- --------- -------------
------------------
1 default active Fa0/1, Fa0/2,
Fa0/3, Fa0/4
Fa0/5, Fa0/6,
Fa0/7, Fa0/8
Fa0/9,
Fa0/10, Fa0/11, Fa0/12
Fa0/13,
Fa0/14, Fa0/15, Fa0/16
Fa0/17,
Fa0/18, Fa0/19, Fa0/20
Fa0/21,
Fa0/22, Fa0/23, Gig1/1
Gig1/2
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp


BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -----
--- ------ ------
1 enet 100001 1500 - - - - -
0 0
1002 fddi 101002 1500 - - - - -
0 0
1003 tr 101003 1500 - - - - -
0 0
1004 fdnet 101004 1500 - - - ieee -
0 0
1005 trnet 101005 1500 - - - ibm -
0 0

Trang 16
Bài tập thực hành Quản trị mạng

DuyTan2#show vlan

VLAN Name Status Ports


---- -------------------------------- --------- -------------
------------------
1 default active Fa0/1, Fa0/2,
Fa0/3, Fa0/4
Fa0/5, Fa0/6,
Fa0/7, Fa0/8
Fa0/9,
Fa0/10, Fa0/11, Fa0/12
Fa0/13,
Fa0/14, Fa0/15, Fa0/16
Fa0/17,
Fa0/18, Fa0/19, Fa0/20
Fa0/21,
Fa0/22, Fa0/23, Gig1/1
Gig1/2
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp


BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -----
--- ------ ------
1 enet 100001 1500 - - - - -
0 0
1002 fddi 101002 1500 - - - - -
0 0
1003 tr 101003 1500 - - - - -
0 0
1004 fdnet 101004 1500 - - - ieee -
0 0
1005 trnet 101005 1500 - - - ibm -
0 0

Nhận xét: cả 2 switch đều chỉ có vlan mặc định và VLAN chưa có sự thay đổi.
6. Thay đổi Vlan trên switch DuyTan1

Trang 17
Bài tập thực hành Quản trị mạng

DuyTan1(config)#vlan 2
DuyTan1(config-vlan)#vlan 3
DuyTan1(config-vlan)#vlan 4
DuyTan1(config-vlan)#vlan 5
DuyTan1(config-vlan)#

Tiếp theo, kiểm tra vlan ở trên Switch DuyTan2 ta sẽ thấy sự đồng bộ vlan từ
switch DuyTan2

DuyTan2#show vlan

VLAN Name Status Ports


---- -------------------------------- --------- -------------
------------------
1 default active Fa0/1, Fa0/2,
Fa0/3, Fa0/4
Fa0/5, Fa0/6,
Fa0/7, Fa0/8
Fa0/9,
Fa0/10, Fa0/11, Fa0/12
Fa0/13,
Fa0/14, Fa0/15, Fa0/16
Fa0/17,
Fa0/18, Fa0/19, Fa0/20
Fa0/21,
Fa0/22, Fa0/23, Gig1/1
Gig1/2
2 VLAN0002 active
3 VLAN0003 active
4 VLAN0004 active
5 VLAN0005 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup

7 trạng thái VTP và revision number

DuyTan1#show vtp status


VTP Version :2
Configuration Revision :4
Maximum VLANs supported locally : 255
Number of existing VLANs :9
VTP Operating Mode : Server

Trang 18
Bài tập thực hành Quản trị mạng

VTP Domain Name : DTU


VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xA8 0xDF 0x41 0x55 0x72 0x8E 0x8A 0x5B
Configuration last modified by 192.168.1.1 at 3-1-93 00:12:52
Local updater ID is 192.168.1.1 on interface Vl1 (lowest numbered VLAN interface)

DuyTan2#show vtp status


VTP Version :2
Configuration Revision :4
Maximum VLANs supported locally : 255
Number of existing VLANs :9
VTP Operating Mode : Server
VTP Domain Name : DTU
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xA8 0xDF 0x41 0x55 0x72 0x8E 0x8A 0x5B
Configuration last modified by 192.168.1.1 at 3-1-93 00:12:52
Local updater ID is 192.168.1.2 on interface Vl1 (lowest numbered VLAN interface found)

DuyTan1#show vtp counters


VTP statistics:
Summary advertisements received : 5
Subset advertisements received : 4
Request advertisements received : 0
Summary advertisements transmitted : 6
Subset advertisements transmitted : 5
Request advertisements transmitted : 0
Number of config revision errors : 0
Number of config digest errors : 0
Number of V1 summary errors : 0

Trang 19
Bài tập thực hành Quản trị mạng

VTP pruning statistics:

Trunk Join Transmitted Join Received Summary


advts received from
non-
pruning-capable device
---------------- ---------------- ---------------- ----------
-----------------

Trang 20
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn


Chương 3.
LAB 04
ĐỊNH TUYẾN TĨNH
I. Mô tả
- Đặt địa chỉ IP như hình vẽ, sau đó cấu hình định tuyến tĩnh trên tất cả các router.
- Mục đích: Các máy tính phải ping được tới tất cả các mạng trong hình vẽ.
II. Nội dung
192.168.2.0/24 192.168.4.0/24
.1 .2 .2 .3

DuyTan1
.1 DuyTan2 .2 DuyTan3 .3

.10 .10 .10

192.168.1.0/24 192.168.3.0/24 192.168.5.0/24

1. tên và địa chỉ IP cho router DuyTan1


Router(config)#hostname DuyTan1
DuyTan1(config)#interface fa0/0
DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0
DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

Trang 21
Bài tập thực hành Quản trị mạng

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan1(config-if)#interface serial 0/1/0


DuyTan1(config-if)#ip address 192.168.2.1 255.255.255.0
DuyTan1(config-if)#clock rate 64000
DuyTan1(config-if)#no shutdown

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state


to u

2. tên và địa chỉ IP cho router DuyTan2


Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 192.168.3.2 255.255.255.0
DuyTan2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/0
DuyTan2(config-if)#ip address 192.168.2.2 255.255.255.0
DuyTan2(config-if)#no shut
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state
to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/1
DuyTan2(config-if)#ip address 192.168.4.2 255.255.255.0
DuyTan2(config-if)#no shutdown
DuyTan2(config-if)#clock rate 64000
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state
to up

3. tên và địa chỉ IP cho router DuyTan3

Router(config)#hostname DuyTan3
DuyTan3(config)#interface fastEthernet 0/0
DuyTan3(config-if)#ip address 192.168.5.3 255.255.255.0

Trang 22
Bài tập thực hành Quản trị mạng

DuyTan3(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan3(config-if)#exit
DuyTan3(config)#interface serial 0/1/1
DuyTan3(config-if)#ip address 192.168.4.3 255.255.255.0
DuyTan3(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/1/1, changed state to down


DuyTan3(config-if)#
%LINK-5-CHANGED: Interface Serial0/1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state


to u
4. DuyTan1, DuyTan3 DuyTan2

DuyTan3#ping 192.168.4.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

- -

DuyTan2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
DuyTan2#ping 192.168.4.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:

Trang 23
Bài tập thực hành Quản trị mạng

!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan3#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0

DuyTan2#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

C 192.168.2.0/24 is directly connected, Serial0/1/0


C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1

DuyTan3#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

Trang 24
Bài tập thực hành Quản trị mạng

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

C 192.168.4.0/24 is directly connected, Serial0/1/1


C 192.168.5.0/24 is directly connected, FastEthernet0/0

5.
– uter DuyTan3 DuyTan2 và Router A:

DuyTan3(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.2


DuyTan3(config)#ip route 192.168.2.0 255.255.255.0 192.168.4.2
DuyTan3(config)#ip route 192.168.3.0 255.255.255.0 192.168.4.2

DuyTan3(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console

– DuyTan2 DuyTan3 và Router A:

DuyTan2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1


DuyTan2(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.3
DuyTan2(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console

– DuyTan1 DuyTan3 và Router B:

DuyTan1(config)# ip route 192.168.3.0 255.255.255.0 192.168.2.2


DuyTan1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2
DuyTan1(config)#ip route 192.168.5.0 255.255.255.0 192.168.2.2
DuyTan1(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console

Kiểm tra DuyTan1 sau khi định tuyến


show ip route:
DuyTan1#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

Trang 25
Bài tập thực hành Quản trị mạng

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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
S 192.168.4.0/24 [1/0] via 192.168.2.2
S 192.168.5.0/24 [1/0] via 192.168.2.2

Kiểm tra DuyTan2:

DuyTan2#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

S 192.168.1.0/24 [1/0] via 192.168.2.1


C 192.168.2.0/24 is directly connected, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1
S 192.168.5.0/24 [1/0] via 192.168.4.3

Kiểm tra DuyTan3:

DuyTan3#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

Trang 26
Bài tập thực hành Quản trị mạng

* - candidate default, U - per-user static route, o - ODR


P - periodic downloaded static route

Gateway of last resort is not set

S 192.168.1.0/24 [1/0] via 192.168.4.2


S 192.168.2.0/24 [1/0] via 192.168.4.2
S 192.168.3.0/24 [1/0] via 192.168.4.2
C 192.168.4.0/24 is directly connected, Serial0/1/1
C 192.168.5.0/24 is directly connected, FastEthernet0/0

Trang 27
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn

LAB 05
RIP
I. Mô tả
- Hiểu biết mục đích và ý nghĩa của định tuyến động.
- Định tuyến RIP.
- Kiểm tra bảng định tuyến.
II. Nội dung
192.168.2.0/24 192.168.4.0/24
.1 .2 .2 .3

DuyTan1
.1 DuyTan2 .2 DuyTan3 .3

.10 .10 .10

192.168.1.0/24 192.168.3.0/24 192.168.5.0/24

1. tên và địa chỉ IP cho router DuyTan1


Router(config)#hostname DuyTan1
DuyTan1(config)#interface fa0/0
DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0
DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

Trang 28
Bài tập thực hành Quản trị mạng

DuyTan1(config-if)#interface serial 0/1/0


DuyTan1(config-if)#ip address 192.168.2.1 255.255.255.0
DuyTan1(config-if)#clock rate 64000
DuyTan1(config-if)#no shutdown

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state


to u

2. tên và địa chỉ IP cho router DuyTan2


Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 192.168.3.2 255.255.255.0
DuyTan2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/0
DuyTan2(config-if)#ip address 192.168.2.2 255.255.255.0
DuyTan2(config-if)#no shut
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state
to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/1
DuyTan2(config-if)#ip address 192.168.4.2 255.255.255.0
DuyTan2(config-if)#no shutdown
DuyTan2(config-if)#clock rate 64000
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state
to up

tên và địa chỉ IP cho router DuyTan3

Router(config)#hostname DuyTan3
DuyTan3(config)#interface fastEthernet 0/0
DuyTan3(config-if)#ip address 192.168.5.3 255.255.255.0
DuyTan3(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

Trang 29
Bài tập thực hành Quản trị mạng

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan3(config-if)#exit
DuyTan3(config)#interface serial 0/1/1
DuyTan3(config-if)#ip address 192.168.4.3 255.255.255.0
DuyTan3(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/1/1, changed state to down


DuyTan3(config-if)#
%LINK-5-CHANGED: Interface Serial0/1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state


to u
4. DuyTan1, DuyTan2 DuyTan3

DuyTan3#ping 192.168.4.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

- -

DuyTan2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
DuyTan2#ping 192.168.4.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

Trang 30
Bài tập thực hành Quản trị mạng

DuyTan3#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0

DuyTan2#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

C 192.168.2.0/24 is directly connected, Serial0/1/0


C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1

DuyTan3#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

Trang 31
Bài tập thực hành Quản trị mạng

P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.4.0/24 is directly connected, Serial0/1/1


C 192.168.5.0/24 is directly connected, FastEthernet0/0

5. Cấu hình

DuyTan1(config)#router rip
DuyTan1(config–router)#network 192.168.1.0
DuyTan1(config–router)#network 192.168.2.0

DuyTan2(config)#router rip
DuyTan2(config–router)#network 192.168.2.0
DuyTan2(config–router)#network 192.168.3.0
DuyTan2(config–router)#network 192.168.4.0

DuyTan3(config)#router rip
DuyTan2(config–router)#network 192.168.4.0
DuyTan2(config–router)#network 192.168.5.0

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:26, Serial0/1/0
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:26, Serial0/1/0
R 192.168.5.0/24 [120/2] via 192.168.2.2, 00:00:26, Serial0/1/0

Trang 32
Bài tập thực hành Quản trị mạng

DuyTan2#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

R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:12, Serial0/1/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1
R 192.168.5.0/24 [120/1] via 192.168.4.3, 00:00:18, Serial0/1/1

DuyTan3#sh 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

R 192.168.1.0/24 [120/2] via 192.168.4.2, 00:00:12,


Serial0/1/1
R 192.168.2.0/24 [120/1] via 192.168.4.2, 00:00:12,
Serial0/1/1
R 192.168.3.0/24 [120/1] via 192.168.4.2, 00:00:12,
Serial0/1/1
C 192.168.4.0/24 is directly connected, Serial0/1/1

Trang 33
Bài tập thực hành Quản trị mạng

C 192.168.5.0/24 is directly connected, FastEthernet0/0

DuyTan1#show ip route rip


R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:25,
Serial0/1/0
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:25,
Serial0/1/0
R 192.168.5.0/24 [120/2] via 192.168.2.2, 00:00:25,
Serial0/1/0

DuyTan3#ping 192.168.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.10 timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max =
4/4/4 ms

DuyTan1#ping 192.168.5.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.10 timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max =
4/4/4 ms

Ta có thể x
DuyTan1 DuyTan2

DuyTan3#debug ip rip

RIP protocol debugging is on


DuyTan3#RIP: received v1 request from 192.168.4.2 on
Serial0/1/1

Trang 34
Bài tập thực hành Quản trị mạng

RIP: sending v1 update to 192.168.4.2 via Serial0/1/1


(192.168.4.3)

RIP: build update entries

network 192.168.5.0 metric 1

RIP: received v1 update from 192.168.4.2 on Serial0/1/1

192.168.1.0 in 2 hops

192.168.2.0 in 1 hops

192.168.3.0 in 1 hops

RIP: sending v1 update to 255.255.255.255 via Serial0/1/1


(192.168.4.3)

RIP: build update entries

network 192.168.5.0 metric 1

RIP: sending v1 update to 255.255.255.255 via


FastEthernet0/0 (192.168.5.3)

RIP: build update entries

network 192.168.1.0 metric 3

network 192.168.2.0 metric 2

network 192.168.3.0 metric 2

network 192.168.4.0 metric 1

DuyTan1#undebug all

Trang 35
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn

LAB 06
Giao thức định tuyến OSPF
I. Mục tiêu
- Hiểu biết ý nghĩa và cách thức hoạt động của giao thức OSPF
- Định tuyến OSPF.
- Kiểm tra bảng định tuyến.
II. Nội dung
192.168.2.0/24 192.168.4.0/24
.1 .2 .2 .3

DuyTan1
.1 DuyTan2 .2 DuyTan3 .3

.10 .10 .10

192.168.1.0/24 192.168.3.0/24 192.168.5.0/24

1. tên và địa chỉ IP cho router DuyTan1


Router(config)#hostname DuyTan1
DuyTan1(config)#interface fa0/0
DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0
DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan1(config-if)#interface serial 0/1/0


DuyTan1(config-if)#ip address 192.168.2.1 255.255.255.0

Trang 36
Bài tập thực hành Quản trị mạng

DuyTan1(config-if)#clock rate 64000


DuyTan1(config-if)#no shutdown

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state


to u

2. tên và địa chỉ IP cho router DuyTan2


Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 192.168.3.2 255.255.255.0
DuyTan2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/0
DuyTan2(config-if)#ip address 192.168.2.2 255.255.255.0
DuyTan2(config-if)#no shut
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state
to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/1
DuyTan2(config-if)#ip address 192.168.4.2 255.255.255.0
DuyTan2(config-if)#no shutdown
DuyTan2(config-if)#clock rate 64000
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state
to up

3. tên và địa chỉ IP cho router DuyTan3

Router(config)#hostname DuyTan3
DuyTan3(config)#interface fastEthernet 0/0
DuyTan3(config-if)#ip address 192.168.5.3 255.255.255.0
DuyTan3(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

Trang 37
Bài tập thực hành Quản trị mạng

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan3(config-if)#exit
DuyTan3(config)#interface serial 0/1/1
DuyTan3(config-if)#ip address 192.168.4.3 255.255.255.0
DuyTan3(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/1/1, changed state to down


DuyTan3(config-if)#
%LINK-5-CHANGED: Interface Serial0/1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state


to u
4. DuyTan1, DuyTan2 DuyTan3

DuyTan3#ping 192.168.4.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

- -

DuyTan2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
DuyTan2#ping 192.168.4.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan3#ping 192.168.2.1

Trang 38
Bài tập thực hành Quản trị mạng

Type escape sequence to abort.


Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0

DuyTan2#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

C 192.168.2.0/24 is directly connected, Serial0/1/0


C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1

DuyTan3#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

Trang 39
Bài tập thực hành Quản trị mạng

Gateway of last resort is not set

C 192.168.4.0/24 is directly connected, Serial0/1/1


C 192.168.5.0/24 is directly connected, FastEthernet0/0

DuyTan1(config)#router ospf 1
DuyTan1(config-router)#network 192.168.1.0 0.0.0.255 area 0
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 ar
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan1(config-router)#

DuyTan2(config)#router ospf 1
DuyTan2(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.3.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.4.0 0.0.0.255 area 0
01:48:45: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on Serial0/1/0 from
LOADING to FULL, Loading Done

DuyTan2(config-router)#
01:48:52: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.5.3 on Serial0/1/1 from
LOADING to FULL, Loading Done

DuyTan3(config)#router ospf 1
DuyTan3(config-router)#network 192.168.4.0 0.0.0.255 area 0
DuyTan3(config-router)#network 192.168.5.0 0.0.0.255 area 0
DuyTan3(config-router)#
01:50:31: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.4.2 on Serial0/1/1 from
LOADING to FULL, Loading Done

-
192.168. 192.168.1
192.168.1.254.

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

Trang 40
Bài tập thực hành Quản trị mạng

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

Học lại

DuyTan1# clear ip route *

Kiểm tra bảng định tuyến


DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
O 192.168.3.0/24 [110/65] via 192.168.2.2, 01:54:48, Serial0/1/0
O 192.168.4.0/24 [110/128] via 192.168.2.2, 01:54:48, Serial0/1/0
O 192.168.5.0/24 [110/129] via 192.168.2.2, 01:54:48, Serial0/1/0

, ta 3 -hop 192.168.2
S0/1/0

Trang 41
Bài tập thực hành Quản trị mạng

DuyTan2#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

O 192.168.1.0/24 [110/65] via 192.168.2.1, 01:55:54, Serial0/1/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/1/1
O 192.168.5.0/24 [110/65] via 192.168.4.3, 01:55:54, Serial0/1/1

DuyTan3#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

O 192.168.1.0/24 [110/129] via 192.168.4.2, 01:56:13, Serial0/1/1


O 192.168.2.0/24 [110/128] via 192.168.4.2, 01:56:13, Serial0/1/1
O 192.168.3.0/24 [110/65] via 192.168.4.2, 01:56:13, Serial0/1/1
C 192.168.4.0/24 is directly connected, Serial0/1/1
C 192.168.5.0/24 is directly connected, FastEthernet0/0

DuyTan1#show ip route ospf


O 192.168.3.0 [110/65] via 192.168.2.2, 01:57:00, Serial0/1/0
O 192.168.4.0 [110/128] via 192.168.2.2, 01:57:00, Serial0/1/0
O 192.168.5.0 [110/129] via 192.168.2.2, 01:57:00, Serial0/1/0

DuyTan2#show ip route ospf


O 192.168.1.0 [110/65] via 192.168.2.1, 01:57:17, Serial0/1/0

Trang 42
Bài tập thực hành Quản trị mạng

O 192.168.5.0 [110/65] via 192.168.4.3, 01:57:17, Serial0/1/1

DuyTan3#show ip route ospf


O 192.168.1.0 [110/129] via 192.168.4.2, 01:56:40, Serial0/1/1
O 192.168.2.0 [110/128] via 192.168.4.2, 01:56:40, Serial0/1/1
O 192.168.3.0 [110/65] via 192.168.4.2, 01:56:40, Serial0/1/1

Trang 43
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn


Chương 4.
LAB 07
DHCP SERVER
I. Mục tiêu
Bài thực hành này mô tả cách cấu hình router Cisco hoạt động như là một máy chủ
DHCP. Máy chủ này sẽ cấp địa chỉ IP cho các máy khách (client) ở hai mạng khác
nhau. Đồng thời, bài thực hành cũng hướng dẫn cách dùng lệnh ip helper-address để
chuyển các yêu cầu DHCP-request tới các máy chủ DHCP trong trường hợp các máy
chủ đặt ở phân đoạn mạng khác.

Các máy tính trạm ở các mạng 192.168.1.0/24 và mạng 192.168.3.0/24 cần sử dụng
dịch vụ DHCP để cấu hình IP tự động. Trong bài này, DuyTan1 được cấu hình là máy
chủ DHCP phục vụ cho cả hai phân đoạn mạng bằng cách tạo ra hai không gian địa chỉ
(pool) khác nhau. Trên cổng FastEthernet của DuyTan2 cấu hình để chuyển tiếp các
UDP broadcast, bao gồm DHCP request, tới DuyTan1.
II. Nội dung

192.168.2.0/24
.1 .2

DuyTan1
.1 DuyTan2 .2

PC1 .10 PC2 .10

192.168.1.0/24 192.168.3.0/24

1. tên và địa chỉ IP cho router DuyTan1


Router(config)#hostname DuyTan1
DuyTan1(config)#interface fa0/0

Trang 44
Bài tập thực hành Quản trị mạng

DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0


DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan1(config-if)#interface serial 0/1/0


DuyTan1(config-if)#ip address 192.168.2.1 255.255.255.0
DuyTan1(config-if)#clock rate 64000
DuyTan1(config-if)#no shutdown

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state


to u

2. tên và địa chỉ IP cho router DuyTan2

Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 192.168.3.2 255.255.255.0
DuyTan2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/0
DuyTan2(config-if)#ip address 192.168.2.2 255.255.255.0
DuyTan2(config-if)#no shut
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state
to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/1
DuyTan2(config-if)#ip address 192.168.4.2 255.255.255.0
DuyTan2(config-if)#no shutdown
DuyTan2(config-if)#clock rate 64000
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state
to up

Trang 45
Bài tập thực hành Quản trị mạng

3. DuyTan1 DuyTan2

DuyTan1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan1#ping 192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0

DuyTan2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

Trang 46
Bài tập thực hành Quản trị mạng

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

C 192.168.2.0/24 is directly connected, Serial0/1/0


C 192.168.3.0/24 is directly connected, FastEthernet0/0

DuyTan1(config)#router ospf 1
DuyTan1(config-router)#network 192.168.1.0 0.0.0.255 area 0
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 ar
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan1(config-router)#

DuyTan2(config)#router ospf 1
DuyTan2(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.3.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.4.0 0.0.0.255 area 0
01:48:45: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on Serial0/1/0 from
LOADING to FULL, Loading Done

DuyTan2(config-router)#
01:48:52: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.5.3 on Serial0/1/1 from
LOADING to FULL, Loading Done

Kiểm tra bảng định tuyến


DuyTan1#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

Trang 47
Bài tập thực hành Quản trị mạng

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
O 192.168.3.0/24 [110/65] via 192.168.2.2, 01:54:48, Serial0/1/0

DuyTan2#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

O 192.168.1.0/24 [110/65] via 192.168.2.1, 01:55:54, Serial0/1/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0

5. Cấu hình DuyTan1 là DHCP server cho các client ở mạng 192.168.1.0/24

Bật DHCP service trên DuyTan1

DuyTan1(config)#service dhcp

Tạo ra một DHCP pool cho mạng 192.168.1.0, tên của pool là network-1.0

DuyTan1(config)#ip dhcp pool network-1.0


DuyTan1(dhcp-config)#network 192.168.1.0 255.255.255.0

Giả sử 10 địa chỉ đầu được gán cho các các server và router trong mạng, như vậy
các client được gán từ địa chỉ 192.168.1.11 trở về sau, thực hiện lệnh ip dhcp excluded-
address để loại trừ các địa chỉ này.

DuyTan1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10

Trở vào lại DHCP configuration mode và gán các thông số IP khác như địa chỉ
default gateway address, DNS server, WINS server, và domain name. Các thông
số này sẽ được cấp kèm theo địa chỉ IP.

DuyTan1(config)#ip dhcp pool network-1.0


DuyTan1(dhcp-config)#default-router 192.168.1.1
DuyTan1(dhcp-config)#dns-server 10.0.0.3

Trang 48
Bài tập thực hành Quản trị mạng

DuyTan1(dhcp-config)#netbios-name-server 10.0.0.4
DuyTan1(dhcp-config)#domain-name xyz.net

Kiểm tra hoạt động DHCP server


Trên máy trạm: Thực hiện việc xin lại địa chỉ IP. PC1 sẽ được gán động địa chỉ IP đầu
tiên trong pool là 192.168.1.11.

- Kiểm tra trên PC1 với lệnh winipcfg (Win98/WinME) hoặc ipconfig /all xem đã
nhận được đúng địa chỉ IP, subnet mask, default gateway, DNS server, và WINS server.
- Dùng lệnh ipconfig /all đối với Windows XP, Windows 2000.
+ WinXP, Win2000: Start / Run / cmd
+ Win9x: Start / Run / command

Microsoft Windows XP [Version 5.1.2600]


(C) Copyright 1985-2001 Microsoft Corp.

C:\ >ipconfig /release

Windows IP Configuration
Ethernet adapter Local Area Connection 3:

Connection-specific DNS Suffix . :


IP Address. . . . . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . . . . :

C:\ >ipconfig /renew

Windows IP Configuration
Ethernet adapter Local Area Connection 3:

Connection-specific DNS Suffix . : xyz.net


IP Address. . . . . . . . . . . . : 192.168.1.11
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

C:\ >ipconfig /all

Windows IP Configuration
Host Name . . . . . . . . . . . . : VoNhanVan
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No

Trang 49
Bài tập thực hành Quản trị mạng

WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection 3:


Connection-specific DNS Suffix . : xyz.net
Description . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC #2
Physical Address. . . . . . . . . : 00-E0-4D-01-29-78
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.1.11
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 10.0.0.3
Primary WINS Server . . . . . . . : 10.0.0.4
Lease Obtained. . . . . . . . : Thursday, February 05, 2012 9:08:24 AM
Lease Expires . . . . . . . . : Friday, February 06, 2012 9:08:24 AM

6. Cấu hình DHCP Relay

Vì PC2 nằm ở phân đoạn mạng khác cũng được cấu hình IP động, do đó ta cần tạo
ra một DHCP pool thứ hai với địa chỉ và gateway tương ứng cho mạng 192.168.3.0/24:

DuyTan1(config)#ip dhcp pool network-3.0


DuyTan1(dhcp-config)#network 192.168.3.0 255.255.255.0
DuyTan1(dhcp-config)#default-router 192.168.3.1
DuyTan1(dhcp-config)#dns-server 10.0.0.3
DuyTan1(dhcp-config)#netbios-name-server 10.0.0.4
DuyTan1(dhcp-config)#domain-name xyz.net

Cấu hình cho DHCP đã hoàn thành, tuy nhiên PC2 dùng UDP broadcast để tìm địa
chỉ IP. DuyTan2 lại chưa được cấu hình để chuyển tiếp các broadcast này. Để DHCP
hoạt động cho phân đoạn mạng của DuyTan2, phải cấu hình cổng giao tiếp FastEthernet
của DuyTan2 chuyển tiếp các UDP broadcast tới DuyTan1.

DuyTan2(config)#interface fastethernet 0/0


DuyTan2(config-if)#ip helper-address 192.168.1.2

Lệnh ip helper-address có thể chuyển tiếp nhiều giao thức khác dựa trên UDP như
DNS, BOOTP request. Ta có thể chỉ định chính xác giao thức chuyển tiếp bằng lệnh ip
forward-protocol udp [port]

Tại Host B thực hiện release và renew cấu hình IP. Kiểm tra lại địa chỉ IP bằng
lệnh winipcfg hay ipconfig /all

Trang 50
Bài tập thực hành Quản trị mạng

Microsoft Windows XP [Version 5.1.2600]


(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\TiemNangViet>ipconfig /release

Windows IP Configuration
Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :


Autoconfiguration IP Address. . . : 169.254.173.207
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :

C:\Documents and Settings\TiemNangViet>ipconfig /renew

Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : xyz.net
IP Address. . . . . . . . . . . . : 192.168.3.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.3.1

C:\Documents and Settings\TiemNangViet>ipconfig /all

Windows IP Configuration
Host Name . . . . . . . . . . . . : VoNhanVan
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:


Connection-specific DNS Suffix . : xyz.net
Description . . . . . . . . : SiS 900-Based PCI Fast
Ethernet Adapter
Physical Address. . . . . . . . . : 00-0A-E6-5E-84-77
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.3.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.3.1
DHCP Server . . . . . . . . . . . : 192.168.2.1

Trang 51
Bài tập thực hành Quản trị mạng

DNS Servers . . . . . . . . . . . : 10.0.0.3


Primary WINS Server . . . . . . . : 10.0.0.4
Lease Obtained . . . . . . . . : Friday, February 06, 2012
9:22:16 AM
Lease Expires . . . . . . . . : Saturday, February 07,
2012 9:22:16AM

Chú ý, lúc này địa chỉ IP của PC2 là 192.168.3.2 do địa chỉ đầu tiên 192.168.3.1 đã
được đặt ở câu lệnh default-router và đã được gán là địa chỉ cổng giao tiếp FastEthernet
của DuyTan2. DHCP server đã thực hiện ping địa chỉ đầu tiên 192.168.3.1 để biết được
nó có tồn tại hay không.

Để xem địa chỉ IP nào đã cấp tương ứng với địa chỉ MAC, thực hiện lệnh

DuyTan1#sh ip dhcp binding

IP address Hardware address Lease expiration Type


192.168.1.11 0100.e04d.0129.78 Mar 02 2012 12:15 AM Automatic
192.168.3.2 0100.0ae6.5e84.77 Mar 02 2012 12:22 AM
Automatic

DuyTan1 biết cách gán địa chỉ cho PC2 từ pool network-3.0 mà không phải từ pool
network-1.0 bởi vì DHCP request của PC2 được chuyển tiếp dùng lệnh ip helper-
address và yêu cầu này bắt nguồn từ cổng giao tiếp FastEthernet của DuyTan2 có địa
chỉ 192.168.3.1; địa chỉ này nằm trong pool network-3.0, DHCP server sẽ đáp ứng với
địa chỉ từ pool này.

Trang 52
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn

LAB 08

LAB STANDARD ACCESS-LIST


I. Mô tả
Access–list dùng để giám sát lưu lượng vào hoặc ra trên một cổng. Các điều kiện so
sánh dựa vào access-list được định nghĩa trước, có thể đơn giản (standard access list) hay
khá phức tạp (extended access list).
Lab này mô tả lọc gói dữ liệu sử dụng standard access-list thực hiện cấm PC1 nằm
trong dãy địa chỉ 192.168.1.0 - 192.168.1.15 ping tới PC2.


DuyTan2
(192.168.3.10 –list trên DuyTan2 –
– FastEthernet.

Trang 53
Bài tập thực hành Quản trị mạng

192.168.2.0/24
.1 .2

DuyTan1
.1 DuyTan2 .2

PC1 PC2
.10 .10

192.168.1.0/24 192.168.3.0/24

1. tên và địa chỉ IP cho router DuyTan1


Router(config)#hostname DuyTan1
DuyTan1(config)#interface fa0/0
DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0
DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan1(config-if)#interface serial 0/1/0


DuyTan1(config-if)#ip address 192.168.2.1 255.255.255.0
DuyTan1(config-if)#clock rate 64000
DuyTan1(config-if)#no shutdown

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state


to u

2. tên và địa chỉ IP cho router DuyTan2

Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 192.168.3.2 255.255.255.0
DuyTan2(config-if)#no shut

Trang 54
Bài tập thực hành Quản trị mạng

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed


state to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/0
DuyTan2(config-if)#ip address 192.168.2.2 255.255.255.0
DuyTan2(config-if)#no shut
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state
to up

DuyTan2(config-if)#exit
DuyTan2(config)#interface serial 0/1/1
DuyTan2(config-if)#ip address 192.168.4.2 255.255.255.0
DuyTan2(config-if)#no shutdown
DuyTan2(config-if)#clock rate 64000
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/1, changed state
to up

3. DuyTan1 DuyTan2

DuyTan1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

DuyTan1#ping 192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Trang 55
Bài tập thực hành Quản trị mạng

DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0

DuyTan2#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

C 192.168.2.0/24 is directly connected, Serial0/1/0


C 192.168.3.0/24 is directly connected, FastEthernet0/0

4.

DuyTan1(config)#router ospf 1
DuyTan1(config-router)#network 192.168.1.0 0.0.0.255 area 0
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 ar
DuyTan1(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan1(config-router)#

DuyTan2(config)#router ospf 1
DuyTan2(config-router)#network 192.168.2.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.3.0 0.0.0.255 area 0
DuyTan2(config-router)#network 192.168.4.0 0.0.0.255 area 0

Trang 56
Bài tập thực hành Quản trị mạng

01:48:45: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on Serial0/1/0 from


LOADING to FULL, Loading Done

DuyTan2(config-router)#
01:48:52: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.5.3 on Serial0/1/1 from
LOADING to FULL, Loading Done

Kiểm tra bảng định tuyến


DuyTan1#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

C 192.168.1.0/24 is directly connected, FastEthernet0/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
O 192.168.3.0/24 [110/65] via 192.168.2.2, 01:54:48, Serial0/1/0

DuyTan2#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

O 192.168.1.0/24 [110/65] via 192.168.2.1, 01:55:54, Serial0/1/0


C 192.168.2.0/24 is directly connected, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
Kiểm tra ping từ PC1 có địa chỉ là 192.168.1.10 đến PC2

5. Cấu hình ACL chuẩn : cấm PC1 nằm trong dãy địa chỉ 192.168.1.0 - 192.168.1.15
ping tới PC2.

Trang 57
Bài tập thực hành Quản trị mạng

R2(config)# access-list 1 deny 192.168.1.0 0.0.0.15


R2(config)# access-list 1 permit any
-
-
-

- -

DuyTan2(config)# cổng f0/0


DuyTan2(config-if)# ip access-group 1 out

Kiểm tra:
Đặt địa chỉ IP cho PC1 là 192.168.1.10, default gateway là 192.168.1.1 và kiểm
tra ping tới PC2

PC>ping 192.168.3.10

Pinging 192.168.3.10 with 32 bytes of data:

Reply from 192.168.2.2: Destination host unreachable.


Reply from 192.168.2.2: Destination host unreachable.
Reply from 192.168.2.2: Destination host unreachable.
Reply from 192.168.2.2: Destination host unreachable.

Ping statistics for 192.168.3.10:


Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

R2#debug ip packet
IP packet debugging is on
R2#
IP: s=s=192.168.1.10 (Serial0/1/0), d=192.168.3.10
(FastEthernet0/0), len 100,
access denied
IP: s=192.168.2.2 (local), d=192.168.1.10 (Serial0/1/0), len
56, sending <-

Đặt lại địa chỉ IP cho PC1 là 192.168.1.16, default gateway là 192.168.1.1 và kiểm tra
ping lại

Trang 58
Bài tập thực hành Quản trị mạng

PC>ping 192.168.3.10

Pinging 192.168.3.10 with 32 bytes of data:

Request timed out.


Reply from 192.168.3.10: bytes=32 time=93ms TTL=126
Reply from 192.168.3.10: bytes=32 time=59ms TTL=126
Reply from 192.168.3.10: bytes=32 time=93ms TTL=126

Ping statistics for 192.168.3.10:


Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 59ms, Maximum = 93ms, Average = 81ms

Trang 59
Bài tập thực hành Quản trị mạng

TRƯỜNG ĐẠI HỌC DUY TÂN QUẢN TRỊ MẠNG BÀI THỰC HÀNH
KHOA CÔNG NGHỆ THÔNG TIN LAB số : 03
BỘ MÔN KỸ THUẬT MẠNG Số giờ : 03 giờ

GVHD : Võ Nhân Văn

LAB 09

NAT OVERLOAD
I. Mô tả
- Cấu hình địa chỉ IP như hình vẽ.
- Giả sử DuyTan2 là nhà cung cấp dịch vụ và PC2 là một địa chỉ ngoài Internet.
- DuyTan1 thực hiện NAT overload sao cho chỉ những máy có địa chỉ từ
192.168.1.0 - 192.168.1.63 là có thể đi ra được Internet.
II. Nội dung

200.0.0.0/24
.1 .2

DuyTan1
.1 DuyTan2 .2

PC1 PC2
.10 .10

192.168.1.0/24 203.0.0.0/24

1. tên và địa chỉ IP cho router DuyTan1

Router(config)#hostname DuyTan1
DuyTan1(config)#int fa0/0
DuyTan1(config-if)#ip address 192.168.1.1 255.255.255.0
DuyTan1(config-if)#no shut

Trang 60
Bài tập thực hành Quản trị mạng

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to


up

DuyTan1(config-if)#exit
DuyTan1(config)#interface fastEthernet 0/1
DuyTan1(config-if)#ip address 200.0.0.1 255.255.255.0
DuyTan1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up


%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to
up
2. tên và địa chỉ IP cho router DuyTan2

Router(config)#hostname DuyTan2
DuyTan2(config)#interface fastEthernet 0/0
DuyTan2(config-if)#ip address 203.0.0.1 255.255.255.0
DuyTan2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to


up
DuyTan2(config-if)#interface fastEthernet 0/1
DuyTan2(config-if)#ip address 200.0.0.2 255.255.255.0
DuyTan2(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to


up

3. Kiểm tra ping từ DuyTan1 và PC1 tới địa chỉ 203.0.0.1 (địa chỉ giả lập là ngoài
internet)

DuyTan1#ping 203.0.0.1

Type escape sequence to abort.


Sending 5, 100-byte ICMP Echos to 203.0.0.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Trang 61
Bài tập thực hành Quản trị mạng

PC>ping 203.0.0.1

Pinging 203.0.0.1 with 32 bytes of data:

Reply from 192.168.1.1: Destination host unreachable.


Reply from 192.168.1.1: Destination host unreachable.
Reply from 192.168.1.1: Destination host unreachable.
Reply from 192.168.1.1: Destination host unreachable.

Ping statistics for 203.0.0.1:


Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

4. Thực hiện NAT trên DuyTan1

Tạo ACL cho phép những địa chỉ IP từ 192.168.1.0 tới 192.168.1.63 được NAT
DuyTan1(config)#access-list 1 permit 192.168.1.0 0.0.0.63

Định nghĩa NAT overload


DuyTan1(config)#ip nat inside source list 1 interface fastEthernet 0/1 ov
DuyTan1(config)#ip nat inside source list 1 interface fastEthernet 0/1 overload
DuyTan1(config)#

Áp lên cổng:

DuyTan1(config)#interface fastEthernet 0/0


DuyTan1(config-if)#ip nat inside

DuyTan1(config-if)#interface fastEthernet 0/1


DuyTan1(config-if)#ip nat outside

Định tuyến mặc định:


DuyTan1(config)#ip route 0.0.0.0 0.0.0.0 200.0.0.2

5.
Đặt địa chỉ IP cho PC là 192.168.1.10, default gateway là 192.168.1.1 và thực hiện
ping tới địa chỉ 203.0.0.1
PC>ping 203.0.0.1

Pinging 203.0.0.1 with 32 bytes of data:

Request timed out.


Reply from 203.0.0.1: bytes=32 time=63ms TTL=254
Reply from 203.0.0.1: bytes=32 time=63ms TTL=254

Trang 62
Bài tập thực hành Quản trị mạng

Reply from 203.0.0.1: bytes=32 time=63ms TTL=254

Ping statistics for 203.0.0.1:


Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 63ms, Maximum = 63ms, Average = 63ms

Thực hiện debug trên router DuyTan1 để xem quá trình chuyển đổi địa chỉ IP

DuyTan1#debug ip nat
IP NAT debugging is on
DuyTan1#
NAT: s=192.168.1.10->200.0.0.1, d=203.0.0.1 [9]

NAT*: s=203.0.0.1, d=200.0.0.1->192.168.1.10 [4]

NAT: s=192.168.1.10->200.0.0.1, d=203.0.0.1 [10]

NAT*: s=203.0.0.1, d=200.0.0.1->192.168.1.10 [5]

NAT: s=192.168.1.10->200.0.0.1, d=203.0.0.1 [11]

NAT*: s=203.0.0.1, d=200.0.0.1->192.168.1.10 [6]

NAT: s=192.168.1.10->200.0.0.1, d=203.0.0.1 [12]

NAT*: s=203.0.0.1, d=200.0.0.1->192.168.1.10 [7]

NAT: expiring 200.0.0.1 (192.168.1.10) icmp 5 (5)

DuyTan1

DuyTan1#show ip nat translations


Pro Inside global Inside local Outside local Outside global
icmp 200.0.0.1:10 192.168.1.10:10 203.0.0.1:10 203.0.0.1:10
icmp 200.0.0.1:11 192.168.1.10:11 203.0.0.1:11 203.0.0.1:11
icmp 200.0.0.1:12 192.168.1.10:12 203.0.0.1:12 203.0.0.1:12
icmp 200.0.0.1:9 192.168.1.10:9 203.0.0.1:9 203.0.0.1:9

Trang 63
Bài tập thực hành Quản trị mạng

Show ip nat statistics :


h

Show ip nat translations:

Show ip nat translations verbose :

clear ip nat translation :

clear ip nat statistics :

debug ip nat :

Trưởng bộ môn Giảng viên

Nguyễn Minh Nhật Võ Nhân Văn

Trang 64

You might also like