实验名称:咔咔咔还是一顿整
实验目的:
1.实现各VLAN间彼此通信
2.各VLAN的PC主机通过各自的DHCP服务器获取IP
涉及技术:VLAN间通信/DHCP/DHCP中继/RIP
拓扑图:
【实验】综合实验-咔咔咔还是一顿整_第1张图片
VLAN划分:
VLAN10:PC6/7/8 192.168.10.0/24
VLAN20:PC0/1 192.168.20.0/24
VLAN30:PC4/5 192.168.30.0/24
VLAN40:PC2/3 192.168.40.0/24
VLAN50:PC9/10/11 192.168.50.0/24

DHCP设备划分:
VLAN10:三层交换机DHCPvlan10
VLAN20/30/40:三层交换机DHCPvlan20-40
VLAN50:三层交换机DHCPvlan50

实验思路:
一:先确保各自VLAN主机到对应网关的路由器接口处畅通(尚无配置DHCP,临时用静态IP地址进行测试)
二:分段配置完成后,配置中间路由器部分。使其各部分进行“连接”
三:配置各自VLAN对应的DHCP设备
三:将终端PC的静态IP地址改为动态获取,成功获取后进行全网互通测试。

配置思路:
一:二层交换机配置
#VLAN创建和划分
#access/trunk链路的配置
二:三层交换机配置(VLAN划分,access/trunk链路配置,DHCP对应各自)
#VLAN创建和划分
#access/trunk链路的配置
#DHCP对应各自VLAN地址池的建立,DHCP自身IP的规划
#开启路由转发功能
三:路由器配置
#接口IP的配置
#RIP的配置工作

实验步骤:

VLAN10区域

二层交换机:
Switch#
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
备注:如果只创建本区域VLAN的话,其他VLAN广播域内的主机将无法访问
Switch(config-vlan)#int range f0/1-f0/3
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 10
Switch(config-if-range)#int f0/4
Switch(config-if)#
Switch(config-if)#sw mo tr
Switch(config-if)#end
Switch#wr
Switch#write
Building configuration...
[OK]

三层交换机:

DHCPvlan10>
DHCPvlan10>en
DHCPvlan10#conf
DHCPvlan10(config)#vlan 10
DHCPvlan10(config-vlan)#vlan 20
DHCPvlan10(config-vlan)#vlan 30
DHCPvlan10(config-vlan)#vlan 40
DHCPvlan10(config-vlan)#vlan 50
DHCPvlan10(config-vlan)#int f0/4
DHCPvlan10(config-if)#sw tr e d
DHCPvlan10(config-if)#sw mo tr
DHCPvlan10(config-if)#int f0/1
DHCPvlan10(config-if)#sw mo ac
DHCPvlan10(config-if)#sw ac vlan 10
DHCPvlan10(config-if)#int vlan 10
DHCPvlan10(config-if)#ip add 192.168.10.253 255.255.255.0
DHCPvlan10(config-if)#no shu
DHCPvlan10(config-if)#exit
DHCPvlan10(config)#ip dhcp pool vlan10
DHCPvlan10(dhcp-config)#network 192.168.10.0 255.255.255.0
DHCPvlan10(dhcp-config)#default-router 192.168.10.254
DHCPvlan10(dhcp-config)#dns-server 8.8.8.8
DHCPvlan10(dhcp-config)#exit
DHCPvlan10(config)#service dhcp
DHCPvlan10(config)#ip routing
DHCPvlan10(config)#end
DHCPvlan10#
DHCPvlan10#write
Building configuration...
[OK]

