Cisco的DHCP和VLAN综合实验
实验内容:
PC1和PC2需要通过DHCP Server获取IP地址。R1做单臂路由和DHCP Relay,R2接口f2/0的IP地址为192.168.3.1。且PC1属于vlan10,PC2属于vlan20,R3(DHCP Server)属于VLAN30。
PC1属于192.168.1.0网段,网关为192.168.1.254 PC2属于192.168.2.0网段,网关为192.168.2.254
实验拓补图:
实验思路:
在S1上配置vlan 10,20,30,且e0/2口为trunk口
R1上要为vlan30创建一个子接口。且每个子接口要指定封装模式和指定DHCP Server的IP地址。
DHCP Server上需要配置去往主机的默认路由
实验配置:
S1(config)#vlan10 S1(config-vlan)#vlan20 S1(config-vlan)#vlan30 S1(config-vlan)#doshowvlan查看是否已创建且是否为活动状态 S1(config)#interfaceethernet0/0 S1(config-if)#switchportaccessvlan10 S1(config-if)#intere0/1 S1(config-if)#swiaccvlan20 S1(config-if)#intere0/3 S1(config-if)#swiacvlan30 S1(config-if)#intere0/2 S1(config-if)#switchporttrunkencapsulationdot1q S1(config-if)#switchportmodetrunk S1(config-if)#doshowintere0/2switchport查看0/2口是否为trunk口 R1(config)#interfacefastEthernet0/0.1 R1(config-subif)#encapsulationdot1Q10 R1(config-subif)#ipadd192.168.1.254255.255.255.0 R1(config-subif)#iphelper-address192.168.3.1 R1(config)#interfacefastEthernet0/0.2 R1(config-subif)#encapsulationdot1Q20 R1(config-subif)#ipadd192.168.2.254255.255.255.0 R1(config-subif)#iphelper-address192.168.3.1 R1(config)#interfacefa0/0.3 R1(config-subif)#encapsulationdot1Q30 R1(config-subif)#ipadd192.168.3.254255.255.255.0 R1(config-subif)#interfa0/0 R1(config-if)#noshutdown R2(config)#ipdhcpexcluded-address192.168.1.200192.168.1.255 R2(config)#ipdhcpexcluded-address192.168.2.200192.168.2.255 R2(config)#ipdhcppoolpc1 R2(dhcp-config)#network192.168.1.0255.255.255.0 R2(dhcp-config)#default-router192.168.1.254 R2(dhcp-config)#dns-server8.8.8.8 R2(dhcp-config)#lease234 R2(config)#ipdhcppoolpc2 R2(dhcp-config)#network192.168.2.0255.255.255.0 R2(dhcp-config)#default-router192.168.2.254 R2(dhcp-config)#dns-server8.8.8.8 R2(dhcp-config)#lease234 R2(config)#iproute0.0.0.00.0.0.0192.168.3.254 R2(config)#interfa2/0 R2(config-if)#ipadd192.168.3.1255.255.255.0 R2(config-if)#nosh
实验验证:
开始PC1没有IP地址
PC1使用DCHP请求IP
PC1成功请求到IP。