PDA

View Full Version : Cấu hình DHCP relay agent trên Switch layer 3 với Dynagen.



trainingit
15-04-2008, 12:51 PM
- mô hình bài lab:

(PC01-Vlan02 + PC02-Vlan03) <---- SWL3 (DHCP relay agent) --- R1 ----> DHCP server (Windows 2003 server)

R1:
f0/0 : 192.168.5.2 : connect to DHCP server
f1/0: 192.168.4.2 : connect to SWL3

SWL3:
fa0/0: 192.168.4.1: to f1/0 of R1
vlan 2
192.168.2.1
ip helper-address : 192.168.5.1
vlan 3
192.168.3.1
ip helper-address : 192.168.5.1

- cấu hình file .net:


#DHCP relay agent

[localhost]

autostart = false

[[3640]]

[[Router R1]]
model = 3640
image = D:\dynagenlabs\images\c3640-is-mz_120-7_t.bin
ram = 64
console = 2001
slot 0 = NM-1FE-TX
slot 1 = NM-1FE-TX
idlepc = 0x60339240
#connect to physical NIC
f0/0 = NIO_gen_eth:\Device\NPF_{3D184727-39D3-4AE2-A39D-9A383180EB9C}
f1/0 = SWL3 fa0/0

[[Router SWL3]]
model = 3640
image = D:\dynagenlabs\images\c3640-jk9o3s-mz.123-14.T7.extracted.bin
ram = 128
console = 2002
slot 0 = NM-16ESW
idlepc = 0x60530abc
#connect to Loopback adapter 01
fa0/3 = NIO_gen_eth:\Device\NPF_{91BF3234-1244-4397-82FA-1FD5E4086E45}
#connect to Loopback adapter 02
fa0/4 = NIO_gen_eth:\Device\NPF_{E88CA19A-D742-408D-A61C-7B1604CFACE6}

- mô tả:

+ router R1 kết nối với physical NIC của DHCP server : ip 192.168.5.1

+ trên Windows 2003 server tạo 2 scope IP:

lan02 : 192.168.2.10 đến 192.168.2.100, default-router, dns-server và wins-server cùng địa chỉ 192.168.2.1

lan03 : 192.168.3.10 đến 192.168.3.100, default-router, dns-server và wins-server cùng địa chỉ 192.168.3.1

http://img211.imageshack.us/img211/2734/dhcpserverra2.jpg

- tạo 2 card mạng loopback: sử dụng Network device list để lấy ID cho 2 card loopback, dùng Add new hardware trên Windows 2003 server để tạo 2 card loopback.

http://img512.imageshack.us/img512/7834/loopbackqu5.jpg

- cấu hình cho router R1:

R1(config)#int f0/0
R1(config-if)#ip address 192.168.5.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#inf f1/0
R1(config-if)#ip address 192.168.4.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ip route 0.0.0.0 0.0.0.0 192.168.5.1

- cấu hình SWL3:

Router(config)#hostname SWL3
SWL3(config)#exit
SWL3#vlan database
SWL3(vlan)#vlan 2 name lan02
SWL3(vlan)#vlan 3 name lan03
SWL3(vlan)#exit
SWL3#conf t
SWL3(config)#int fa0/3
SWL3(config-if)#switchport mode access
SWL3(config-if)#switchport access vlan 2
SWL3(config)#int fa0/4
SWL3(config-if)#switchport mode access
SWL3(config-if)#switchport access vlan 3
SWL3(config-if)#int fa0/0
SWL3(config-if)#no switchport
SWL3(config-if)#ip address 192.168.4.2 255.255.255.0
SWL3(config-if)#no shut
SWL3(config-if)#int vlan 2
SWL3(config-if)#ip address 192.168.2.1 255.255.255.0
SWL3(config-if)#ip helper-address 192.168.5.1
SWL3(config-if)#int vlan 3
SWL3(config-if)#ip address 192.168.3.1 255.255.255.0
SWL3(config-if)#ip helper-address 192.168.5.1
SWL3(config-if)#exit
SWL3(config)#ip routing
SWL3(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.2
SWL3(config)#end

- trên PC, thực hiện router tới 192.168.4.0

route add -p 192.168.4.0 mask 255.255.255.0 192.168.5.2

- kiểm tra lại lab:

từ cửa sổ command: gõ lệnh ipconfig /all => bạn sẽ thấy 2 card mạng Loopback01 và Loopback02 được gán 2 dải IP khác nhau từ DHCP server, vd

Loopback01:
192.168.2.10
255.255.255.0
192.168.2.1
dns-server
192.168.2.1

Loopback02:
192.168.3.10
255.255.255.0
192.168.3.1
dns-server
192.168.3.1