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

DHCP Snooping Option 82配置举例

DHCP Snooping Option 82配置举例

关键词:DHCP snoopingDHCP serverOption 82

    要:本文主要介绍DHCP Snooping Option 82的应用环境及其典型配置。

缩略语:

缩略语

英文全名

中文解释

DHCP

Dynamic Host Configuration Protocol

动态主机配置协议

DNS

Domain Name System

域名系统

Circuit ID

Circuit identification

电路标志,Option 82的子选项1

giaddr

Gateway IP address

网关地址

Remote ID

Remote identification

远端标志,Option 82的子选项2

WINS

Windows Internet Naming Service

Windows Internet名称服务

 



特性简介

Option 82称为中继代理信息选项,该选项记录了DHCP client的位置信息。DHCP snooping设备通过在DHCP请求报文中添加Option 82,将DHCP client的位置信息告诉给DHCP server,从而使得DHCP server能够为主机分配合适的IP地址和其他配置信息,并实现对客户端的安全和计费等控制。

应用场合

图1  Option 82应用举例

DHCP server通常根据请求报文中的giaddr或接收到请求报文的接口IP地址,为客户端分配IP地址。在1 中,DHCP服务器根据主机所在的网段,选取地址分配给Host AHost B

如果希望连接Ethernet1/2端口的客户端地址在某一范围,连接Ethernet1/3端口的客户端地址在另一范围,传统的地址分配方式是无法实现的。利用Option 82DHCP服务器根据客户端连接的DHCP snooping端口和giaddr地址来为客户端分配合适的IP地址,这样就可以满足上述需求。

Option 82能够标识不同的用户,服务器可以根据Option 82为不同的用户分配不同的IP地址,从而实现QoS、安全和计费的管理。

注意事项

l              只有使能DHCP snooping功能之后,DHCP Option 82功能才能生效。

l              DHCP snooping不支持链路聚合。若二层以太网接口加入聚合组,则该接口上进行的DHCP snooping配置不会生效;该接口退出聚合组后,之前的DHCP snooping配置才会生效。

l              设备只有位于DHCP客户端与DHCP服务器之间,或DHCP客户端与DHCP中继之间时,DHCP snooping功能配置后才能正常工作;设备位于DHCP服务器与DHCP中继之间时,DHCP snooping功能配置后不能正常工作。

l              DHCP snooping option 82功能建议在最靠近DHCP clientsnooping设备上使用,以达到精确定位用户位置的目的。

l              使能DHCP snooping功能的设备,不能作为DHCP服务器和DHCP中继。

l              建议不要在同一台设备上同时配置DHCP客户端/BOOTP客户端和DHCP snooping功能,否则可能无法生成DHCP snooping表项,DHCP客户端/BOOTP客户端也可能申请不到IP地址。

配置举例

4.1  组网需求

某公司的办公区域包括三个小组group1group2group3,独立地分布在三个房间中。该公司通过DHCP server统一管理IP地址,为不同的小组分配不同范围的地址。

具体需求如下:

l              DHCP server为办公室设备分配192.168.10.0/24网段的地址,有效期为12小时,并指定DNSWINS服务器地址分别为192.168.100.2192.168.100.3

l              三个小组group1group2group3分别通过端口Ethernet1/1Ethernet1/2Ethernet1/3接入DHCP snooping设备,并通过DHCP snooping设备与DHCP server通信。

l              DHCP servergroup1的用户分配192.168.10.2192.168.10.25之间的地址;为group2的用户分配192.168.10.100192.168.10.150之间的地址;为group3的用户分配192.168.10.151192.168.10.200之间的地址。

图2  DHCP Snooping组网图

4.2  配置思路

l              DHCP snooping设备上启动Option 82功能。

l              配置Option 82的子选项内容,使不同小组的用户携带不同的Option 82信息。可以通过用户自定义Circuit ID子选项内容的方式来实现。

l              DHCP server上配置IP地址分配策略,使得DHCP server可以根据Option 82DHCP client分配合适的IP地址。

4.3  使用版本

本举例是在Comware V500R002B42D001版本上进行配置和验证的。

4.4  配置步骤

&  说明:

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

 

4.4.1  DHCP Snooping设备的配置

1. 配置步骤

# 使能DHCP Snooping功能。

<Switch> system-view

[Switch] dhcp-snooping

# 配置端口Ethernet1/4为信任端口。

[Switch] interface ethernet 1/4

[Switch-Ethernet1/4] dhcp-snooping trust

[Switch-Ethernet1/4] quit

# 在端口Ethernet1/1使能Option 82

[Switch] interface ethernet 1/1

[Switch-Ethernet1/1] dhcp-snooping information enable

# 在端口Ethernet1/1配置Option 82Circuit ID填充内容为group1

[Switch-Ethernet1/1] dhcp-snooping information circuit-id string group1

[Switch-Ethernet1/1] quit

# 在端口Ethernet1/2使能Option 82

[Switch] interface ethernet 1/2

[Switch-Ethernet1/2] dhcp-snooping information enable

# 在端口Ethernet1/2配置Option 82Circuit ID填充内容为group2

