1、DHCP(Dynamic Host Configuration Protocol)动态主机配置协议
协议:UDP
1)为终端设备指派IP地址的方式
a,手动配置
b,DHCP
2)DHCP特点
DHCP是一个client server的模型
DHCP服务器可以分发IP地址和相应的参数配置
DHCP客户端请求IP地址和相关配置
3)DHCP指派IP地址的方式
Automoatic allocation(默认):一个永久的IP地址分配给客户端(前提是客户端不关机断电)
Dynamic allocation:客户端是在有限的时间内分配一个IP地址
Manual allocation:客户端通过网管人员分配一个IP地址
2
)
DHCP
特点
• DHCP是一个client‐server的模型
• DHCP服务器可以分发IP地址和相应的参数配置
• DHCP客户端请求IP地址和相关配置
4
)
DHCP
消息类型(主要)
协议:
UDP
端口:客户端(
68
)、服务器(
67
)
a
,
discover(广播)
b,offer(单播)
c
,
request(广播)
d
,
Ack(单播)
5
)
DHCP
基本配置
拓扑:
需求:
a
,内网设备
R1/R2
通过
DHCP
的方式由
GW
获取
IP
地址以及相关的参数
b
,
GW
作为
DHCP
的
server
E0/0:192.168.1.100
pool:192.168.1.1-192.168.1.254
DNS:8.8.8.8
domain-name:xh.com
GW:192.168.1.100
排除:
192.168.1.100
配置:
*******************************GW.R3***********************
!
interface Ethernet0/0
ip address 192.168.1.100 255.255.255.0
!
interface Ethernet0/1
ip address 202.100.1.100 255.255.255.0
!
ip dhcp excluded-address 192.168.1.100 --
-在地址池中排除
!
ip dhcp pool
LAN ---创建DHCP地址池名字为LAN
network 192.168.1.0 255.255.255.0 ---配置地址池范围以及掩码
default-router 192.168.1.100 ----配置网关
dns-server 8.8.8.8 ---配置DNS服务器
domain-name xh.com ---配置域名服务器
!
*************************In.R1********************
!
interface Ethernet0/0
ip address
dhcp
!
In.R1#
sh ip route
Default gateway is 192.168.1.100
Host Gateway Last Use Total Uses Interface
ICMP redirect cache is empty
********************
查看
DHCP
状态
***********************
作业:
1
,理解
DHCP
工作原理
a
,重要的
4
个消息类型
2
,简单的
DHCP
实验(拓扑自定义)