最佳答案
这个要配合ip source binding一起使用
你做完绑定 有没有在接口下开启ip verify的功能呢 你要是不在接口下开启的话 是没有用的
如图3所示,Device通过接口Vlan-interface10和Vlan-interface20分别与DHCP客户端和DHCP服务器相连。
具体应用需求如下:
Device上使能DHCP中继功能,DHCP客户端通过Device从DHCP服务器获取IP地址。
在接口Vlan-interface10上启用IPv4动态绑定功能,通过DHCP中继获取的用户信息来生成IP Source Guard动态绑定表项(IP+MAC绑定),并利用该表项对接口Vlan-interface10收到的报文进行过滤,防止非法用户报文通过。
图3 基于DHCP中继动态绑定的IP Source Guard组网图
在Device上启用DHCP中继用户地址表项记录功能(缺省为关闭),以使Device能监听该接口上接收的报文、生成DHCP中继用户地址表项。
本举例是在R3203版本上进行配置和验证的。
缺省情况下,交换机的接口处于ADM(Administratively Down)状态,请根据实际需要在对应接口视图下使用undo shutdown命令开启接口。
本例以S12500X-AF(T系列)交换机作为DHCP服务器为例,说明DHCP服务器的基本配置。
# 配置VLAN接口20的IP地址,并将其配置为工作在DHCP服务器模式。
<DHCPserver> system-view
[DHCPserver] interface vlan-interface 20
[DHCPserver-Vlan-interface20] ip address 10.10.0.2 24
[DHCPserver-Vlan-interface20] dhcp select server
[DHCPserver-Vlan-interface20] quit
# 启用DHCP服务。
[DHCPserver] dhcp enable
# 配置DHCP地址池1,用来为192.168.0.0/24网段内的客户端分配IP地址和网络配置参数。
[DHCPserver] dhcp server ip-pool 1
[DHCPserver-dhcp-pool-1] network 192.168.0.0 24
[DHCPserver-dhcp-pool-1] expired day 7
[DHCPserver-dhcp-pool-1] quit
由于DHCP中继连接客户端的接口IP地址与DHCP服务器的IP地址不在同一网段,因此需要在DHCP服务器上通过静态路由或动态路由协议保证两者之间路由可达,这里以配置静态路由为例。
[DHCPserver] ip route-static 192.168.0.0 24 10.10.0.1
# 创建VLAN 10,并将端口HundredGigE1/0/1加入VLAN 10。
<Device> system-view
[Device] vlan 10
[Device-vlan10] port hundredgige 1/0/1
[Device-vlan10] quit
# 配置VLAN接口10的IP地址。
[Device] interface vlan-interface 10
[Device-Vlan-interface10] ip address 192.168.0.1 255.255.255.0
[Device-Vlan-interface10] quit
# 创建VLAN 20,并将端口HundredGigE1/0/2加入VLAN 20。
[Device] vlan 20
[Device-vlan20] port hundredgige 1/0/2
[Device-vlan20] quit
# 配置VLAN接口20的IP地址。
[Device] interface vlan-interface 20
[Device-Vlan-interface20] ip address 10.10.0.1 255.255.255.0
[Device-Vlan-interface20] quit
# 开启DHCP服务。
[Device] dhcp enable
# 开启DHCP中继用户地址表项记录功能。
[Device] dhcp relay client-information record
# 配置接口Vlan-interface10工作在DHCP中继模式。
[Device] interface vlan-interface 10
[Device-Vlan-interface10] dhcp select relay
# 在DHCP中继上指定DHCP服务器的地址。
[Device-Vlan-interface10] dhcp relay server-address 10.10.0.2
[Device-Vlan-interface10] quit
# 在接口Vlan-interface10上配置IPv4接口绑定功能,绑定源IP地址和MAC地址。
[Device] interface vlan-interface 10
[Device-Vlan-interface10] ip verify source ip-address mac-address
[Device-Vlan-interface10] quit
将终端配置为自动获取IP地址(具体过程略)。
DHCP客户端成功获取IP地址以后,在Device上可以显示通过DHCP relay模块获取的IP Source Guard动态绑定表项信息。(以接入四台DHCP客户端为例)
<Device> display ip source binding dhcp-relay
Total entries found: 4
IP Address MAC Address Interface VLAN Type
192.168.0.2 0001-0203-0402 Vlan10 10 DHCP relay
192.168.0.3 0001-0203-0403 Vlan10 10 DHCP relay
192.168.0.4 0001-0203-0404 Vlan10 10 DHCP relay
192.168.0.5 0001-0203-0405 Vlan10 10 DHCP relay
DHCP客户端均可以ping通DHCP服务器接口IP地址10.10.0.2。
如果DHCP客户端通过手工配置IP地址的方式,修改了自身的IP地址,将无法ping通DHCP服务器接口IP地址。
Device
#
dhcp enable
dhcp relay client-information record
#
vlan 10
#
vlan 20
#
interface Vlan-interface10
ip address 192.168.0.1 255.255.255.0
dhcp select relay
dhcp relay server-address 10.10.0.2
ip verify source ip-address mac-address
#
interface Vlan-interface20
ip address 10.10.0.1 255.255.255.0
#
interface HundredGigE1/0/1
port link-mode bridge
port access vlan 10
#
interface HundredGigE1/0/2
port link-mode bridge
port access vlan 20
#
(0)
需要如何配置
试了下这个配置【ip verify source ip-address mac-address】。没绑定的地址都上不了网了,可以只限制单独1,2个地址吗
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
试了下这个配置【ip verify source ip-address mac-address】。没绑定的地址都上不了网了,可以只限制单独1,2个地址吗