实验拓朴:
 
 
 
 
 
拓朴说明:
 
此拓朴是用一台路由器做DHCP SERVER ,给所有客户端分配IP地址.
 
实验目的:
 
 
能够让VLAN 2 中的PC 机通过三层交换机上的DHCP 中继功能从VLAN 3 中的路由器上的DHCP SERVER 中得到IP 地址
 
 
实验步骤:
 
 
1.搭环境.
 
Switch1 F0/15   <---->   Switch2 F0/15
Switch2 F0/3    < ---->   Router1 E0/1    (vlan 3)
Switch2 F0/2     <---->   XPC P0/0          (vlan 2,net1)
 
2.  在SW1-3 和 SW2-2 中打开F0/15为中继端口(TRUNK.略)
 
3.  在SW1-3 和 SW2-2 上做VTP,并且,新建VLAN 2,3(略)
 
    SW1-3为VTP  SERVER,并新建VLAN 2 ,3。2
    SW2-2为VTP  CLIENT。
     
4.  在SW1-3和SW2-2中分别测试VLAN是否OK! (略)
      
5.   SW2-2中划接口F0/2到VLAN 2,划接口F0/3到VLAN 3。
 
sw2-2#conf t                           (划分接口到VLAN中)
Enter configuration commands, one per line.  End with CNTL/Z.
sw2-2(config)#interface f0/2
sw2-2(config-if)#switchport access vlan 2
sw2-2(config-if)#switchport mode access        (定义为二层接口
sw2-2(config-if)#no sh
sw2-2(config-if)#exit
sw2-2(config)#interface f0/3
sw2-2(config-if)#switchport access vlan 3
sw2-2(config-if)#switchport mode access
sw2-2(config-if)#no sh
sw2-2(config-if)#exit
sw2-2(config)#exit
sw2-2#
6.sw2-2#show vlan-switch         ( test)
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14
2    v2                               active    Fa0/2
3    v3                               active    Fa0/3
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active   
6.sw1-3(config)#ip  routing          开启三层交换机的路由功能.
    
7.sw1-3(config)#interface vlan 3
sw1-3(config-if)#ip add 192.168.3.254 255.255.255.0
sw1-3(config-if)#no sh
sw1-3(config-if)#exit
    
sw1-3(config)#interface vlan 2
sw1-3(config-if)#ip add 192.168.2.254 255.255.255.0
sw1-3(config-if)#no sh
 
8.sw1-3#show ip in br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    down   
FastEthernet0/1            unassigned      YES unset  up                    down   
FastEthernet0/2            unassigned      YES unset  up                    down   
FastEthernet0/3            unassigned      YES unset  up                    down   
FastEthernet0/4            unassigned      YES unset  up                    down   
FastEthernet0/5            unassigned      YES unset  up                    down   
FastEthernet0/6            unassigned      YES unset  up                    down   
FastEthernet0/7            unassigned      YES unset  up                    down   
FastEthernet0/8            unassigned      YES unset  up                    down   
FastEthernet0/9            unassigned      YES unset  up                    down   
FastEthernet0/10           unassigned      YES unset  up                    down   
FastEthernet0/11           unassigned      YES unset  up                    down   
FastEthernet0/12           unassigned      YES unset  up                    down   
FastEthernet0/13           unassigned      YES unset  up                    down   
FastEthernet0/14           unassigned      YES unset  up                    down   
FastEthernet0/15           unassigned      YES unset  up                    up     
Vlan1                      unassigned      YES unset  up                    up     
Vlan2                      192.168.2.254   YES manual up                    up     
Vlan3                      192.168.3.254   YES manual up                    up

9.  sw1-3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, Vlan2
C    192.168.3.0/24 is directly connected, Vlan3

10.R1(config)#interface e0/1
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#no sh

11.sw1-3#conf t         
Enter configuration commands, one per line.  End with CNTL/Z.
sw1-3(config)#router rip
sw1-3(config-router)#network 192.168.2.0
sw1-3(config-router)#network 192.168.3.0
sw1-3(config-router)#exit
sw1-3(config)#exi

12.Router #show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.3.0/24 is directly connected, Ethernet0/0   
 
r1#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 0 percent (0/5)
 
13.  R1(config)#router rip                      (R1运行RIP)
R1(config-router)#network 192.168.3.0
R1(config-router)#exit
R1(config)#exit
 
14.r1#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.2.0/24 [120/1] via 192.168.3.254, 00:00:14, Ethernet0/0    
C    192.168.3.0/24 is directly connected, Ethernet0/0
 
r1#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 = 32/62/104 ms
 
15. R1 上面做DHCP SERVER。
Router#conf t
Router(config)#ip dhcp pool 192.168.2.0  
Router(dhcp-config)#network 192.168.2.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.2.254
Router(dhcp-config)#dns-server 202.96.128.166 192.168.2.254
 
16.测试没有配置中继之前,客户机能否得到IP 地址.
 
失败.
 
 
17.在三层交换机上配置中继代理.
 
sw1-3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1-3(config)#interface vlan 2
sw1-3(config-if)#ip helper-address 192.168.3.1        {中继}
sw1-3(config)#exit
sw1-3#
 
18.测试中继的配置是否正确.
 
VLAN2中的PC机,向VLAN3中的,以路由器做的DHCP SERVER申请IP地址.
 
配置完成.如有问题,请你多指教.
 
谢谢
michaelfung.