Lab 1-1: CU HÌNH DHCP SERVER VÀ IP HELPER-ADDRESS
http://wimaxpro.org/Hinh_upload/hinh_forum/BSCI_lab1-1.jpg
Mô t
Bài thc hành này mô t cách cu hình router Cisco hot động như là mt máy ch DHCP. Máy ch này s cp địa ch IP
cho các máy khách (client) hai mng khác nhau. Đồng thi, bài thc hành cũng hướng dn cách dùng lnh ip helper-
address để chuyn các yêu cu DHCP-request ti các máy ch DHCP trong trường hp các máy ch đặt phân đon mng
khác.
Các máy tính trm các mng 192.168.3.0/24 và mng 10.0.0.0/24 cn s dng dch v DHCP để cu hình IP t động.
Trong bài này, RouterA được cu hình là máy ch DHCP phc v cho c hai phân đon mng bng cách to ra hai không
gian địa ch (pool) khác nhau. Trên cng FastEthernet ca RouterB cu hình để chuyn tiếp các UDP broadcast, bao gm
DHCP request, ti RouterA.
Cu hình
Kết ni HostA và Host B như sơ đồ. Cu hình các máy trm này chế độ đặt địa ch IP t động. Ban đầu cu hình các
Router như sau
RouterA
!
hostname RouterA
!
ip subnet-zero
!
ip dhcp excluded-address 10.0.0.1 10.0.0.10
!
ip dhcp pool network-10
network 10.0.0.0 255.255.255.0
default-router 10.0.0.1
dns-server 10.0.0.3
netbios-name-server 10.0.0.4
domain-name xyz.net
!
ip dhcp pool network-198
network 192.168.3.0 255.255.255.0
default-router 192.168.3.1
dns-server 10.0.0.3
netbios-name-server 10.0.0.4
domain-name xyz.net
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
no shut
!
interface Serial0/0
ip address 192.1.1.2 255.255.255.0
clockrate 64000
!
router rip
version 2
network 10.0.0.0
network 192.1.1.0
!
ip classless
!
end
RouterB
hostname RouterB
!
ip subnet-zero
!
interface FastEthernet0/0
ip address 192.168.3.1 255.255.255.0
ip helper-address 192.1.1.2
!
interface Serial0/0
ip address 192.1.1.1 255.255.255.0
!
router rip
version 2
network 192.1.1.0
network 192.168.3.0
!
ip classless
no ip http server
!
end
Thc hin
1. Cu hình chy RIPv2 trên các router, cho phép RIP trên tt c các cng giao tiếp ca các router này:
RouterA(config)#router rip
RouterA(config)#version 2
RouterA(config-router)#network 192.1.1.0
RouterA(config-router)#network 10.0.0.0
RouterB(config)#router rip
RouterB(config-router)#version 2
RouterB(config-router)#network 192.1.1.0
RouterB(config-router)#network 192.168.3.0
Kim tra li bng lnh ping và lnh show ip route để đảm bo đã kết ni được gia RouterA và RouterB. Trong bng định
tuyến ca router A phi có tuyến đường 192.168.3.0 và tuyến này được hc thông qua RIP.
RouterA#sh ip route
...
Gateway of last resort is not set
C 10.0.0.0/8 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial0/0
R 192.168.3.0/24 [120/1] via 192.168.1.1, 00:00:05, Serial0/0
2. Cu hình RouterA là DHCP server cho các client mng 10.0.0.0/8
–Bt DHCP service trên RouterA
RouterA(config)#service dhcp
–To ra mt DHCP pool cho mng 10.0.0.0, tên ca pool là network-10
RouterA(config)#ip dhcp pool network-10
RouterA(dhcp-config)#network 10.0.0.0 255.255.255.0
Gi s 10 địa ch đầu được gán cho các các server và router trong mng, như vy các client được gán t địa ch 10.0.0.11 tr
v sau, thc hin lnh ip dhcp excluded-address để loi tr các địa ch này.
RouterA(config)#ip dhcp excluded-address 10.0.0.1 10.0.0.10
3. Tr vào li 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 cp kèm theo địa ch IP.
RouterA(config)#ip dhcp pool network-10
RouterA(dhcp-config)#default-router 10.0.0.1
RouterA(dhcp-config)#dns-server 10.0.0.3
RouterA(dhcp-config)#netbios-name-server 10.0.0.4
RouterA(dhcp-config)#domain-name xyz.net
Kim tra hot động DHCP server
Trên máy trm: Thc hin vic xin li địa ch IP. Host A s được gán động địa ch IP đầu tiên trong pool là 10.0.0.11.
+ Kim tra trên HostA vi lnh winipcfg (Win98/WinME) hoc ipconfig /all xem đã nhn được đúng địa ch IP, subnet mask,
default gateway, DNS server, và WINS server.
+ Dùng lnh ipconfig /all đối vi 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. . . . . . . . . . . . : 10.0.0.11
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.1
C:\ >ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : Khanh
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
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. . . . . . . . . . . . : 10.0.0.11
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . : 10.0.0.1
DHCP Server . . . . . . . . . . . : 10.0.0.1
DNS Servers . . . . . . . . . . . : 10.0.0.3
Primary WINS Server . . . . . . . : 10.0.0.4
Lease Obtained. . . . . . . . : Thursday, February 05, 2004 9:08:24 AM
Lease Expires . . . . . . . . : Friday, February 06, 2004 9:08:24 AM
C:\ > _
Vì HostB nm phân đon mng khác cũng được cu hình IP động, do đó ta cn to ra mt DHCP pool th hai vi địa ch
và gateway tương ng cho mng 192.168.3.0/24:
RouterA(config)#ip dhcp pool network-198
RouterA(dhcp-config)#network 192.168.3.0 255.255.255.0
RouterA(dhcp-config)#default-router 192.168.3.1
RouterA(dhcp-config)#dns-server 10.0.0.3
RouterA(dhcp-config)#netbios-name-server 10.0.0.4
RouterA(dhcp-config)#domain-name xyz.net
Cu hình cho DHCP đã hoàn thành, tuy nhiên HostB dùng UDP broadcast để tìm địa ch IP. RouterB li chưa được cu hình
để chuyn tiếp các broadcast này. Để DHCP hot động cho phân đon mng ca routerB, phi cu hình cng giao tiếp
FastEthernet ca RouterB chuyn tiếp các UDP broadcast ti RouterA.
RouterB(config)#interface fastethernet 0/0
RouterB(config-if)#ip helper-address 192.168.1.2
¤ Lnh ip helper-address có th chuyn tiếp nhiu giao thc khác da trên UDP như DNS, BOOTP request. Bn có th ch
định chính xác giao thc chuyn tiếp bng lnh ip forward-protocol udp [port]
4. Ti Host B thc hin release và renew cu hình IP. Kim tra li địa ch IP bng lnh winipcfg hay ipconfig /all
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\vnpro>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\vnpro>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\vnpro>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : phuong
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.1.2
DNS Servers . . . . . . . . . . . : 10.0.0.3
Primary WINS Server . . . . . . . : 10.0.0.4
Lease Obtained . . . . . . . . : Friday, February 06, 2004 9:22:16 AM
Lease Expires . . . . . . . . : Saturday, February 07, 2004 9:22:16AM