DHCP的配置綜合實驗

1

這個是拓撲   最上面的那個路由器模擬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

 

 

 

2

遇到的困難都是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

 

如果大家有啥問題 可以留言

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章