标签:网桥 res 连接 png 资源 enc cee database forward
随着公司的发展,公司对网络的要求越来越高,因此公司决定搭建由两台核心交换机做热备份的网络,为了充分利用网络资源,公司还要求实现vlan的负载均衡。实验步骤:
配置交换机的基本信息
HSRP的基本配置
配置HSRP的优先级
配置HSRP的占先权
配置STP(PVST+),实现VLAN负载均衡
验证HSRP
根据拓扑图搭建环境
PC和三层交换机都用路由器模拟,二层交换机用交换机模拟
添加模块
router1和router2模拟的三层交换机,添加NM-16ESW模块,router3到router5添加NM-1FE-TX模块,switch1和switch2添加NM-16ESW模块
生成文件CMD窗口最小化就可以了,连接线路,要严格按照拓扑图连接,连接完成点击右下角生成.BAT文件
看开生成的BAT文件,router1到switch2全部打开,最小化就可以,
打开CRT连接各个模拟器
协议号选择telnet,主机名为127.0.0.1 路由器的端口是2001到2006,交换机是3001 3002,一个一个连接就可以
全部连完之后,全部敲一下垃圾命令改一下名字
SW1-3L配置0/13-15接口为trunk
SW1-3L(config)#interface range fastEthernet 0/13 - 15
SW1-3L(config-if-range)#switchport trunk encapsulation dot1q
SW1-3L(config-if-range)#switchport mode trunk
在SW2-3L上配置F0/13 – 15 接口为trunk
SW2-3L(config)#interface range fastEthernet 0/13 - 15
SW2-3L(config-if-range)#switchport trunk encapsulation dot1q
SW2-3L(config-if-range)#switchport mode trunk
在SW3上配置F0/14 – 15接口为trunk
SW3(config)#interface range fastEthernet 0/14 - 15
SW3(config-if-range)#switchport trunk encapsulation dot1q
SW3(config-if-range)#switchport mode trunk
在SW4上配置F0/14 – 15接口为trunk
SW4(config)#interface range fastEthernet 0/14 - 15
SW4(config-if-range)#switchport trunk encapsulation dot1q
SW4(config-if-range)#switchport mode trunk
在SW1-3L进入vlan数据库,配置域名为Benet.com server工作模式,创建vlan2 vlan3 vlan4
SW1-3L#vlan database
SW1-3L(vlan)#vtp do
SW1-3L(vlan)#vtp domain benet.com
Changing VTP domain name from NULL to benet.com
SW1-3L(vlan)#vtp server
Device mode already VTP SERVER.
SW1-3L(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
SW1-3L(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
SW1-3L(vlan)#vlan 4
VLAN 4 added:
Name: VLAN0004
SW1-3L(vlan)#exit
查看vlan创建是否成功
SW1-3L(vlan)#show vlan-switch b
在SW2-3L上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW2-3L#vlan database
SW2-3L(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW2-3L(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW2-3L(vlan)#exit
在SW3上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW3#vlan database
SW3(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW3(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW3(vlan)#exit
在SW4上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW4#vlan database
SW4(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW4(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW4(vlan)#exit
SW1-3L配置vlan2的IP地址,192.168.2.1
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#ip address 192.168.2.1 255.255.255.0
SW1-3L(config-if)#no shutdown
SW1-3L配置vlan3的IP地址,192.168.3.1
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#ip address 192.168.3.1 255.255.255.0
SW1-3L(config-if)#no shutdown
SW1-3L配置vlan4的IP地址,192.168.4.1
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#ip address 192.168.4.1 255.255.255.0
SW1-3L(config-if)#no shutdown
Show ip inter b查看vlanIP是否配置成功
SW1-3L#show ip inter b
在SW2-3L上配置vlan2的IP地址,192.168.2.2
SW2-3L(config)#interface vlan 2
SW2-3L(config-if)#ip address 192.168.2.2 255.255.255.0
SW2-3L(config-if)#no shutdown
在SW2-3L上配置vlan3的IP地址,192.168.3.2
SW2-3L(config)#interface vlan 3
SW2-3L(config-if)#ip address 192.168.3.2 255.255.255.0
SW2-3L(config-if)#no shutdown
在SW2-3L上配置vlan4的IP地址,192.168.4.2
SW2-3L(config)#interface vlan 4
SW2-3L(config-if)#ip address 192.168.4.2 255.255.255.0
SW2-3L(config-if)#no shutdown
Show ip inter b查看vlanIP是否配置成功
SW2-3L#show ip inter b
配置PC1的IP地址,网关配置为192.168.2.254
PC1-VLAN2(config)#no ip routing
PC1-VLAN2(config)#interface fastEthernet 0/0
PC1-VLAN2(config-if)#no shutdown
PC1-VLAN2(config)#interface fastEthernet 0/0
PC1-VLAN2(config-if)#ip address 192.168.2.10 255.255.255.0
PC1-VLAN2(config-if)#no shutdown
PC1-VLAN2(config-if)#exit
PC1-VLAN2(config)#ip default-gateway 192.168.2.254
配置PC2的IP地址,网关配置为192.168.3.254
PC2-VLAN3(config)#no ip routing
PC2-VLAN3(config)#interface fastEthernet 0/0
PC2-VLAN3(config-if)#no shutdown
PC2-VLAN3(config-if)#exit
PC2-VLAN3(config)#interface fastEthernet 0/0
PC2-VLAN3(config-if)#ip address 192.168.3.10 255.255.255.0
PC2-VLAN3(config-if)#no shutdown
PC2-VLAN3(config-if)#exit
PC2-VLAN3(config)#ip default-gateway 192.168.3.254
PC2-VLAN3(config)#exit
配置PC3的IP地址,网关配置为192.168.2.254
PC3-VLAN2(config)#no ip routing
PC3-VLAN2(config)#interface fastEthernet 0/0
PC3-VLAN2(config-if)#no shutdown
PC3-VLAN2(config-if)#exit
PC3-VLAN2(config)#interface fastEthernet 0/0
PC3-VLAN2(config-if)#ip address 192.168.2.11 255.255.255.0
PC3-VLAN2(config-if)#no shutdown
PC3-VLAN2(config-if)#exit
PC3-VLAN2(config)#ip default-gateway 192.168.2.254
PC3-VLAN2(config)#exit
配置PC4的IP地址,网关配置为192.168.4.254
PC4-VLAN4(config)#no ip routing
PC4-VLAN4(config)#interface fastEthernet 0/0
PC4-VLAN4(config-if)#no shutdown
PC4-VLAN4(config-if)#exit
PC4-VLAN4(config)#interface fastEthernet 0/0
PC4-VLAN4(config-if)#ip address 192.168.4.10 255.255.255.0
PC4-VLAN4(config-if)#no shutdown
PC4-VLAN4(config-if)#exit
PC4-VLAN4(config)#ip default-gateway 192.168.4.254
PC4-VLAN4(config)#exit
配置vlan2活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#standby 2 ip 192.168.2.254
SW1-3L(config-if)#standby 2 priority 150
*Mar 1 01:32:37.447: %HSRP-6-STATECHANGE: Vlan2 Grp 2 state Standby -> Active
SW1-3L(config-if)#standby 2 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 2 preempt
SW1-3L(config-if)#exit
配置vlan3活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#standby 3 ip 192.168.3.254
SW1-3L(config-if)#standby 3 priority 150
*Mar 1 01:34:22.135: %HSRP-6-STATECHANGE: Vlan3 Grp 3 state Standby -> Active
SW1-3L(config-if)#standby 2 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 3 preempt
SW1-3L(config-if)#exit
配置vlan4活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#standby 4 ip 192.168.4.254
SW1-3L(config-if)#standby 4 priority 150
*Mar 1 01:35:24.007: %HSRP-6-STATECHANGE: Vlan4 Grp 4 state Standby -> Active
SW1-3L(config-if)#standby 4 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 4 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 4 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 4 preempt
SW1-3L(config-if)#exit
配置vlan2的备份路由器,优先级150
SW2-3L(config)#interface vlan 2
SW2-3L(config-if)#standby 2 ip 192.168.2.254
SW2-3L(config-if)#standby 2 priority 150
SW2-3L(config-if)#exit
配置vlan3的备份路由器,优先级150
SW2-3L(config)#interface vlan 3
SW2-3L(config-if)#standby 3 ip 192.168.3.254
SW2-3L(config-if)#standby 3 priority 150
SW2-3L(config-if)#exit
配置vlan4的备份路由器,优先级150
SW2-3L(config)#interface vlan 4
SW2-3L(config-if)#standby 4 ip 192.168.4.254
SW2-3L(config-if)#standby 4 priority 150
SW2-3L(config-if)#exit
配置vlan2活跃路由器的优先级
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#standby 2 ip 192.168.2.254
SW1-3L(config-if)#standby 2 priority 150
配置vlan3活跃路由器的优先级
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#standby 3 ip 192.168.3.254
SW1-3L(config-if)#standby 3 priority 150
配置vlan4活跃路由器的优先级
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#standby 4 ip 192.168.4.254
SW1-3L(config-if)#standby 4 priority 150
开启vlan2 vlan3 vlan4的抢占功能
SW1-3L(config-if)#standby 2 preempt
SW1-3L(config-if)#standby 3 preempt
SW1-3L(config-if)#standby 4 preempt
在SW1-3L配置vlan2 vlan3 vlan4为根网桥
SW1-3L(config)#spanning-tree vlan 2 root primary
VLAN 2 bridge priority set to 8192
VLAN 2 bridge max aging time unchanged at 20
VLAN 2 bridge hello time unchanged at 2
VLAN 2 bridge forward delay unchanged at 15
SW1-3L(config)#spanning-tree vlan 3 root primary
VLAN 3 bridge priority set to 8192
VLAN 3 bridge max aging time unchanged at 20
VLAN 3 bridge hello time unchanged at 2
VLAN 3 bridge forward delay unchanged at 15
SW1-3L(config)#spanning-tree vlan 4 root primary
VLAN 4 bridge priority set to 8192
VLAN 4 bridge max aging time unchanged at 20
VLAN 4 bridge hello time unchanged at 2
VLAN 4 bridge forward delay unchanged at 15
在SW2-3L配置vlan2 vlan3 vlan4为备份根网桥
SW2-3L(config)#spanning-tree vlan 2 root secondary
VLAN 2 bridge priority set to 16384
VLAN 2 bridge max aging time unchanged at 20
VLAN 2 bridge hello time unchanged at 2
VLAN 2 bridge forward delay unchanged at 15
SW2-3L(config)#spanning-tree vlan 3 root secondary
VLAN 3 bridge priority set to 16384
VLAN 3 bridge max aging time unchanged at 20
VLAN 3 bridge hello time unchanged at 2
VLAN 3 bridge forward delay unchanged at 15
SW2-3L(config)#spanning-tree vlan 4 root secondary
VLAN 4 bridge priority set to 16384
VLAN 4 bridge max aging time unchanged at 20
VLAN 4 bridge hello time unchanged at 2
VLAN 4 bridge forward delay unchanged at 15
验证HSRP
标签:网桥 res 连接 png 资源 enc cee database forward
原文地址:https://blog.51cto.com/14156658/2377542