数通学习笔记--- dhcp配置(华为S5700,接口地址池)

DHCP服务器简介

组网需求:

配置思路:

基于接口地址池的DHCP服务器的配置思路:

通过在网关设备switch上配置DHCP服务器,实现为企业两个网段内的终端动态分配IP地址。其中,网段10.1.1.0/24内的PC为员工固定办公终端,IP地址租期配置为30天;网段10.1.2.0/24供企业出差人员临时接入网络,IP地址租期配置为1天。

操作步骤:

1.使能DHCP服务,缺省情况未使能

<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] dhcp enable

2.配置接口加入VLAN

# 配置GE0/0/1接口加入VLAN10。

[Switch] vlan batch 10 to 11
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type access
[Switch-GigabitEthernet0/0/1] port default vlan 10
[Switch-GigabitEthernet0/0/1] quit

# 配置GE0/0/2加接口入VLAN11。

[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] port link-type access
[Switch-GigabitEthernet0/0/2] port default vlan 11
[Switch-GigabitEthernet0/0/2] quit

3.配置VLANIF接口IP地址

# 配置VLANIF10接口地址。

[Switch] interface vlanif 10
[Switch-Vlanif10] ip address 10.1.1.1 24  //企业为固定办公终端的网段
[Switch-Vlanif10] quit

# 配置VLANIF11接口地址。

[Switch] interface vlanif 11
[Switch-Vlanif11] ip address 10.1.2.1 24  //企业为出差人员分配的网段
[Switch-Vlanif11] quit

4.配置接口地址池

# 配置VLANIF10接口下的终端从接口地址池中获取IP地址。

[Switch] interface vlanif 10
[Switch-Vlanif10] dhcp select interface  //使能接口采用接口地址池的DHCP服务器功能,缺省未使能
[Switch-Vlanif10] dhcp server lease day 30  //租期的缺省值为1天,修改租期为30天
[Switch-Vlanif10] dhcp server static-bind ip-address 10.1.1.100 mac-address 286e-d488-b684  //为Client_1分配固定的IP地址
[Switch-Vlanif10] quit

# 配置VLANIF11接口下的终端从接口地址池中获取IP地址。租期采用缺省值1天(不需配置)。

[Switch] interface vlanif 11
[Switch-Vlanif11] dhcp select interface  //使能接口采用接口地址池的DHCP服务器功能,缺省未使能
[Switch-Vlanif11] quit

5. 配置DHCP数据保存功能

设备发生故障时,可以在系统重启后,执行dhcp server database recover ,从存储设备文件恢复DHCP数据。

[Switch] dhcp server database enable

6.配置各终端自动获取IP地址

7.验证配置结果

在Switch上执行命令display ip pool查看接口地址池VLANIF10和VLANIF11的配置信息。假设企业员工固定办公终端有100个,出差人员接入3个。

[Switch] display ip pool interface vlanif10
  Pool-name        : Vlanif10
  Pool-No          : 0
  Lease            : 30 Days 0 Hours 0 Minutes
  Domain-name      : -
  DNS-server0      : -
  NBNS-server0     : -
  Netbios-type     : -
  Position         : Interface       Status             : Unlocked
  Gateway-0        : 10.1.1.1
  Network          : 10.1.1.0
  Mask             : 255.255.255.0
  VPN instance     : --
  Logging          : Disable
  Conflicted address recycle interval: -
  Address Statistic: Total       :253       Used        :100
                     Idle        :153       Expired     :0
                     Conflict    :0         Disable     :0

 -------------------------------------------------------------------------------
  Network section
         Start           End       Total    Used Idle(Expired) Conflict Disabled
 -------------------------------------------------------------------------------
        10.1.1.1      10.1.1.254     253     100        153(0)       0     0
 -------------------------------------------------------------------------------
[Switch] display ip pool interface vlanif11
  Pool-name        : Vlanif11
  Pool-No          : 1
  Lease            : 1 Days 0 Hours 0 Minutes
  Domain-name      : -
  DNS-server0      : -
  NBNS-server0     : -
  Netbios-type     : -
  Position         : Interface       Status             : Unlocked
  Gateway-0        : 10.1.2.1
  Network          : 10.1.2.0
  Mask             : 255.255.255.0
  VPN instance     : --
  Logging          : Disable
  Conflicted address recycle interval: -
  Address Statistic: Total       :253       Used        :3
                     Idle        :250       Expired     :0
                     Conflict    :0         Disable     :0

 -------------------------------------------------------------------------------
  Network section
         Start           End       Total    Used Idle(Expired) Conflict Disabled
 -------------------------------------------------------------------------------
        10.1.2.1      10.1.2.254     253     3          250(0)       0     0
 -------------------------------------------------------------------------------

在Client_1(操作系统以Windows 7为例)上查看IP地址信息,可以看到Client_1已经获取到IP地址10.1.1.100/24。

C:\Documents and Settings\Administrator>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 10.1.1.100
   Subnet Mask . . . . . . . . . . . : 255.255.254.0
   Default Gateway . . . . . . . . . : 10.1.1.1

在其他DHCP客户端(以10.1.1.0/24网段中操作系统为Windows 7的某终端为例)上查看IP地址信息,可以看到已经成功获取到IP地址。

C:\Documents and Settings\Administrator>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 10.1.1.51
   Subnet Mask . . . . . . . . . . . : 255.255.254.0
   Default Gateway . . . . . . . . . : 10.1.1.1
  • 24
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值