配置设备作为DHCP服务器示例(基于接口地址池),建议收藏!

您所在的位置:网站首页 winbox配置dhcp 配置设备作为DHCP服务器示例(基于接口地址池),建议收藏!

配置设备作为DHCP服务器示例(基于接口地址池),建议收藏!

#配置设备作为DHCP服务器示例(基于接口地址池),建议收藏!| 来源: 网络整理| 查看: 265

图7-3 配置设备作为DHCP服务器组网图

配置思路

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

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

二层交换机LSW_1和LSW_2上,需要配置接口的链路类型和加入的VLAN,实现二层互通。

操作步骤

# 配置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 00e0-fc12-3456 //为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地址(以操作系统为Windows 7的PC为例)

配置文件

Switch的配置文件

#

sysname Switch

#

vlan batch 10 to 11

#

dhcp enable

#

dhcp server database enable

#

interface Vlanif10

ip address 10.1.1.1 255.255.255.0

dhcp select interface

dhcp server static-bind ip-address 10.1.1.100 mac-address 00e0-fc12-3456

dhcp server lease day 30 hour 0 minute 0

#

interface Vlanif11

ip address 10.1.2.1 255.255.255.0

dhcp select interface

#

interface GigabitEthernet0/0/1

port link-type access

port default vlan 10

#

interface GigabitEthernet0/0/2

port link-type access

port default vlan 11

#

return返回搜狐,查看更多



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3