实操二:DHCP实验报告
直连路由原理:路由器会自动为直连的网段生成路由条目,因此无需额外配置静态 / 动态路由,即可实现两个直连网段的跨网段通信。DHCP 服务配置要点:必须先全局开启 DHCP 服务,再配置地址池(包含网段、网关、DNS),最后在接口下绑定全局地址池,才能让终端自动获取 IP。跨网段 DNS 解析逻辑:客户端配置的 DNS 服务器可以位于不同网段,只要路由器的路由可达,客户端就能向 DNS 服务器发送解
·
一、实验目的
- 掌握路由器的基础 IP 配置与直连路由原理,实现 192.168.1.0/24 与 192.168.2.0/24 两个网段的跨网段通信。
- 学习华为路由器的 DHCP 服务配置方法,实现终端设备自动获取 IP 地址、网关与 DNS 服务器地址。
- 搭建 DNS 服务器并配置域名解析记录,验证不同网段主机通过域名访问 HTTP 服务的可行性。
- 掌握网络连通性测试(ping)与 DNS 解析验证(nslookup)的方法,排查常见网络故障。
二、实验环境与工具
- 实验平台:华为 eNSP 仿真软件
- 核心设备:华为 AR2220 路由器、S3700 二层交换机、终端 PC、Client 客户端、HTTP 服务器、DNS 服务器
- 配置工具:设备 CLI 命令行、图形化配置界面
三、实验拓扑与设备规划
1. 实验拓扑图

2. 设备 IP 与服务规划表
| 设备类型 | 设备名称 | 接口 / 角色 | IP 地址 | 子网掩码 | 网关 | |
|---|---|---|---|---|---|---|
| 路由器 | AR1 | GE0/0/0(LAN1) | 192.168.1.254/24 | - | - | |
| GE0/0/1(LAN2) | 192.168.2.254/24 | - | - | |||
| DNS 服务器 | DNS1 | - | 192.168.1.5 | 255.255.255.0 | 192.168.1.254 | |
| HTTP 服务器 | HTTP2 | - | 192.168.2.5 | 255.255.255.0 | 192.168.2.254 | |
| 客户端 | Client1 | - | 192.168.1.2 | 255.255.255.0 | 192.168.1.254 | |
| 客户端 | Client2 | - | 192.168.2.2 | 255.255.255.0 | 192.168.2.254 | |
| PC | PC1/PC2 | - | DHCP 自动获取 | - | - |
四、实验步骤
DNS


HTTP


PC


Client


路由器 AR1 基础配置
The device is running!
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR1
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[AR1-GigabitEthernet0/0/0]q
[AR1]interface g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 192.168.2.254 24
[AR1-GigabitEthernet0/0/1]q
[AR1]q
<AR1>display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.254/24 up up
GigabitEthernet0/0/1 192.168.2.254/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
验证结果:GE0/0/0 和 GE0/0/1 接口的 Physical 和 Protocol 状态均为up,说明接口配置正常。
路由器 DHCP 服务配置
<AR1>sys
Enter system view, return user view with Ctrl+Z.
[AR1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[AR1]ip pool a
Info: It's successful to create an IP address pool.
[AR1-ip-pool-a]network 192.168.1.0 mask 24
[AR1-ip-pool-a]gateway-list 192.168.1.254
[AR1-ip-pool-a]dns-list 192.168.1.5
[AR1-ip-pool-a]q
[AR1]ip pool b
Info: It's successful to create an IP address pool.
[AR1-ip-pool-b]network 192.168.2.0 mask 24
[AR1-ip-pool-b]gateway-list 192.168.2.254
[AR1-ip-pool-b]dns-list 192.168.1.5
[AR1-ip-pool-b]q
[AR1]ip pool a
[AR1-ip-pool-a]display this
[V200R003C00]
#
ip pool a
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
dns-list 192.168.1.5
#
return
[AR1-ip-pool-a]q
[AR1]ip pool b
[AR1-ip-pool-b]display this
[V200R003C00]
#
ip pool b
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
dns-list 192.168.1.5
#
return
[AR1-ip-pool-b]q
[AR1]display current-configuration
[V200R003C00]
#
sysname AR1
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
dhcp enable
#
ip pool a
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
dns-list 192.168.1.5
#
ip pool b
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
dns-list 192.168.1.5
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]dhcp select global
[AR1-GigabitEthernet0/0/0]q
[AR1]interface g0/0/1
[AR1-GigabitEthernet0/0/1]dhcp select global
[AR1-GigabitEthernet0/0/1]q
五、实验结果与分析
1. 核心测试结果汇总


2. 关键配置验证
- 路由器
display ip interface brief显示两个 LAN 接口均为up/up状态,直连路由自动生成,无需额外配置静态路由即可实现跨网段通信。 - DHCP 地址池配置正确,
display ip pool可查看地址分配情况,PC1、PC2 成功获取 IP 地址,说明dhcp select global绑定生效。 - DNS 服务器记录配置正确,客户端解析域名时,可通过路由器跨网段访问 192.168.1.5,返回正确的 HTTP 服务器 IP 地址。
3. 故障排查与解决
- 问题 1:Client2 无法访问 DNS 服务器,提示 “请求超时”。解决:检查 HTTP2 和 Client2 的 DNS 配置,发现 DNS 服务器地址填写错误,修正为
192.168.1.5后恢复正常。 - 问题 2:PC1 无法通过 DHCP 获取 IP 地址。解决:检查路由器接口配置,发现 GE0/0/0 接口未配置
dhcp select global,绑定地址池后 PC1 成功获取 IP。 -
六、实验总结
本次实验成功完成了路由器 IP 配置、DHCP 服务部署、跨网段通信与 DNS 解析测试,核心收获如下:
- 直连路由原理:路由器会自动为直连的网段生成路由条目,因此无需额外配置静态 / 动态路由,即可实现两个直连网段的跨网段通信。
- DHCP 服务配置要点:必须先全局开启 DHCP 服务,再配置地址池(包含网段、网关、DNS),最后在接口下绑定全局地址池,才能让终端自动获取 IP。
- 跨网段 DNS 解析逻辑:客户端配置的 DNS 服务器可以位于不同网段,只要路由器的路由可达,客户端就能向 DNS 服务器发送解析请求,获取目标域名对应的 IP 地址。
- 故障排查流程:网络故障排查应遵循 “物理连接→接口状态→IP / 网关配置→路由 / 服务配置→终端配置” 的顺序,逐步定位问题点。
七、实验拓展思考
- 若要实现互联网访问,需在 AR1 上配置 NAT 地址转换,将私网 IP 转换为公网 IP,同时配置默认路由指向运营商网关。
- 可在网络中部署备用 DNS 服务器,提升域名解析的可靠性,客户端配置双 DNS 地址,主服务器故障时自动切换至备用服务器。
- 可在 HTTP 服务器上配置多个虚拟主机,通过不同域名访问不同的网站目录,进一步理解 HTTP 虚拟主机的工作原理。
更多推荐
所有评论(0)