1.配置需求
公司将交换机SWA做为核心交换机,现在需要在核心交换机上划分2个VLAN网段,部门A/B分别属于VLAN 5/VLAN 6,即5、6两个网段,网关均在SWA上。内网有单独的DHCP服务器,服务器与用户不在同一个网段。要求SWA上开启DHCP中继功能,分别给两个部门的主机分配5 、6 两个网段的IP地址。
2.组网图
3.配置步骤
3.1 DHCP-server的接口地址配置
[DHCP-server]int g0/0
[DHCP-server-GigabitEthernet0/0]ip add 192.168.7.100 24
3.2 SWA的接口地址配置
[SWA]vlan 5
[SWA]vlan 6
[SWA]vlan 7
[SWA-vlan7]port g1/0/1
[SWA]int g1/0/2
[SWA-GigabitEthernet1/0/2]port link-type trunk
[SWA-GigabitEthernet1/0/2]port link-type trunk
[SWA-GigabitEthernet1/0/2]port trunk permit vlan 5 6 7
[SWA-Vlan-interface5]ip add 192.168.5.1 24
[SWA-Vlan-interface6]ip add 192.168.6.1 24
[SWA-Vlan-interface7]ip add 192.168.7.1 24
3.3 SWB的接口地址配置
[SWB]vlan 5
[SWB-vlan5]port GigabitEthernet 1/0/2
[SWB]vlan 6
[SWB-vlan6]port GigabitEthernet 1/0/3
[SWB]interface GigabitEthernet 1/0/1
[SWB-GigabitEthernet1/0/1]port link-type trunk
[SWB-GigabitEthernet1/0/1]port trunk permit vlan all
3.4 DHCP服务配置地址池5-6,网关,DNS
[DHCP-server]dhcp enable
[DHCP-server]dhcp server ip-pool 5
[DHCP-server-dhcp-pool-5]network 192.168.5.0 mask 255.255.255.0
[DHCP-server-dhcp-pool-5]gateway-list 192.168.5.1
[DHCP-server-dhcp-pool-5]dns-list 8.8.8.8
[DHCP-server]dhcp server ip-pool 6
[DHCP-server-dhcp-pool-6]network 192.168.6.0 mask 255.255.255.0
[DHCP-server-dhcp-pool-6]gateway-list 192.168.6.1
[DHCP-server-dhcp-pool-6]dns-list 8.8.8.8
3.5 DHCP-中继配置dhcp模式,服务器地址
[SWA]int vlan 5
[SWA-Vlan-interface5]dhcp select relay
[SWA-Vlan-interface5]dhcp relay server-address 192.168.7.100[SWA]int vlan 6
[SWA-Vlan-interface6]dhcp select relay
[SWA-Vlan-interface6]dhcp relay server-address 192.168.7.100
3.5 默认路由配置DHCP-server到PC,网关指向192.168.7.1
[DHCP-server]ip route-static 0.0.0.0 0 192.168.7.1