路由器:
GWvlan10>en
GWvlan10#conf
GWvlan10(config)#int g0/1
GWvlan10(config-if)#no shu
GWvlan10(config-if)#ip add 192.168.10.254 255.255.255.0
GWvlan10(config-if)#int g0/0
GWvlan10(config-if)#ip add 192.168.90.1 255.255.255.0
GWvlan10(config-if)#no shu
GWvlan10(config-if)#exit
GWvlan10(config)#rou rip
GWvlan10(config-router)#v 2
GWvlan10(config-router)#no aut
GWvlan10(config-router)#net 192.168.10.0
GWvlan10(config-router)#net 192.168.90.0
GWvlan10(config-router)#end
GWvlan10#
GWvlan10#write
Building configuration...
[OK]

至此,VLAN10区域的主机已经可以实现DHCP自动获取功能。如下图所示:
【实验】综合实验-咔咔咔还是一顿整_第2张图片

VLAN50区域:

二层交换机:
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/3
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 50
Switch(config-if-range)#int f0/4
Switch(config-if)#sw mo tr
Switch(config-if)#end
Switch#
Switch#write
Building configuration...
[OK]

三层交换机:
DHCPvlan50>en
DHCPvlan50#conf
DHCPvlan50(config)#vlan 10
DHCPvlan50(config-vlan)#vlan 20
DHCPvlan50(config-vlan)#vlan 30
DHCPvlan50(config-vlan)#vlan 40
DHCPvlan50(config-vlan)#vlan 50
DHCPvlan50(config-vlan)#int f0/4
DHCPvlan50(config-if)#sw tr e d
DHCPvlan50(config-if)#sw mo tr
DHCPvlan50(config-if)#int f0/1
DHCPvlan50(config-if)#sw mo ac
DHCPvlan50(config-if)#sw ac vlan 50
DHCPvlan50(config-if)#exit
DHCPvlan50(config)#ip dhcp pool vlan50
DHCPvlan50(dhcp-config)#network 192.168.50.0 255.255.255.0
DHCPvlan50(dhcp-config)#default-router 192.168.50.254
DHCPvlan50(dhcp-config)#dns-server 8.8.8.8
DHCPvlan50(dhcp-config)#int vlan 50
DHCPvlan50(config-if)#ip add 192.168.50.253 255.255.255.0
DHCPvlan50(config-if)#no shu
DHCPvlan50(config-if)#exit
DHCPvlan50(config)#ip routing
DHCPvlan50(config)#service dhcp
DHCPvlan50(config)#end
DHCPvlan50#write
Building configuration...
[OK]

路由器:
GWvlan50>en
GWvlan50#conf
GWvlan50(config)#int g0/1
GWvlan50(config-if)#ip add 192.168.50.254 255.255.255.0
GWvlan50(config-if)#no shu
GWvlan50(config-if)#int g0/0
GWvlan50(config-if)#ip add 192.168.100.1 255.255.255.0
GWvlan50(config-if)#no shu
GWvlan50(config-if)#exit
GWvlan50(config)#rou rip
GWvlan50(config-router)#v 2
GWvlan50(config-router)#no aut
GWvlan50(config-router)#net 192.168.100.0
GWvlan50(config-router)#net 192.168.50.0
GWvlan50(config-router)#end
GWvlan50#
GWvlan50#write
Building configuration...
[OK]

至此,VLAN50区域的主机已经可以实现DHCP自动获取功能。如下图所示:
【实验】综合实验-咔咔咔还是一顿整_第3张图片

VLAN20-40区域:

交换机

VLAN20
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 20
Switch(config-if-range)#int range f0/3,f0/6
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#wr
Switch#write
Building configuration...
[OK]

VLAN30
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 30
Switch(config-if-range)#int range f0/6,f0/4,f0/7
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#
Switch#write
Building configuration...
[OK]

VLAN40
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 30
Switch(config-if-range)#int range f0/5,f0/7
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#
Switch#write
Building configuration...
[OK]

