配置DHCP服务器支持相同MAC不同VLAN的用户上线示例

介绍一个以太网用户通过不同VLAN向DHCP服务器申请IP地址示例(无中继设备),结合配置组网图来理解业务的配置过程。

组网需求

VOIP、IPTV等多种业务在不同的用户平面内需要申请不同网段的IP地址。而支持这些业务的DHCP Client会使用一个MAC地址去申请不同网段的IP地址,并基于VLAN ID区分不同的业务。这就要求DHCP服务器支持为相同的MAC不同VLAN的用户分配IP地址。

图1所示,配置DHCP服务器为DHCP Client动态分配IP地址。当DHCP服务器收到的用户报文的Tag为100时,通过网关地址10.10.10.1/24选择pool1地址池;当DHCP服务器收到的用户报文的Tag为200时,通过网关地址10.10.20.1/24选择pool2地址池。

配置DHCP服务器支持相同MAC不同VLAN的用户上线示例

目前DHCP服务器只支持通过不同地址池为相同MAC地址的用户分配地址。

图1 配置DHCP服务器支持相同MAC不同VLAN的用户上线组网图

配置DHCP服务器支持相同MAC不同VLAN的用户上线示例

本例中Interface1代表10GE1/0/1。

配置DHCP服务器支持相同MAC不同VLAN的用户上线示例

配置思路

DHCP服务器的配置思路如下:

  1. 配置用户上线接口的IP地址。
  2. 配置地址池的网关地址和地址段。
  3. 配置三层子接口。

数据准备

完成此配置举例,需要准备以下数据:

  • 用户上线接口的IP地址。
  • 网关地址。
  • 地址段编号及范围。

操作步骤

  1. 配置用户上线接口的IP地址并使能接口的dhcp server功能 
    <HUAWEI> system-view
    [~HUAWEI] sysname DHCP Server
    [*HUAWEI] commit
    [~DHCP Server] interface 10ge 1/0/1
    [~DHCP Server-10GE1/0/1] undo portswitch
    [*DHCP Server-10GE1/0/1] ip address 10.1.1.1 255.255.255.0
    [*DHCP Server-10GE1/0/1] dhcp server enable
    [*DHCP Server-10GE1/0/1] commit
    [~DHCP Server-10GE1/0/1] quit

     

  2. 配置地址池的网关地址和地址段 

    # 配置地址池pool1。

    [~DHCP Server] dhcp enable
    [*DHCP Server] ip pool pool1
    [*DHCP Server-ip-pool-pool1] gateway-list 10.10.10.1
    [*DHCP Server-ip-pool-pool1] network 10.10.10.0 mask 24
    [*DHCP Server-ip-pool-pool1] commit
    [~DHCP Server-ip-pool-pool1] quit

    # 配置地址池pool2。

    [~DHCP Server] ip pool pool2
    [*DHCP Server-ip-pool-pool2] gateway-list 10.10.20.1
    [*DHCP Server-ip-pool-pool2] network 10.10.20.0 mask 24
    [*DHCP Server-ip-pool-pool2] commit
    [~DHCP Server-ip-pool-pool2] quit

     

  3. 配置三层子接口(以Dot1q终结子接口为例)并使能接口的dhcp server功能 
    [~DHCP Server] interface 10ge 1/0/1.1
    [*DHCP Server-10GE1/0/1.1] ip address 10.10.10.1 255.255.255.0
    [*DHCP Server-10GE1/0/1.1] dot1q termination vid 100
    [*DHCP Server-10GE1/0/1.1] dhcp server enable
    [*DHCP Server-10GE1/0/1.1] commit
    [~DHCP Server-10GE1/0/1.1] quit
    [~DHCP Server] interface 10ge 1/0/1.2
    [*DHCP Server-10GE1/0/1.2] ip address 10.10.20.1 255.255.255.0
    [*DHCP Server-10GE1/0/1.2] dhcp server enable
    [*DHCP Server-10GE1/0/1.2] dot1q termination vid 200
    [*DHCP Server-10GE1/0/1.2] commit
    [~DHCP Server-10GE1/0/1.2] quit

     

  4. 验证配置结果 

    # 在DHCP服务器上使用display ip pool命令用来查看IP地址池配置情况。

    [~DHCP Server] display ip pool name pool1
      Pool name      : pool1
      Pool number    : 0
      Lease          : 1 Days 0 Hours 0 Minutes
      Next server    : --
      Domain name    : --
      DNS server     : --
      NBNS server    : --
      Netbios type   : --
      Position       : Local
      Status         : Unlocked
      Gateway        : 10.10.10.1
      Mask           : 255.255.255.0
      VPN instance   : --
     -----------------------------------------------------------------------------
     Start           End             Total  Used  Idle(Expired)  Conflict  Disable
     -----------------------------------------------------------------------------
     10.10.10.1      10.10.10.254      253     0         253(0)         0        0
     -----------------------------------------------------------------------------
    [~DHCP Server] display ip pool name pool2
      Pool name      : pool2
      Pool number    : 1
      Lease          : 1 Days 0 Hours 0 Minutes
      Next server    : --
      Domain name    : --
      DNS server     : --
      NBNS server    : --
      Netbios type   : --
      Position       : Local
      Status         : Unlocked
      Gateway        : 10.10.20.1
      Mask           : 255.255.255.0
      VPN instance   : --
     -----------------------------------------------------------------------------
     Start           End             Total  Used  Idle(Expired)  Conflict  Disable
     -----------------------------------------------------------------------------
     10.10.20.1      10.10.20.254      253     0         253(0)         0        0
     -----------------------------------------------------------------------------

     

配置文件

DHCP Server的配置文件

#
sysname DHCP Server
#
dhcp enable
#
ip pool pool1
 gateway-list 10.10.10.1   
 network 10.10.10.0 mask 255.255.255.0
#
ip pool pool2
 gateway-list 10.10.20.1   
 network 10.10.20.0 mask 255.255.255.0
#
interface 10GE1/0/1
 undo portswitch
 ip address 10.1.1.1 255.255.255.0
 dhcp server enable
#
interface 10GE1/0/1.1
 ip address 10.10.10.1 255.255.255.0
 dot1q termination vid 100
 dhcp server enable
#
interface 10GE1/0/1.2
 ip address 10.10.20.1 255.255.255.0
 dot1q termination vid 200
 dhcp server enable
#
return
阅读剩余
THE END