华为网络设备-DHCP基础配置实验
作者: 梁文婷 排版: 赖裕鑫 审核: 蔡宗唐
实验拓扑
实验目的
-
掌握DHCP接口地址池的配置方法
-
掌握DHCP全局地址池的配置方法
-
掌握通过DHCP分配静态IP地址的方法
DHCP介绍
动态主机配置协议DHCP是一种用于集中对用户IP地址进行动态管理和配置的技术。即使规模较小的网络,通过DHCP也可以使后续增加网络设备变得简单快捷。
DHCP协议由RFC 2131定义,采用客户端/服务器通信模式,由客户端向服务器提出配置申请,服务器返回客户端分配的配置信息。
DHCP可以提供两种地址分配机制,网络管理员可以根据网络需求为不同的主机选择不同的分配策略。
-
动态分配机制:通过DHCP为主机分配一个有使用期限的IP地址。这种分配机制适用于主机需要临时接入网络或者空闲地址数小于网络主机总数且主机不需要永久连接网络的场景。
-
静态分配机制:网络管理员通过DHCP为指定的主机分配固定的IP地址。相比手工静态配置IP地址,通过DHCP方式静态分配机制避免人工配置发生错误,方便管理员统一维护管理。
实验背景
某企业为了减少IP地址维护的工作量,增加IP地址的利用率,准备在网络内部署DHCP协议。R1和R3为客户端,作为DHCP Client,R2作为DHCP Server为R1和R3分配IP地址。
实验配置
1. 配置思路
-
配置DHCP服务器
-
配置DHCP客户端
2.配置步骤
- R2的配置
system-view
sysname R2
dhcp enable
#开启DHCP功能
interface GigabitEthernet0/0/2
ip address 10.0.23.2 255.255.255.0
dhcp select Global
#开启接口采用全局地址池的DHCP Server功能
quit
interface GigabitEthernet0/0/3
ip address 10.0.12.2 255.255.255.0
dhcp select interface
#开启接口采用地址池的DHCP Server功能
dhcp server dns-list 10.0.12.2
quit
ip pool Globalpool
#配置全局地址池
gateway-list 10.0.23.2
#配置Client出口网关地址
network 10.0.23.0 mask 255.255.255.0
#配置可分配的网段地址
static-bind ip-address 10.0.23.3 mac-address 00e0-fc2a-235f
#将DHCP Server全局地址下的IP地址与接口MAC地址进行绑定
lease day 2 hour 2 minute 0
#配置地址池下的地址租期
dns-list 10.0.23.2
quit
- R1的配置
system-view
sysname R1
dhcp enable
interface GigabitEthernet0/0/3
ip address dhcp-alloc
#配置DHCP Client
quit
- R3的配置
system-view
sysname R3
dhcp enable
interface GigabitEthernet0/0/2
ip address dhcp-alloc
#配置DHCP Client
quit
实验验证
- 查看R1和R3的地址及路由等信息:
<R1>dis ip interface brief
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 9
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 9
Interface IP Address/Mask Physical Protocol
Ethernet0/0/0 unassigned down down
Ethernet0/0/1 unassigned down down
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
GigabitEthernet0/0/3 10.0.12.254/24 up up
NULL0 unassigned up up(s)
Serial0/0/0 unassigned down down
Serial0/0/1 unassigned down down
Serial0/0/2 unassigned down down
Serial0/0/3 unassigned down down
<R1>dis dns server
Type:
D:Dynamic S:Static
No. Type IP Address
1 D 2.12.0.10
No configured ipv6 dns servers.
<R1>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Unr 60 0 D 10.0.12.2 GigabitEthernet
0/0/3
10.0.12.0/24 Direct 0 0 D 10.0.12.254 GigabitEthernet
0/0/3
10.0.12.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/3
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<R3>dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 10.0.23.3/24 up up
NULL0 unassigned up up(s)
<R3>dis dns server
Type:
D:Dynamic S:Static
No. Type IP Address
1 D 2.23.0.10
No configured ipv6 dns servers.
<R3>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Unr 60 0 D 10.0.23.2 GigabitEthernet
0/0/2
10.0.23.0/24 Direct 0 0 D 10.0.23.3 GigabitEthernet
0/0/2
10.0.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.0.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
- 查看R2上的地址分配情况:
<R2>dis ip pool name Globalpool
Pool-name : Globalpoo
Pool-No : 1
Lease : 2 Days 2 Hours 0 Minutes
Domain-name : -
DNS-server0 : 10.0.23.2
NBNS-server0 : -
Netbios-type : -
Position : Local Status : Unlocked
Gateway-0 : 10.0.23.2
Mask : 255.255.255.0
VPN instance : --
-----------------------------------------------------------------------
Start End Total Used Idle(Expired) Conflict Disable
-----------------------------------------------------------------------
10.0.23.1 10.0.23.254 253 1 252(0) 0 0
-----------------------------------------------------------------------