三层交换机(网关):
GWvlan20-40>en
GWvlan20-40#conf
GWvlan20-40(config)#vlan 10
GWvlan20-40(config-vlan)#vlan 20
GWvlan20-40(config-vlan)#vlan 30
GWvlan20-40(config-vlan)#vlan 40
GWvlan20-40(config-vlan)#vlan 50
GWvlan20-40(config-vlan)#int range f0/3-f0/5
GWvlan20-40(config-if-range)#sw tr e d
GWvlan20-40(config-if-range)#sw mo tr
GWvlan20-40(config-if)#int f0/1
GWvlan20-40(config-if)#no sw
GWvlan20-40(config-if)#ip add 192.168.60.1 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 20
GWvlan20-40(config-if)#ip add 192.168.20.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 30
GWvlan20-40(config-if)#ip add 192.168.30.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 40
GWvlan20-40(config-if)#ip add 192.168.40.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#exit
GWvlan20-40(config)#router rip
GWvlan20-40(config-router)#v 2
GWvlan20-40(config-router)#no aut
GWvlan20-40(config-router)#net 192.168.20.0
GWvlan20-40(config-router)#net 192.168.30.0
GWvlan20-40(config-router)#net 192.168.40.0
GWvlan20-40(config-router)#net 192.168.60.0
GWvlan20-40(config-router)#exit
GWvlan20-40(config)#ip routing
GWvlan20-40(config)#exit
GWvlan20-40#
GWvlan20-40#write
Building configuration...
[OK]

三层交换机(DHCP):
DHCPvlan20-40>en
DHCPvlan20-40#conf
DHCPvlan20-40(config)#int f0/1
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#ip add 192.168.60.2 255.255.255.0
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#int f0/2
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#ip add 192.168.80.1 255.255.255.0
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#int f0/3
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#ip add 192.168.70.1 255.255.255.0
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan20
DHCPvlan20-40(dhcp-config)#network 192.168.20.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.20.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan30
DHCPvlan20-40(dhcp-config)#network 192.168.30.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.30.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan40
DHCPvlan20-40(dhcp-config)#network 192.168.40.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.40.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#rou rip
DHCPvlan20-40(config-router)#v 2
DHCPvlan20-40(config-router)#no aut
DHCPvlan20-40(config-router)#net 192.168.80.0
DHCPvlan20-40(config-router)#net 192.168.70.0
DHCPvlan20-40(config-router)#net 192.168.60.0
DHCPvlan20-40(config-router)#exit
DHCPvlan20-40(dhcp-config)#ip routing
DHCPvlan20-40(dhcp-config)#service dhcp

至此,VLAN20/30/40区域的主机已经可以实现DHCP自动获取功能。如下图所示:
【实验】综合实验-咔咔咔还是一顿整_第4张图片
【实验】综合实验-咔咔咔还是一顿整_第5张图片
【实验】综合实验-咔咔咔还是一顿整_第6张图片

各区域之间路由器配置:

R0

Router>en
Router#conf
Router(config)#int g0/1
Router(config-if)#no shu
Router(config-if)#ip add 192.168.90.2 255.255.255.0
Router(config-if)#int g0/0
Router(config-if)#no shu
Router(config-if)#ip add 192.168.80.2 255.255.255.0
Router(config-if)#exit
Router(config)#rou rip
Router(config-router)#net 192.168.80.0
Router(config-router)#net 192.168.90.0
Router(config-router)#end
Router#
Router#write
Building configuration...
[OK]

R1
Router>en
Router#conf
Router(config)#int g0/0
Router(config-if)#no shu
Router(config-if)#ip add 192.168.70.2 255.255.255.0
Router(config-if)#int g0/1
Router(config-if)#no shu
Router(config-if)#ip add 192.168.100.2 255.255.255.0
Router(config-if)#exit
Router(config)#rou rip
Router(config-router)#v 2
Router(config-router)#no aut
Router(config-router)#net 192.168.70.0
Router(config-router)#net 192.168.100.0
Router(config-router)#end
Router#
Router#write
Building configuration...
[OK]

测试(其余测试图重复性较多,便不再复述)
【实验】综合实验-咔咔咔还是一顿整_第7张图片

至此,实验完毕