配置OSPF多区域,实现内网互通---实验

发布时间:2023年12月22日

目录

配置OSPF多区域,实现内网互通---实验

拓扑

需求:

配置步骤:

配置命令:


配置OSPF多区域,实现内网互通---实验

拓扑

需求:

1)实现内网所有vlan和R1互通

2)实现R1和SW5/SW6使用最优路径互通

3)要求vlan88-web区域稳定

配置步骤:

1) 配置mstp

2)配置多区域的ospf

3)配置特殊区域,保护vlan88

配置命令:

第一步:配置mstp优化路径

[SW7]vlan batch  10 15  16 20 30 40 66 88 

[SW7]stp region-configuration
[SW7-mst-region]instance  1 vlan 10  20
[SW7-mst-region]instance  2 vlan 30  40
[SW7-mst-region]instance  3 vlan 15
[SW7-mst-region]instance  4 vlan 16
[SW7-mst-region] active region-configuration


[SW8]vlan batch  10 15  16 20 30 40 66 88 
[SW8]stp region-configuration
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW8-mst-region]active region-configuration 


[SW5]vlan batch 15 16
[SW5]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW5-mst-region]active region-configuration 

[SW5]stp instance  3 priority 4096
[SW5]stp instance  4 priority 8192


[SW6]vlan batch 15 16
[SW6]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW6-mst-region]active region-configuration 

[SW6]stp instance  3 priority 8192
[SW6]stp instance  4 priority 4096


[SW1]vlan batch 15 16
[SW1]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW1-mst-region]active region-configuration 

[SW2]vlan batch 15 16
[SW2]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW2-mst-region]active region-configuration 

[SW3]vlan batch 15 16
[SW3]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW3-mst-region]active region-configuration 

[SW4]vlan batch 15 16
[SW4]stp region-configuration 
[SW8-mst-region]instance  1 vlan 10  20
[SW8-mst-region]instance  2 vlan 30  40
[SW8-mst-region]instance  3 vlan 15
[SW8-mst-region]instance  4 vlan 16
[SW4-mst-region]active region-configuration 


第二步:实现R1和SW5和SW6互通

[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.15.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.16.2 24
[R1-GigabitEthernet0/0/1]quit


[SW5]int vlan15
[SW5-Vlanif15]ip address 192.168.15.5  24

[SW6]int vlan16
[SW6-Vlanif15]ip address 192.168.16.6  24


备注:R1和SW5.SW6的接口都配置完成了,形成直连路由了,但是R1和SW5.SW6为什么不通?

原因:二层不同
解决方案:接口要配置trunk 和access

[SW5]port-group group-member g0/0/9 g0/0/10
[SW5-port-group]port link-type trunk
[SW5-port-group]port trunk allow-pass vlan all

[SW6]port-group group-member g0/0/9 g0/0/10
[SW6-port-group]port link-type trunk
[SW6-port-group]port trunk allow-pass vlan all

[SW7]port-group group-member g0/0/9 g0/0/10  g0/0/24
[SW7-port-group]port link-type trunk
[SW7-port-group]port trunk allow-pass vlan all

[SW8]port-group group-member g0/0/9 g0/0/10   g0/0/24
[SW8-port-group]port link-type trunk
[SW8-port-group]port trunk allow-pass vlan all



[SW7]int g0/0/15
[SW7-GigabitEthernet0/0/15]port link-type access
[SW7-GigabitEthernet0/0/15]port default vlan 15


[SW8]int g0/0/20
[SW8-GigabitEthernet0/0/20]port link-type access
[SW8-GigabitEthernet0/0/20]port default vlan 16

验证:
SW5 ping  R1通
SW6 ping  R1通


第三步:配置OSPF实现内网互联互通
R1的配置:
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.15.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.16.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]


SW5的配置:
[SW5]ospf 1 router-id 5.5.5.5
[SW5-ospf-1]area  0
[SW5-ospf-1-area-0.0.0.0]network 192.168.15.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.0]quit
[SW5-ospf-1]area  10
[SW5-ospf-1-area-0.0.0.10]net  
[SW5-ospf-1-area-0.0.0.10]network 192.168.10.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.10]q  
[SW5-ospf-1]area  20
[SW5-ospf-1-area-0.0.0.20]network 192.168.20.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.20]quit
[SW5-ospf-1]area 30
[SW5-ospf-1-area-0.0.0.30]network 192.168.30.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.30]quit
[SW5-ospf-1]area 40
[SW5-ospf-1-area-0.0.0.40]network 192.168.40.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.40]quit
[SW5-ospf-1]area 88
[SW5-ospf-1-area-0.0.0.88]stub
[SW5-ospf-1-area-0.0.0.88]network 192.168.88.0 0.0.0.255
[SW5-ospf-1-area-0.0.0.88]

 备注:
只在SW5中创建area 88   宣告192.168.88.0/24
只在SW6中不需要创建area 88   不需要宣告192.168.88.0/24 

 
 SW6的配置:(只在SW6中不需要创建area 88   不需要宣告192.168.88.0/24) 

[SW6]ospf 1 router-id 6.6.6.6
[SW6-ospf-1]area 0
[SW6-ospf-1-area-0.0.0.0]network 192.168.16.0 0.0.0.255
[SW6-ospf-1-area-0.0.0.0]quit
[SW6-ospf-1]area 10  
[SW6-ospf-1-area-0.0.0.10]network 192.168.10.0 0.0.0.255
[SW6-ospf-1-area-0.0.0.10]quit
[SW6-ospf-1]area 20
[SW6-ospf-1-area-0.0.0.20]network 192.168.20.0 0.0.0.255
[SW6-ospf-1-area-0.0.0.20]quit
[SW6-ospf-1]area 30  
[SW6-ospf-1-area-0.0.0.30]network 192.168.30.0 0.0.0.255
[SW6-ospf-1-area-0.0.0.30]quit
[SW6-ospf-1]area 40
[SW6-ospf-1-area-0.0.0.40]network 192.168.40.0 0.0.0.255
[SW6-ospf-1-area-0.0.0.40]quit
[SW6-ospf-1]area 66
[SW6-ospf-1-area-0.0.0.66]network 192.168.66.0 0.0.0.255

验证:
所有的PC和server 都可以和R1互通
文章来源:https://blog.csdn.net/weixin_72194028/article/details/135152375
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。