您的位置:首页 > 其它

DHCP的配置综合实验

2010-05-19 20:54 751 查看



这个是拓扑   最上面的那个路由器模拟DHCP服务器,本实验重点是DHCP的配置。  之前我在51CTO上查了下相关实验,关于ip helper-address与vlan一起的实验 不多,于是我自己练习了下  之间遇到了一些问题,下面我来给大家简单讲解下
先贴配置
R5#
%SYS-5-CONFIG_I: Configured from console by console
sh run
Building configuration...
Current configuration : 803 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R5
!
!
!
!
ip dhcp excluded-address 192.168.10.1
ip dhcp excluded-address 192.168.20.1
!
ip dhcp pool 10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
ip dhcp pool 20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
version 2
network 192.168.12.0
no auto-summary
!
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
!
!
!
!
!
!
!
line con 0
R1#sh
% Incomplete command.
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#no ip route 0.0.0.0 0.0.0.0 fa0/0
R1(config)#^Z
R1#
%SYS-5-CONFIG_I: Configured from console by console
sh run
Building configuration...
Current configuration : 761 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
ip dhcp excluded-address 192.168.10.1
ip dhcp excluded-address 192.168.20.1
!
ip dhcp pool 10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
ip dhcp pool 20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
version 2
network 192.168.12.0
no auto-summary
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
 
 
 
R6
Router#
%SYS-5-CONFIG_I: Configured from console by console
sh run
Building configuration...
Current configuration : 835 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
!
interface FastEthernet0/1.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
ip helper-address 192.168.12.1
!
interface FastEthernet0/1.20
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
ip helper-address 192.168.12.1
!
interface Vlan1
no ip address
shutdown
!
router rip
version 2
network 192.168.10.0
network 192.168.12.0
network 192.168.20.0
network 192.168.23.0
no auto-summary
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
 
 
 
 
SW
Switch#sh run
Building configuration...
Current configuration : 1202 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
no ip address
!
interface Vlan20
no ip address
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end
 
 
 



遇到的困难都是PC没能获取到IP  原因如下
1,没有起路由协议   至于为什么要用到路由协议 这个与ip helper add 原理有关(
配置了ip helper-address命令之后的路由器在中继DHCP请求时的工作过程如下:
a,DHCP客户端发送请求,由于没有ip地址,所以自己的源IP地址为0.0.0.0,而且也不知道目的DHCP服务器的地址,所以为广播255.255.255.255。该数据报中当然还包含其他信息,比如二层的信息,源mac地址,和目的mac地址FFFFFFFFFFFF。
b,当路由器接收到该数据报的时候,他就用自己的接口地址(接收到数据报的接口)来取代源地址0.0.0.0,并且用ip help-address 命令中指定的地址

2,没有配ip helper add   我一开始是在R6上的fa0/1配的这个命令 但是没有效果   于是进到子接口配这个命令在获取到Ip
 
如果大家有啥问题 可以留言
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: