一、实验拓扑图:
二、 实验思路:
1. 在3SW1上创建Vlan10、Vlan20, 用VTP通告发送给2SW1、2SW2、3SW2.
给交换机接口设置为Trunk,将三层交换机的F0/3口设置为路由口,并配置IP地址.
2. 先给每台设备配置IP地址.
3. 在3SW1上给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、端口跟踪.、
给Vlan20配置IP地址、虚IP地址、HSRP组号、HSRP优先级、
占先权、
在3SW2上给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、端口跟踪.
给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、
4. 在三层交换机上配置DHCP.
4. R1的F0/0、F2/0和R2的F0/0、F2/0和R6配置RIP. 在三层交换机上配置RIP.
R1的F1/0和R2的F1/0接口配置OSPF.
R3、R4、R5配置OSPF。 R5的F1/0配置RIP.
6. R1、R2、R5、R6路由器配置OSPF和RIP重分发.
7. 在R3、R4上配置虚拟链路. 虚拟链路地址填写对面你的Router ID.
三、操作步骤:
1. 在3SW1上创建Vlan10、Vlan20, 用VTP通告发送给2SW1、2SW2、3SW2.
给交换机接口设置为Trunk, 将三层交换机的F0/3设置为路由口,配置IP地址.
3SW1:
3SW1#vlan database \\进入Vlan数据库.
3SW1(vlan)#vlan 10 name 10 \\创建Vlan10,取名为10.
3SW1(vlan)#vlan 20 name 20 \\创建Vlna20,取名为20.
3SW1(vlan)#vtp domain benet \\设置VTP域名为benet
3SW1(vlan)#vtp server \\将VTP模式设置为“Server服务器模式”
3SW1(vlan)#exit
3SW1#configure terminal
3SW1(config)#int ran f0/0 ,f0/15 \\同时进入F0/0和F0/15接口.
3SW1(config-if-range)#switchport mode access \\将接口设置为终端模式.access
3SW1(config-if-range)#switchport mode trunk \\将接口设置为中继模式.trunk
3SW1(config-if-range)#exit
3SW1(config-if-range)#exit
3SW1(config)#interface f0/3 \\进入F0/3接口.
3SW1(config-if)#no switchport \\将F0/3接口改为路由器 .
3SW1(config-if)# ip address 192.168.3.1 255.255.255.0 \\为F0/3口配置IP地址.
3SW1(config-if)# no shutdown \\开启F0/3接口.
3SW1(config-if)# exit
3SW1(config)#interface f0/14
3SW1(config-if)# ip address 192.168.5.1 255.255.255.0
3SW1(config-if)# exit
3SW1(config)#int ran f0/1 ,f0/2 \\同时进入F0/1、F0/2接口.
3SW1(config-if-range)#channel-group 1 mode on \\将接口设置为以太网通道.
3SW2(config-if-range)#exit
3SW2:
3SW2#vlan database \\进入Vlan数据库模式.
3SW2(vlan)#vtp domain benet \\设置VTP域名.
3SW2(vlan)#vtp client \\VTP模式为“client客户端模式”
3SW2(vlan)#exit
3SW2#configure terminal
3SW2(config)#interface range f0/1 ,f0/2
3SW2(config-if-range)#channel-group 1 mode on
3SW2(config-if-range)#exit
3SW2(config)#int ran f0/0 ,f0/15
3SW2(config-if-range)#switchport mode access
3SW2(config-if-range)#switchport mode trunk
3SW2(config-if-range)#exit
3SW2(config)#interface f0/3
3SW2(config-if)#no switchport
3SW2(config-if)#ip address 192.168.6.1 255.255.255.0
3SW2(config-if)#no shutdown
3SW2(config)#exit
3SW2(config)# interface FastEthernet0/14
3SW2(config-if)# no switchport
3SW2(config-if)#ip address 192.168.4.1 255.255.255.0
3SW2(config-if)#no shutdown
3SW2(config-if)#exit
2SW1:
2SW1#vlan database
2SW1(vlan)#vtp domain benet
2SW1(vlan)#vtp client
2SW1(vlan)#exit
2SW1#configure terminal
2SW1(config)#int ran f0/0 ,f0/15
2SW1(config-if)#switchport mode access
2SW1(config-if)#switchport mode trunk
2SW1(config-if)#exit
2SW1(config)#int f0/1
2SW1(config-if)#switchport mode access
2SW1(config-if)#switchport access vlan 10
2SW1(config-if)#exit
2SW2:
2SW2#vlan database
2SW2(vlan)#vtp domain benet
2SW2(vlan)#vtp client
2SW2(vlan)#exit
2SW2#configure terminal
2SW2(config)#int ran f0/0 ,f0/15
2SW2(config-if)#switchport mode access
2SW2(config-if)#switchport mode trunk
2SW2(config-if)#exit
2SW2(config)#int f0/1
2SW2(config-if)#switchport mode access
2SW2(config-if)#switchport access vlan 20
2SW2(config-if)#exit
2. 先给每台设备配置IP地址.
R1:
R1#configure terminal
R1(config)#interface FastEthernet0/0
R1(config-if)#ip address 192.168.3.2 255.255.255.0
R1(config-if)#no shutdown
R1(configif)#exit
R1(config)#interface FastEthernet1/0
R1(config-if)#ip address 192.168.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface FastEthernet2/0
R1(config-if)#ip address 192.168.4.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R2:
R2#configure terminal
R2(config)#interface FastEthernet0/0
R2(config-if)#ip address 192.168.6.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface FastEthernet1/0
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface FastEthernet2/0
R2(config-if)#ip address 192.168.5.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R3:
R3#configure terminal
R3(config)#interface FastEthernet0/0
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config-if)#no shutdown
R3(config)#exit
R3(config)#interface FastEthernet1/0
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface FastEthernet2/0
R3(config-if)#ip address 202.106.2.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R4:
R4#configure terminal
R4(config)#interface FastEthernet0/0
R4(config-if)#ip address 202.106.2.2 255.255.255.0
R4(config-if)#no shutdown
R4(config)#exit
R4(config)#interface FastEthernet1/0
R4(config-if)#ip address 202.106.1.2 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R5:
R5#configure terminal
R5(config)#interface FastEthernet0/0
R5(config-if)#ip address 202.106.1.1 255.255.255.0
R5(config-if)#no shutdown
R5(config-if)#exit
R5(config)#interface FastEthernet1/0
R5(config-if)#ip address 202.106.3.1 255.255.255.0
R5(config-if)#no shutdown
R5(config-if)#exit
R6:
R6#configure terminal
R6(config)#interface FastEthernet0/0
R6(config)-if#ip address 202.106.3.3 255.255.255.0
R6(config-if)#no shutdown
R6(config-if)#exit
3. 在3SW1上给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、端口跟踪.、
3SW1:
3SW1(config)#interface vlan 10 \\配置Vlan10参数.
3SW1(config-if)#ip address 192.168.100.10 255.255.255.0 \\Vlan10的IP地址.
3SW1(config-if)#standby 10 ip 192.168.100.100 \\Vlan10的虚拟网关.
3SW1(config-if)#standby 10 priority 150
\\Vlna10的优先级. 谁的优先级高谁是活跃路由器.
3SW1(config-if)#standby 10 preempt \\Vlan10的占先权.
3SW1(config-if)#standby 10 track FastEthernet0/0 60 \\端口跟踪.
3SW1(config-if)#standby 10 track FastEthernet0/1 60
3SW1(config-if)#standby 10 track FastEthernet0/2 60
3SW1(config-if)#standby 10 track FastEthernet0/15 6
3SW1(config-if)#exit
给Vlan20配置IP地址、虚IP地址、HSRP组号、HSRP优先级、
占先权、
3SW1(config)#interface vlan 20
3SW1(config-if)#ip address 192.168.200.10 255.255.255.0
3SW1(config-if)#standby 20 ip 192.168.200.100
3SW1(config-if)#standby 20 preempt
3SW1(config-if)#exit
在3SW2上给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、端口跟踪.
3SW2:
3SW2#configure terminal
3SW2(config)#interface vlan 10
3SW2(config-if)#ip address 192.168.100.20 255.255.255.0
3SW2(config-if)#standby 10 ip 192.168.100.100
3SW2(config-if)#standby 10 preempt
3SW2(config-if)#exit
给Vlan10配置IP地址、虚拟IP地址、HSRP组号、HSRP优先级、
占先权、
3SW2(config)#interface vlan 20
3SW2(config-if)#ip address 192.168.200.20 255.255.255.0
3SW2(config-if)#standby 20 ip 192.168.200.100
3SW2(config-if)#standby 20 priority 150
3SW2(config-if)#standby 20 preempt
3SW2(config-if)#standby 20 track FastEthernet0/0 60
3SW2(config-if)#standby 20 track FastEthernet0/15 60
3SW2(config-if)# standby 20 track FastEthernet0/1 60
3SW2(config-if)#standby 20 track FastEthernet0/2 60
3SW2(config-if)#exit
4. 在三层交换机上配置DHCP.
3SW1:
3SW1(config)#ip dhcp pool 100 \\创建一个DHCP.
3SW1(dhcp-config)#network 192.168.100.0 255.255.255.0 \\DHCP网段为192.168.100.0
3SW1(dhcp-config)#default-router 192.168.100.100 \\网关为192.168.100.100
3SW1(dhcp-config)#dns-server 8.8.8.8 \\DNS为8.8.8.8
3SW1(dhcp-config)#exit
3SW2:
3SW2(config)#ip dhcp pool 200
3SW2(dhcp-config)#network 192.168.200.0 255.255.255.0
3SW2(dhcp-config)#default-router 192.168.200.100
3SW2(dhcp-config)#dns-server 8.8.8.8
3SW2(dhcp-config)#exit
VM1和VM8自动获取IP地址分别为:
3SW1(config)#do show stan brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Vl10 10 150 P Active local 192.168.100.20 192.168.100.100
Vl20 20 100 P Active local 192.168.200.20 192.168.200.100
3SW2(config)#do show stan brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Vl10 10 100 P Standby 192.168.100.10 local 192.168.100.100
Vl20 20 90 P Standby 192.168.200.10 local 192.168.200.100
Vlan名 组号 优先级 当前状态 谁是活跃路由器 备份路由器为本地 虚拟IP地址.
3SW2(config)#int f0/15
3SW2(config-if)#shu
3SW2(config-if)#shutdown
3SW2(config-if)#exit
5. R1的F0/0、F2/0和R2的F0/0、F2/0和R6配置RIP.
R5的F1/0配置RIP.
R1:
R1#configure terminal
R1(config)#router rip \\启用RIP
R1(config-router)#network 192.168.3.0 \\学习直连网段.
R1(config-router)#network 192.168.4.0
R1(config-router)#exit
R2:
R2#configure terminal
R2(config)#router rip
R2(config-router)#network 192.168.5.0
R2(config-router)#network 192.168.6.0
R2(config-router)#exit
R5:
R65#configure terminal
R5(config)#router rip
R5(config-router)#network 202.106.3.0
R5(config-router)#exit
R6:
R6#configure terminal
R6(config)#router rip
R6(config-router)#network 202.106.3.0
R6(config-router)#exit
在三层交换机上配置RIP.
3SW1:
3SW1#configure terminal
3SW1(config)#router rip
3SW1(config-router)#network 192.168.3.0
3SW1(config-router)#network 192.168.5.0
3SW1(config-router)#network 192.168.100.0
3SW1(config-router)#network 192.168.200.0
3SW1(config-router)#exit
3SW2:
3SW2#configure terminal
3SW2(config)#router rip
3SW2(config-router)#network 192.168.5.0
3SW2(config-router)#network 192.168.6.0
3SW2(config-router)#network 192.168.100.0
3SW2(config-router)#network 192.168.200.0
3SW2(config-router)#exit
R1的F1/0和R2的F1/0接口配置OSPF.
R1:
R1(config)#router ospf 100 \\启用OSPF,优先级为100
R1(config-router)#network 192.168.1.0 0.0.0.255 area 1 \\192.168.1.0属于Area1区域.
R1(config-router)#exit
R2:
R2(config)#router ospf 100
R2(config-router)# network 192.168.2.0 0.0.0.255 area 1
R2(config-router)#exit
R3、R4、R5配置OSPF。
R3:
R3(config)#router ospf 100
R3(config-router)#network 192.168.1.0 0.0.0.255 area 1
R3(config-router)#network 192.168.2.0 0.0.0.255 area 1
R3(config-router)#network 202.106.2.0 0.0.0.255 area 2
R3(config-router)#exit
R4:
R4(config)#router ospf 100
R4(config-router)#network 202.106.1.0 0.0.0.255 area 0
R4(config-router)#network 202.106.2.0 0.0.0.255 area 2
R4(config-router)#exit
R5:
R5(config)#router ospf 100
R5(config-router)#network 202.106.1.0 0.0.0.255 area 0
R5(config-router)#exit
6. R1、R2、R5、R6路由器配置OSPF和RIP重分发.
R1:
R1(config)#router ospf 100
R1(config-router)#redistribute rip metric 100 subnets
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#redistribute ospf 100 metric 15
R1(config-router)#exit
R2:
R2(config)#router ospf 100
R2(config-router)#redistribute rip metric 100 subnets
R2(config-router)#exit
R2(config)#router rip
R2(config-router)#redistribute ospf 100 metric 15
R2(config-router)#exit
R5:
R5(config)#router ospf 100
R5(config-router)#redistribute rip metric 100 subnets
R5(config-router)#exit
R5(config)#router rip
R5(config-router)#redistribute ospf 100 metric 15
R5(config-router)#exit
R6:
R6(config)#router ospf 100
R6(config-router)#redistribute rip metric 100 subnets
R6(config-router)#exit
R6(config)#router rip
R6(config-router)#redistribute ospf 100 metric 15
R6(config-router)#exit
7. 在R3、R4上配置虚拟链路. 虚拟链路地址填写对面你的Router ID.
R3:
R3(config)#router ospf 100
R3(config-router)#area 2 virtual-link 202.106.2.2
R3(config-router)#exit
R4:
R4(config)#router ospf 100
R4(config-router)#area 2 virtual-link 202.106.2.1
R4(config-router)#exit
验证-->查看每个路由器的路由条目.
当配置完后, 每个路由器和三层交换机都有图中所有网段路由条目.
验证成功.