交换机DHCP服务器配置
1.首先创建两个vlan,并且划分对应的端口,操作步骤如下:
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#int range f0/1-8
Switch(config-if-range)#sw
Switch(config-if-range)#switchport acc
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#int range f0/9-16
Switch(config-if-range)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20
Switch(config-if-range)#
Switch(config-if-range)#exit
2.给vlan配置网关,具体操作如下:
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip add 192.168.10.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip add 192.168.20.1 255.255.255.0
3.给这两个网络各自配置一个DHCP服务器,操作如下:
Switch(config)#ip dhcp po
Switch(config)#ip dhcp pool testA
Switch(dhcp-config)#network 192.168.10.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.10.1
Switch(dhcp-config)#exit
Switch(config)#ip dhcp pool testB
Switch(dhcp-config)#network 192.168.20.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.20.1