操作篇 DHCP协议学习与应用

前言

DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)是一个局域网网络协议,使用UDP协议工作, 主要有两个用途:给内部网络或网络服务供应商自动分配IP地址,给用户或者内部网络管理员作为对所有计算机作中央管理的手段

一:实验环境

1.1:基本原理

​ # 第一步:客户端通过广播发送DHCP Discover 报文寻找服务器端

​ # 第二步:服务器通过单播发送dhcp向客户端提供ip地址

​ # 第三步:客户端通过广播DHCP Request 报文告知服务器端本地选择IP

​ # 第四步 :服务器通过DHCP Ack报文告知客户端IP地址是合法可用的

1.2:实验目的

​ 通过路由器DHCP自动分配地址

​ 实现不同vlan 主机之间互联互通

1.3 华为DHCP实验拓扑图

在这里插入图片描述

二:实验过程

2.1:交换机sw1设置

<Huawei>sys
Enter system view, return user view with Ctrl+Z.

[Huawei]sysname SW1

[SW1]V B 10 20     
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 10
[SW1-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 20
[SW1-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.
[SW1]int e0/0/3
[SW1-Ethernet0/0/3]p l a
[SW1-Ethernet0/0/3]p d v 10
[SW1-Ethernet0/0/3]un sh
Info: Interface Ethernet0/0/3 is not shutdown.
[SW1]int e0/0/4
[SW1-Ethernet0/0/4]p l a
[SW1-Ethernet0/0/4]p d v 20
[SW1-Ethernet0/0/4]un sh
Info: Interface Ethernet0/0/4 is not shutdown.
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.

2.2路由器R1

[R1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g0/0/1.1
[R1-GigabitEthernet0/0/1.1]dot1q termination  vid 10
[R1-GigabitEthernet0/0/1.1]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1.1]a b e
[R1-GigabitEthernet0/0/1.1]dhcp select relay 
[R1-GigabitEthernet0/0/1.1]dhcp relay server-ip 13.0.0.2
[R1-GigabitEthernet0/0/1.1]un sh
Info: Interface GigabitEthernet0/0/1.1 is not shutdown.
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]
[R1-GigabitEthernet0/0/1.2]dot1q termination  vid 20
[R1-GigabitEthernet0/0/1.2]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1.2]arp broadcast  enable 
[R1-GigabitEthernet0/0/1.2]dhcp select relay 
[R1-GigabitEthernet0/0/1.2]dhcp relay server-ip 13.0.0.2
[R1-GigabitEthernet0/0/1.2]un sh
Info: Interface GigabitEthernet0/0/1.2 is not shutdown.
R1]ip route-static 15.0.0.1 24 12.0.0.2


2.3 路由器R3

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn	
[Huawei]sysname R3
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 13.0.0.2 24
[R3-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R3]ip pool 15
[R3-ip-pool-15]gateway-list 15.0.0.1
[R3-ip-pool-15]network 15.0.0.0 mask 24
[R3-ip-pool-15]dns-list 8.8.8.8 2.2.2.2
[R3]ip pool v10
[R3-ip-pool-v10]network 192.168.10.0 mask 24
[R3-ip-pool-v10]gateway-list 192.168.10.1
[R3-ip-pool-v10]dns-list 8.8.8.8 2.2.2.2
[R3]ip pool v20
[R3-ip-pool-v20]network 192.168.20.0 mask 24
[R3-ip-pool-v20]gateway-list 192.168.20.1
[R3-GigabitEthernet0/0/2]dhcp select global 
[R3-GigabitEthernet0/0/2]un sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R3]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1

2.4路由器R2

<Huawei>sys
[Huawei]sysname R2
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]UN SH
Info: Interface GigabitEthernet0/0/0 is not shutdown.
R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]un sh
[R2-GigabitEthernet0/0/1]dhcp select global 
[R2-GigabitEthernet0/0/1]dhcp relay  server-ip 14.0.0.2
[R2]ip route-static 14.0.0.0 255.255.255.0 12.0.0.1
[R2]ip route-static 192.168.10.0 255.255.255.0 12.0.0.1
[R2]ip route-static 192.168.20.0 255.255.255.0 12.0.0.1




三:实验结果

dhcp分配给每人客户机地址并全网通

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值