实验3: DHCP 基本配置
实验3-1: DHCP 基本配置
实验目的
通过本实验可以掌握:
(1)DHCP 的工作原理和工作过程
(2)DHCP 服务器的基本配置和调试
(3)客户端配置
拓扑结构
实验步骤
n 步骤1:配置路由器R1 提供DHCP 服务
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config)#service dhcp //开启DHCP 服务
R1(config)#ip dhcp pool liming //定义地址池
R1(dhcp-config)#network 192.168.1.0 /24
//DHCP 服务器要分配的网络和掩码
R1(dhcp-config)#default-router 192.168.1.1
//默认网关,这个地址要和相应网络所连接的路由器的以太口地址相同
R1(dhcp-config)#dns-server 192.168.1.4 //DNS 服务器
R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.5
//排除的地址段
n 步骤2:设置windows 客户端(路由器模拟PC)
Router(config)#host PC2
PC2(config)#no ip routing
PC2(config)#int f0/0
PC2(config-if)#no sh
PC2(config-if)#ip address dhcp
//出现如下提示信息:
*Mar 1 00:53:00.735: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.1.6, mask 255.255.255.0, hostname PC2
Router(config)#host PC3
PC3(config)#no ip routing
PC3(config)#int f0/0
PC3(config-if)#no sh
PC3(config-if)#ip address dhcp
出现如下提示信息:
*Mar 1 00:57:24.779: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.1.7, mask 255.255.255.0, hostname PC2
实验调试
n show ip dhcp pool //该命令用来查看DHCP 地址池的信息。
R1#show ip dhcp pool
Pool liming :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 2
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.1.8 192.168.1.1 - 192.168.1.254 2
//下一个将要分配的地址、地址池的范围以及分配出去的地址的个数
n show ip dhcp binding //该命令用来查看DHCP 的地址绑定情况。
R1#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
192.168.1.6 0063.6973.636f.2d63. Mar 02 2002 12:53 AM Automatic
6330.312e.3134.6530.
2e30.3030.302d.4661.
302f.30
192.168.1.7 0063.6973.636f.2d63. Mar 02 2002 12:57 AM Automatic
6330.322e.3134.6530.
2e30.3030.302d.4661.
DHCP中继
R1:
interface FastEthernet0/0
ip address dhcp
duplex auto
speed auto
R2:
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0
ip helper-address 13.1.1.3
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 13.1.1.1 255.255.255.0
duplex auto
speed auto
!
!
router eigrp 100
network 10.1.1.1 0.0.0.0
network 13.1.1.1 0.0.0.0
no auto-summary
R3
ip dhcp excluded-address 10.1.1.1
!
ip dhcp pool tech
network 10.1.1.0 255.255.255.0
default-router 10.1.1.1
dns-server 100.1.1.1
lease 10
!
interface FastEthernet0/1
ip address 13.1.1.3 255.255.255.0
duplex auto
speed auto
!
!
router eigrp 100
network 13.1.1.3 0.0.0.0
no auto-summary