HCNA实验---配置基于接口地址池的DHCP
DHCP 动态主机配置协议
DHCP协议采用客户端/服务器的方式工作
与DHCP服务器建立连接的****4个阶段
- 发现阶段:DHCP客户端寻找DHCP服务器的阶段,客户端以广播的方式发送DHCP_Discover报文
- 提供阶段:DHCP服务器提供IP地址的阶段,向客户端发送包含出租IP地址和其他设置的DHCP_Offer报文
- 选择阶段:DCHP客户端选择IP地址的阶段,客户端只能接受第一个收到的DHCP_Offer报文,然后以广播方式向各DHCP服务器回应DHCP_Request报文
- 确认阶段:DHCP服务器确认所提供IP地址的阶段,向客户端发送包含它所提供的IP地址和其设置的DHCP_ACK确认报文
配置基于接口地址池的DHCP拓扑图
配置R1路由器
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname DHCP //修改名称
[DHCP]interface GigabitEthernet 0/0/0 //进入接口
[DHCP-GigabitEthernet0/0/0]ip address 192.168.01.254 24 // 设置接口IP地址
May 28 2019 17:55:39-05:13 DHCP %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[DHCP-GigabitEthernet0/0/0]
[DHCP-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1 // 进入接口
[DHCP-GigabitEthernet0/0/1]ip address 192.168.2.254 24 //设置接口IP地址
[DHCP-GigabitEthernet0/0/1]
May 28 2019 17:56:06-05:13 DHCP %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[DHCP-GigabitEthernet0/0/1]quit
[DHCP]dhcp enable //开启dhcp服务
Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCP]interface GigabitEthernet 0/0/0 //进入接口
[DHCP-GigabitEthernet0/0/0]dhcp select interface //开启接口dhcp服务功能,指定从接口地址池分配地址
[DHCP-GigabitEthernet0/0/0]dhcp server lease day 2 //设置服务器接口地址池中IP地址的租用有效期限为2天,默认为1天
[DHCP-GigabitEthernet0/0/0]dhcp server excluded-ip-address 192.168.1.1 192.168.1.10
[DHCP-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[DHCP-GigabitEthernet0/0/1]dhcp select interface
[DHCP-GigabitEthernet0/0/1]dhcp server dns-list 8.8.8.8
清空路由器的所有配置信息