• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C S9800系列交换机 典型配置举例-6W101

09-DHCP Snooping典型配置举例

本章节下载 09-DHCP Snooping典型配置举例  (168.01 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S9800/S9800/Configure/Typical_Configuration_Example/H3C_S9800_CE-6W101/201706/997343_30005_0.htm

09-DHCP Snooping典型配置举例

H3C S9800 DHCP Snooping典型配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2017 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,

并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。

H3C_彩色.emf

 



1  简介

本文档介绍了DHCP Snooping相关应用的配置举例。

2  配置前提

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文假设您已了解DHCP相关特性。

3  DHCP Snooping配置举例

3.1  组网需求

图1所示,某科研机构有三个项目组,分布在不同的楼层中,通过楼层间的DHCP Snooping设备与DHCP Server相连。

为了方便管理,希望通过DHCP服务器统一分配IP地址,同时要求:

·     根据项目组的规模,分配不同范围的IP地址,为group1分配192.168.0.2~192.168.0.39之间的IP地址,为group2分配192.168.0.40~192.168.0.99之间的IP地址,为group3分配192.168.0.100~192.168.0.200之间的IP地址;

·     保证客户端从合法的服务器获取IP地址;

·     禁止用户通过配置静态IP地址的方式接入网络。

图1 DHCP Snooping配置组网图

 

3.2  配置思路

·     在多个DHCP Snooping设备级联的网络中,为了节省系统资源,不需要每台DHCP Snooping设备都记录所有DHCP客户端的IP地址和MAC地址的绑定信息,只需在与客户端直接相连的不信任端口上记录绑定信息。间接与DHCP客户端相连的不信任端口不需要记录IP地址和MAC地址绑定信息,需要配置绑定关系的不信任端口,请参见图2中所示。

·     在DHCP Snooping设备上指向合法的DHCP服务器方向的端口需要设置为信任端口,以便DHCP Snooping设备正常转发DHCP服务器的应答报文,保证DHCP客户端能够从合法的DHCP服务器获取IP地址,具体需要配置为信任端口的端口,请参见图2中所示。

图2 信任端口和非信任端口

 

·     为防止非法用户通过配置静态IP地址的方式接入网络,在用户所在VLAN内启用ARP Detection功能(本例为缺省VLAN 1内),基于DHCP Snooping表项对用户进行合法性检查,保证合法用户可以正常转发报文。

·     配置DHCP Snooping支持Option82功能,并在DHCP服务器上配置根据Option82的分配策略,从而实现为每个区域分配特定范围内的IP地址。

3.3  使用版本

本举例是在S9800-CMW710-R2118版本上进行配置和验证的软件版本。

3.4  配置步骤

1. Device A的配置

# 使能DHCP Snooping功能。

<DeviceA> system-view

[DeviceA] dhcp snooping enable

# 在Ten-GigabitEthernet1/0/1上启用DHCP Snooping表项记录功能。

[DeviceA] interface Ten-GigabitEthernet 1/0/1

[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping binding record

# 为使Option 82功能正常使用,需要在DHCP服务器和DHCP Snooping上都进行相应配置。如下为DHCP Snooping上的相关配置:

# 在Ten-GigabitEthernet1/0/1上配置DHCP Snooping支持Option 82功能,并配置Circuit ID填充内容为group1。

[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping information enable

[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping information circuit-id string group1

[DeviceA-Ten-GigabitEthernet1/0/1] quit

# 配置Ten-GigabitEthernet1/0/2端口为信任端口。

[DeviceA] interface Ten-GigabitEthernet 1/0/2

[DeviceA-Ten-GigabitEthernet1/0/2] dhcp snooping trust

[DeviceA-Ten-GigabitEthernet1/0/2] quit

# 使能ARP Detection功能,对用户合法性进行检查。

[DeviceA] vlan 1

[DeviceA-vlan1] arp detection enable

[DeviceA-vlan1] quit

# 端口状态缺省为非信任状态,上行端口配置为信任状态,下行端口按缺省配置。

[DeviceA] interface Ten-GigabitEthernet 1/0/2

[DeviceA-Ten-GigabitEthernet1/0/2] arp detection trust

[DeviceA-Ten-GigabitEthernet1/0/2] quit

2. Device B的配置

# 使能DHCP Snooping功能。

<DeviceB> system-view

[DeviceB] dhcp snooping enable

# 在Ten-GigabitEthernet1/0/1上启用DHCP Snooping表项记录功能。

[DeviceB] interface Ten-GigabitEthernet 1/0/1

[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping binding record

# 为使Option 82功能正常使用,需要在DHCP服务器和DHCP Snooping上都进行相应配置。如下为DHCP Snooping上的相关配置:

# 在Ten-GigabitEthernet1/0/1上配置DHCP Snooping支持Option 82功能,并配置Circuit ID填充内容为group2。

[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping information enable

[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping information circuit-id string group2

[DeviceB-Ten-GigabitEthernet1/0/1] quit

# 配置Ten-GigabitEthernet1/0/2端口为信任端口。

[DeviceB] interface Ten-GigabitEthernet 1/0/2

[DeviceB-Ten-GigabitEthernet1/0/2] dhcp snooping trust

[DeviceB-Ten-GigabitEthernet1/0/2] quit

# 在Ten-GigabitEthernet1/0/3上启用DHCP Snooping表项记录功能。

[DeviceB] interface Ten-GigabitEthernet 1/0/3

[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping binding record

# 为使Option 82功能正常使用,需要在DHCP服务器和DHCP Snooping上都进行相应配置。如下为DHCP Snooping上的相关配置:

# 在Ten-GigabitEthernet1/0/3上配置DHCP Snooping支持Option 82功能,并配置Circuit ID填充内容为group3。

[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping information enable

[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping information circuit-id string group3

[DeviceB-Ten-GigabitEthernet1/0/3] quit

# 使能ARP Detection功能,对用户合法性进行检查。

[DeviceB] vlan 1

[DeviceB-vlan1] arp detection enable

[DeviceB-vlan1] quit

# 端口状态缺省为非信任状态,上行端口配置为信任状态,下行端口按缺省配置。

[DeviceB] interface Ten-GigabitEthernet 1/0/2

[DeviceB-Ten-GigabitEthernet1/0/2] arp detection trust

[DeviceB-Ten-GigabitEthernet1/0/2] quit

3. Device C的配置

# 使能DHCP Snooping功能。

<DeviceC> system-view

[DeviceC] dhcp snooping enable

# 配置Ten-GigabitEthernet1/0/2端口为信任端口。

[DeviceC] interface Ten-GigabitEthernet 1/0/2

[DeviceC-Ten-GigabitEthernet1/0/2] dhcp snooping trust

[DeviceC-Ten-GigabitEthernet1/0/2] quit

4. Device D的配置

# 配置VLAN接口2的IP地址。

<DeviceD> system-view

[DeviceD] vlan 2

[DeviceD-vlan2] port Ten-GigabitEthernet 1/0/1

[DeviceD-vlan2] quit

[DeviceD] interface Vlan-interface 2

[DeviceD-Vlan-interface2] ip address 192.168.0.1 24

[DeviceD-Vlan-interface2] quit

# 使能DHCP服务。

[DeviceD] dhcp enable

# 配置VLAN接口2工作在DHCP服务器模式。

[DeviceD] interface vlan-interface 2

[DeviceD-Vlan-interface2] dhcp select server

[DeviceD-Vlan-interface2] quit

# 为使Option 82功能正常使用,需要在DHCP服务器和DHCP中继上都进行相应配置。如下为DHCP服务器上的相关配置:

# 创建DHCP用户类group1,匹配请求报文中包含Option 82选项,并且该选项的第3字节到第8字节为0x67726F757031(表示Circuit ID子选项内容为group1)的客户端。

[DeviceD] dhcp class group1

[DeviceD-dhcp-class-group1] if-match option 82 hex 67726F757031 offset 2 length 6

[DeviceD-dhcp-class-group1] quit

# 创建DHCP用户类group2,匹配请求报文中包含Option 82选项,并且该选项的第3字节到第8字节为0x67726F757032(表示Circuit ID子选项内容为group2)的客户端。

[DeviceD] dhcp class group2

[DeviceD-dhcp-class-group2] if-match option 82 hex 67726F757032 offset 2 length 6

[DeviceD-dhcp-class-group2] quit

# 创建DHCP用户类group3,匹配请求报文中包含Option 82选项,并且该选项的第3字节到第8字节为0x67726F757033(表示Circuit ID子选项内容为group3)的客户端。

[DeviceD] dhcp class group3

[DeviceD-dhcp-class-group3] if-match option 82 hex 67726F757033 offset 2 length 6

[DeviceD-dhcp-class-group3] quit

# 配置DHCP地址池1。

[DeviceD] dhcp server ip-pool 1

# 配置地址池动态分配的主网段。

[DeviceD-dhcp-pool-1] network 192.168.0.0 mask 255.255.255.0

# 配置DHCP地址池为DHCP用户类group1动态分配的IP地址范围。

[DeviceD-dhcp-pool-1] class group1 range 192.168.0.2 192.168.0.39

# 配置DHCP地址池为DHCP用户类group2动态分配的IP地址范围。

[DeviceD-dhcp-pool-1] class group2 range 192.168.0.40 192.168.0.99

# 配置DHCP地址池为DHCP用户类group3动态分配的IP地址范围。

[DeviceD-dhcp-pool-1] class group3 range 192.168.0.100 192.168.0.200

# 配置VLAN接口2引用地址池1。

[DeviceD] interface Vlan-interface 2

[DeviceD-Vlan-interface2] dhcp server apply ip-pool 1

[DeviceD-Vlan-interface2] quit

3.5  验证配置

# group2中的某一用户PC上输入如下命令,可查看申请到的IP地址。按照同样的方式,可以确认group 1 group 3中的用户也得到指定范围内的地址。

C:\Documents and Settings\Administrator>ipconfig

 

Windows IP Configuration

 

 

Ethernet adapter bb:

 

   Connection-specific DNS Suffix  . :

   IP Address. . . . . . . . . . . . : 192.168.0.44

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . :

# 假设group2里的非法用户配置了一个192.168.0.66IP地址,会发现无法访问外部网络。

3.6  配置文件

·     Device A

#

 dhcp snooping enable

#

vlan 1

 arp detection enable

#

interface Ten-GigabitEthernet1/0/1

 dhcp snooping binding record

 dhcp snooping information enable

 dhcp snooping information circuit-id string group1

#

interface Ten-GigabitEthernet1/0/2

 arp detection trust

 dhcp snooping trust

#

·     Device B

#

 dhcp snooping enable

#

vlan 1

 arp detection enable

#

interface Ten-GigabitEthernet1/0/1

 dhcp snooping binding record

 dhcp snooping information enable

 dhcp snooping information circuit-id string group2

#

interface Ten-GigabitEthernet1/0/2

 arp detection trust

 dhcp snooping trust

#

interface Ten-GigabitEthernet1/0/3

 dhcp snooping binding record

 dhcp snooping information enable

 dhcp snooping information circuit-id string group3

#

·     Device C

#

 dhcp snooping enable

#

interface Ten-GigabitEthernet1/0/2

 dhcp snooping trust

#

·     Device D

#

 dhcp enable

#

vlan 2

#

dhcp class group1

 if-match option 82 hex 67726f757031 offset 2 length 6

#

dhcp class group2

 if-match option 82 hex 67726f757032 offset 2 length 6

#

dhcp class group3

 if-match option 82 hex 67726f757033 offset 2 length 6

#

dhcp server ip-pool 1

 network 192.168.0.0 mask 255.255.255.0

 class group1 range 192.168.0.2 192.168.0.39

 class group2 range 192.168.0.40 192.168.0.99

 class group3 range 192.168.0.100 192.168.0.200

#

interface Vlan-interface2

 ip address 192.168.0.1 255.255.255.0

 dhcp server apply ip-pool 1

#

4  相关资料

·     H3C S9800系列交换机 三层技术-IP业务配置指导-R2117[R2118]

·     H3C S9800系列交换机 三层技术-IP业务命令参考-R2117[R2118]

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们