实验要求:
1、使用双点双向重发布
2、所有路由器进行最佳选路
3、存在备份路径,不得出现环路,和路由回馈
实验拓扑:
实验步骤:
1/子网划分,IP地址规划
172.16.0.0/16
通过该拓扑图可以发现有2个区域,其中划分4个网段,172.16.0.0/22借2位。
172.16.1.0 24
172.16.2.0 24
172.16.3.0 24
172.16.4.0 24
2.2.2.2 32
4.4.4.4 32
将IP配给设备接口地址
设备 | 接口 | 地址 |
R1 | G0/0/0 | 172.16.1.1 24 |
G0/0/1 | 172.16.3.1 24 | |
R2 | G0/0/0 | 172.16.1.2 24 |
G0/0/1 | 172.16.2.1 24 | |
环回 | 2.2.2.2 32 | |
R3 | G0/0/0 | 172.16.2.2 24 |
G0/0/1 | 172.16.4.2 24 | |
R4 | G0/0/0 | 172.16.3.2 24 |
G0/0/1 | 172.16.4.1 24 | |
环回 | 4.4.4.4 32 |
2、更改设备名称
[Huawei]sysname R1/R2/R3/R4
3、配置IP和环回地址
R1配置:
[R1]int G 0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.16.1.1 24
[R1]int G 0/0/1
[R1-GigabitEthernet0/0/1]ip address 172.16.3.1 24
R2配置:
[R2]int G 0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.1.2 24
[R2]int G 0/0/1
[R2-GigabitEthernet0/0/1]ip address 172.16.2.1 24
[R2]int LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 32
R3配置:
[R3]int G 0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.2.2 24
[R3]int G 0/0/1
[R3-GigabitEthernet0/0/1]ip address 172.16.4.2 24
R4配置:
[R4]int G 0/0/0
[R4-GigabitEthernet0/0/0]ip address 172.16.3.2 24
[R4]int G 0/0/1
[R4-GigabitEthernet0/0/1]ip address 172.16.4.1 24
[R4]int LoopBack 0
[R4-LoopBack0]ip address 4.4.4.4 32
4/启动RIP和ospf协议
R1配置:
[R1]rip 1
[R1-rip-1]version2
[R1-rip-1]network 172.16.1.0
[R1-rip-1]network 172.16.3.0
[R1]ip ip-prefix aa permit 172.6.2.0 24
[R1]ip ip-prefix bb permit 172.6.4.0 24
[R1]int G 0/0/0
[R1-GigabitEthernet0/0/0]rip metricin ip-prefix aa 5
[R1]int G 0/0/1
[R1-GigabitEthernet0/0/1]rip metricin ip-prefix bb 5
R2配置:
[R2]rip 1
[R2-rip-1]version2
[R2-rip-1]network 172.16.1.0
[R2-rip-1]network 2.0.0.0
[R2]ospf 1 route-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area 0]network 172.16.2.0 0.0.0.255
[R2]int T 0/0/0
[R2-Tunnel0/0/0]ospf network-type broadcast
[R2]ip ip-prefix aa permit 172.6.1.0 24
[R2]ip ip-prefix bb permit 172.6.2.0 24
[R2]ip ip-prefix aa permit 172.6.3.0 24
[R2]ip ip-prefix bb permit 172.6.4.0 24
[R2]route-policy huawei deny node 10
[R2-route-policy]if-match ip-prefix 1
[R2]route-policy huawei deny node 20
[R2-route-policy]if-match ip-prefix 2
[R2-route-policy]apply cost-type type-1
[R2]route-policy huawei deny node 30
[R2-route-policy]if-match ip-prefix 3
[R2-route-policy]apply cost 6
[R2]route-policy huawei deny node 40
[R2-route-policy]if-match ip-prefix 4
[R2-route-policy]apply cost-type type-1
[R2-route-policy]apply cost 9
[R2]ospf 1 route-id 2.2.2.2
[R2-ospf-1]import-route rip 1 route-policy huawei
R3配置:
[R3]ospf 1 route-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area 0]network 3.3.3.0 0.0.0.255
[R3-ospf-1-area 0]network 172.16.2.0 0.0.0.255
[R3-ospf-1-area 0]network 172.16.4.0 0.0.0.255
R4配置:
[R4]rip 1
[R4-rip-1]version2
[R4-rip-1]network 172.16.4.0
[R4-rip-1]network 4.0.0.0
[R4]ospf 1 route-id 2.2.2.2
[R4-ospf-1]area 0
[R4-ospf-1-area 0]network 172.16.4.0 0.0.0.255
[R4]int T 0/0/0
[R4-Tunnel0/0/0]ospf network-type broadcast
[R4]ip ip-prefix aa permit 172.6.1.0 24
[R4]ip ip-prefix bb permit 172.6.2.0 24
[R4]ip ip-prefix aa permit 172.6.3.0 24
[R4]ip ip-prefix bb permit 172.6.4.0 24
[R4]route-policy huawei deny node 10
[R4-route-policy]if-match ip-prefix 1
[R4]route-policy huawei deny node 20
[R4-route-policy]if-match ip-prefix 2
[R4-route-policy]apply cost-type type-1
[R4]route-policy huawei deny node 30
[R4-route-policy]if-match ip-prefix 3
[R4-route-policy]apply cost 6
[R4]route-policy huawei deny node 40
[R4-route-policy]if-match ip-prefix 4
[R4-route-policy]apply cost-type type-1
[R4-route-policy]apply cost 9
[R4]ospf 1 route-id 4.4.4.4
[R4-ospf-1]import-route rip 1 route-policy huawei
至此,实验完成。