Print

【MVS】思科交换机DHCP中继典型组网配置案例

2025-03-26 发表

组网及说明

组网说明:本案例采用思科模拟器来部署交换机DHCP中继来实现PCDHCP服务器上获取到IP地址并接入网络。

配置步骤

1、配置DHCP服务器。

2、配置基础网络,比如VLANVLAN IP等。

3、在交换机配置DHCP中继。

配置关键点

1)配置DHCP服务器

设置DHCP服务器的IP地址、子网掩码、默认网关。

启用DHCP功能。

配置两个地址池,用于给VLAN 10VLAN 20的终端分配IP

2)配置交换机的基础网络及DHCP中继。

Switch>ena //进入特权模式

Switch#conf t //进入全局模式

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hos MSW  //将交换机命名为MSW

MSW(config)#vlan 10  //创建VLAN 10

MSW(config-vlan)#exit

MSW(config)#vlan 20

MSW(config-vlan)#exit

MSW(config)#int f 0/1 //进入F0/1接口

MSW(config-if)#sw mo acc //将接口配置为access模式

MSW(config-if)#sw acc vlan 10 //将接口划分到VLAN 10

MSW(config-if)#exit

MSW(config)#int f 0/2

MSW(config-if)#sw mo acc

MSW(config-if)#sw acc vlan 20

MSW(config-if)#exit

MSW(config)#ip routing //启用三层路由转发功能

MSW(config)#int vlan 10  //进入VLAN 10虚接口

MSW(config-if)#ip address 10.10.0.1 255.255.255.0 //配置VLAN 10IP地址和子网掩码

MSW(config-if)#ip helper-address 10.30.0.30  //配置DHCP中继指向到DHCP服务器,注意指向的IP要和DHCP服务器的IP一致。

MSW(config-if)#exit

MSW(config)#int vlan 20

MSW(config-if)#ip address 10.20.0.1 255.255.255.0

MSW(config-if)#ip helper-address 10.30.0.30

MSW(config-if)#exit

MSW(config)#vlan 30

MSW(config-vlan)#exit

MSW(config)#int f 0/3

MSW(config-if)#sw mo acc

MSW(config-if)#sw acc vlan 30

MSW(config-if)#exit

MSW(config)#int vlan 30

MSW(config-if)#ip address 10.30.0.1 255.255.255.0

MSW(config-if)#exit

MSW(config)#do wr

Building configuration...

[OK]

MSW(config)#

 

3)业务测试

所有PC都能通过DHCP自动获取到IP地址,且能相互PING通。

至此,思科交换机DHCP中继典型组网配置案例已完成。