[Switch-Ethernet1/2] dhcp-snooping information circuit-id string group2

[Switch-Ethernet1/2] quit

# 在端口Ethernet1/3使能Option 82

[Switch] interface ethernet 1/3

[Switch-Ethernet1/3] dhcp-snooping information enable

[Switch-Ethernet1/3] quit

# 在端口Ethernet1/3配置Option 82Circuit ID填充内容为group3

[Switch-Ethernet1/3] dhcp-snooping information circuit-id string group3

[Switch-Ethernet1/3] quit

2. 配置文件

<Switch> display current-configuration

#

interface Ethernet1/1

 port link-mode bridge

 dhcp-snooping information enable

 dhcp-snooping information circuit-id string group1

interface Ethernet1/2

 port link-mode bridge

 dhcp-snooping information enable

 dhcp-snooping information circuit-id string group2

# 

interface Ethernet1/3

 port link-mode bridge

 dhcp-snooping information enable

 dhcp-snooping information circuit-id string group3

#

interface Ethernet1/4

 port link-mode bridge

 dhcp-snooping trust

#

4.4.2  DHCP Server设备的配置

1. 配置步骤

设备上,可以通过两种方式配置Option 82的内容:

l              用户自定义方式:用户手工指定Option 82的内容;

l              非用户自定义方式:采用默认的normal模式或verbose模式填充Option 82

采用用户自定义方式配置Circuit ID子选项内容时,Circuit ID子选项的格式如3 所示。

图3  Circuit ID子选项的格式

例如,由端口Ethernet1/1接入的用户,Circuit ID子选项内容为group1DHCP报文中添加的Circuit ID子选项信息应为:0x010667726F757031,其中0106Circuit ID的子选项号和子选项长度,67726F757031是字符串“group1”的十六进制值。

本例中只需根据小组编号进行IP地址的分配,因此,在DHCP server上只需对Circuit ID子选项中标识小组编号的字段进行匹配即可。

&  说明:

DHCP server使用的是Cisco Catalyst 3745设备上的配置,对应的软件版本为IOS 12.3(11)T2版本,如果使用其他型号或其他版本的设备,请参考随机资料中的用户手册进行操作。

 

# 配置接口的IP地址为192.168.10.1/24

Server> enable

Server# configure terminal

Server(config)# interface fastethernet 0/0

Server(config-if)# ip address 192.168.10.1 255.255.255.0

Server(config-if)# exit

# 配置DHCP Server功能,并配置使用Option 82信息进行地址分配。

Server(config)# service dhcp

Server(config)# ip dhcp use class

# 为从DHCP snooping设备Ethernet1/1端口接入的group1用户建立DHCP分类,并配置匹配的Option 82信息为Circuit ID子选项中的小组编号,无需匹配的内容可以使用通配符“*”代替。

Server(config)# ip dhcp class group1

Server(dhcp-class)# relay agent information

Server(dhcp-class-relayinfo)# relay-information hex 010667726F757031*

Server(dhcp-class-relayinfo)# exit

# 为从DHCP snooping设备Etherent1/2端口接入的group2用户配置分类和匹配信息,方法与上面命令相似,只是将Option 82信息中的小组编号由1改为2

Server(config)# ip dhcp class group2

Server(dhcp-class)# relay agent information

Server(dhcp-class-relayinfo)# relay-information hex 010667726F757032*

Server(dhcp-class-relayinfo)# exit

# 为从DHCP snooping设备Etherent1/3端口接入的group3用户配置分类和匹配信息,方法与上面命令相似。

Server(config)# ip dhcp class group3

Server(dhcp-class)# relay agent information

Server(dhcp-class-relayinfo)# relay-information hex 010667726F757033*

Server(dhcp-class-relayinfo)# exit

# 创建DHCP地址池office,为DHCP地址池配置租约期限、网关、DNSWINS服务器地址。

Server(config)# ip dhcp pool office

Server(dhcp-config)# network 192.168.10.0

Server(dhcp-config)# lease 0 12

Server(dhcp-config)# default-router 192.168.10.1

Server(dhcp-config)# dns-server 192.168.100.2

Server(dhcp-config)# netbios-name-server 192.168.100.3

# 为三个DHCP分类分别指定地址范围。

Server(dhcp-config)# class group1

Server(dhcp-pool-class)# address range 192.168.10.2 192.168.10.25

Server(dhcp-pool-class)# class group2

Server(dhcp-pool-class)# address range 192.168.10.100 192.168.10.150

Server(dhcp-pool-class)# class group3

Server(dhcp-pool-class)# address range 192.168.10.151 192.168.10.200

4.4.3  验证结果

经过上述配置后,DHCP服务器即可为办公区域的不同小组自动分配一定范围内的IP地址及网关、DNSWINS服务器地址

相关资料

l              RFC 2131Dynamic Host Configuration Protocol

l              RFC 3046DHCP Relay Agent Information Option

 

 

 

 

 

 

 

 

 

 

Copyright ©2008 杭州华三通信技术有限公司 版权所有,保留一切权利。

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

本文档中的信息可能变动,恕不另行通知。

附件下载

新华三官网
联系我们