一分钟教你配置DHCP服务,超级简单一看就会!!!!!

 DHCP

C/S架构

Client (UDP 68) /Server(UDP 67)

1,客户端首次获取IP

4个过程

2,客户端第二次获取IP

2个过程

DHCP工作流程图

DHCP DISCOVER(广播)

DHCP OFFER(单播或广播)

DHCP REQUEST(广播)

租期—1 day

T1时间… 租期的50% — 12小时

续租:使用单播的形式发送DHCP-Resquest

T2时间… 租期的87.5% ― 21小时

续租:使用广播的形式发送DHCP-Resquest

DHCP-Release — DHCP客户端主动释放IP地址使用的数据包

 拓扑图

 基本步骤

1,首先要分析pc都需要啥?(ip,子网掩码,网关

2,其次要配置接口ip(g/0/0/0, g0/0/1),并将其当做为pc的网关

3,在路由器上打开dhcp服务(dhcp enable)

4,创建IP池

5,配置IP池(IP地址,子网掩码,网关)

6,接口上选择全局配置

7,pc端打开dhcp并且应用

ipconfig进行查看即可

 R2配置代码

改名就不用说了

<Huawei>sys

[Huawei]sys r2 

开启路由器的dhcp服务

[r2]dhcp enable 

Info: The operation may take a few seconds. Please wait for a moment.done.

[r2]dhcp enable

创建ip池

[r2]ip pool 1

Info: It's successful to create an IP address pool.

[-ip-pool-1]network 192.168.1.0 mask 24 ——配置ip池的范围,以及掩码

[r2-ip-pool-1]gateway-list 192.168.1.1——配置网关地址(地址与出接口地址一致)

[r2-ip-pool-1]dns-list 114.114.114.114 8.8.8.8——配置dns服务器地址(由于这里没有电dns服务器所以就随便写了两个,前边首选,后边备选)

进入接口,配置出接口ip地址

[r2]int g 0/0/0                                    

[r2-GigabitEthernet0/0/0]ip add 192.168.1.1 24

Feb 27 2023 20:20:54-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 

on the interface GigabitEthernet0/0/0 has entered the UP state. 

[r2-GigabitEthernet0/0/0]dis this

[V200R003C00]

#

interface GigabitEthernet0/0/0

 ip address 192.168.1.1 255.255.255.0 

#

并且打开出接口的dhcp全局配置

[r2-GigabitEthernet0/0/0]dhcp select global 

[r2-GigabitEthernet0/0/0]int g 0/0/1

配置0/0/0接口ip地址

[r2-GigabitEthernet0/0/1]ip add 192.168.2.1 24

[r2-GigabitEthernet0/0/1]dis this——不放心了可以查看一下

[V200R003C00]

#

interface GigabitEthernet0/0/1

 ip address 192.168.2.1 255.255.255.0 

R3配置代码

R3配置基本和R2一致,所以就省略文字了。

<Huawei>sys

[Huawei]sys r3

[r3]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[r3]dhcp enable

[r3]ip pool 2

[r3-ip-pool-2]network 192.168.3.0 mask 24

[r3-ip-pool-2]gateway-list 192.168.3.1         

[r3-ip-pool-2]dns-list 114.114.114.114 8.8.8.8

[r3]int g 0/0/0

[r3-GigabitEthernet0/0/0]dhcp select global

[r3-GigabitEthernet0/0/0]ip add 192.168.3.1 24

[r3]int g0/0/1

[r3-GigabitEthernet0/0/1]ip add 192.168.2.2 24

Feb 27 2023 20:28:06-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP

on the interface GigabitEthernet0/0/1 has entered the UP state. 

猜你喜欢

转载自blog.csdn.net/MA463841740/article/details/129249450