int vlan30
vrrp vrid 3 virtual-ip 192.168.30.254
vrrp vrid 3 priority 120
vrrp vrid 3 authentication-mode md5 hc
vrrp vrid 3 preempt-mode timer delay 30
vrrp vrid 3 track interface g0/0/5 reduced 30
vrrp vrid 3 track interface GigabitEthernet0/0/3 reduced 30
int vlan20
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 authentication-mode md5 hc
int vlan40
vrrp vrid 4 virtual-ip 192.168.40.254
vrrp vrid 4 authentication-mode md5 hc
⑤配置OSPF
在现实中,可以将S1上联到路由器的接口(G0/0/5) 用命令undo portswitch启用为三层接口,然后直接配置IP地址,以便与路由器配通,但是在模拟器中,我们只能把G0/0/5口放到某个VLAN,然后配置VLAN接口IP,以此与路由器配通
int vlan 100
ip add 10.1.1.2 30
int g0/0/5
p l a
p d v 100
ospf router-id 11.1.1.1
a 0
network 192.168.10.1 0.0.0.0
network 192.168.20.1 0.0.0.0
network 192.168.30.1 0.0.0.0
network 192.168.40.1 0.0.0.0
network 10.1.1.2 0.0.0.0
2、S2的配置,不多解释了:
stp instance 1 root secondary
stp instance 2 root primary
port-group group-member g0/0/1 to g0/0/4
p l t
p t a v a
int vlan 10
ip add 192.168.10.2 24
int vlan 20
ip add 192.168.20.2 24
int vlan 30
ip add 192.168.30.2 24
int vlan 40
ip add 192.168.40.2 24
int vlan10
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 authentication-mode md5 hc
int vlan30
vrrp vrid 3 virtual-ip 192.168.30.254
vrrp vrid 3 authentication-mode md5 hc
int vlan20
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 120
vrrp vrid 2 authentication-mode md5 hc
vrrp vrid 2 preempt-mode timer delay 30
vrrp vrid 2 track interface g0/0/5 reduced 30
int vlan40
vrrp vrid 4 virtual-ip 192.168.40.254
vrrp vrid 4 priority 120
vrrp vrid 4 authentication-mode md5 hc
vrrp vrid 4 preempt-mode timer delay 30
vrrp vrid 4 track interface g0/0/5 reduced 30
vlan 200
int vlan 200
ip add 20.1.1.2 30
int g0/0/5
p l a
p d v 200
ospf 1 router-id 12.1.1.1
area 0.0.0.0
network 192.168.10.2 0.0.0.0
network 192.168.20.2 0.0.0.0
network 192.168.30.2 0.0.0.0
network 192.168.40.2 0.0.0.0
network 20.1.1.2 0.0.0.0
【连接交换机的路由器设置步骤 交换机接无线路由器怎么设置】int vlan 20
vrrp vrid 2 track interface GigabitEthernet0/0/3 reduced 30
vrrp vrid 2 track interface GigabitEthernet0/0/4 reduced 30
vrrp vrid 2 track interface GigabitEthernet0/0/2 reduced 30
int vlan 40
vrrp vrid 4 track interface GigabitEthernet0/0/3 reduced 30
vrrp vrid 4 track interface GigabitEthernet0/0/4 reduced 30
vrrp vrid 4 track interface GigabitEthernet0/0/2 reduced 30
3、S3的配置,不多解释了:
port-group group-member e0/0/1 to e0/0/2
p l t
p t a v a
int e0/0/3
p l a
p d v 10
stp edged-port enable
int e0/0/4
p l a
p d v 30
stp edged-port enable
dis stp ins 1 bri
dis stp ins 2 bri
S4和S5的配置,基本上和S3一样,就不贴出来了;
六、验证通讯:1、在R3上ping -a 3.3.3.3 192.168.10.21,可通;
2、在PC1上ping 3.3.3.3可通;
3、 在PC1上tracert 3.3.3.3,记住路径,S1的G0/0/3口 shutdown,在PC1上tracert 3.3.3.3,观察路径,竟然无变化
抓包显示,先到S2再到S1,再从R1出去,路径为次优,这个问题,在track了下联口后,已解决,如下图,4个VLAN在S1上全部都是backup,S2全为master,此时流量全部经由S2,上至R2出去;
推荐阅读
- 直通车添加关键词的方法 淘宝直通车怎么添加关键词
- 2021像素高分辨率好的手机推荐 目前什么手机像素最高
- 想让炖肉更易软烂制作的过程中可以加入什么,山楂干更容易炖烂
- 种植牙的费用有多贵,种植牙的费用包括什么
- 葡萄干的营养价值,吃葡萄干有哪些营养优势
- 吃西红柿能美白吗,西红柿的美白效果好吗
- 飞机黑匣子的作用是什么,飞机黑匣子能记录哪些信息
- 蓝瓶咖啡为什么火了 蓝瓶咖啡被誉为“咖啡界的Apple”
- 助眠仪有用吗,能起到缓解失眠的作用
- 耳朵除了听觉功能还可以感知到什么,怎样保护我们的耳朵