实验要求
实验拓扑
实验步骤
1.IP配置
R1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int l0
[R1-LoopBack0]ip add 172.16.0.1 26
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
R2配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int l0
[R2-LoopBack0]ip add 172.16.0.65 26
[R2-LoopBack0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
R3配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int l0
[R3-LoopBack0]ip add 172.16.128.1 27
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.1.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
R4配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int l0
[R4-LoopBack0]ip add 172.16.128.33 27
[R4-LoopBack0]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
[R4-GigabitEthernet0/0/2]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/1]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 24.1.1.2 24
R5配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int l0
[R5-LoopBack0]ip add 172.16.128.65 27
[R5-LoopBack0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
R6配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R6
[R6]int l0
[R6-LoopBack0]ip add 172.16.128.97 27
[R6-LoopBack0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
[R6-GigabitEthernet0/0/1]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
R7配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R7
[R7]int l0
[R7-LoopBack0]ip add 7.7.7.7 24
[R7-LoopBack0]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
2.RIP和OSPF协议配置
RIP配置
R1RIP配置
[R1]rip 1
[R1-rip-1]ver 2
[R1-rip-1]network 172.16.0.0
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 13.0.0.0
R2RIP配置
[R2]rip 1
[R2-rip-1]ver 2
[R2-rip-1]network 172.16.0.0
[R2-rip-1]network 12.0.0.0
R3RIP配置
[R3]rip 1
[R3-rip-1]ver 2
[R3-rip-1]network 13.0.0.0
R2OSPF配置
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
R3OSPF配置
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.128.0 0.0.0.31
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
R4OSPF配置
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.128.32 0.0.0.31
[R4-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 45.1.1.0 0.0.0.255
R5OSPF配置
[R5]ospf 1
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 45.1.1.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 172.16.128.64 0.0.0.31
[R5-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255
R6OSPF配置
[R6]ospf 1
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 172.16.128.96 0.0.0.31
R7OSPF配置
[R7]ospf 1
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255
3.在R7上配置OSPF直连路由重发布,再在R2/3上路由重发布
R7OSPF重发布
[R7-ospf-1]import-route direct
R2路由重发布
[R2]ospf 1
[R2-ospf-1]import-route rip
[R2-ospf-1]q
[R2]rip
[R2-rip-1]import-route ospf 1
R3路由重发布
[R3]ospf 1
[R3-ospf-1]import-route rip
[R3-ospf-1]q
[R3]rip 1
[R3-rip-1]import-route ospf 1
4.路由策略
R1路由策略
[R1]ip ip-prefix a7 permit 7.7.7.0 24
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]rip metricout ip-prefix a7 3
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]rip metricout ip-prefix a7 3
[R1]ip ip-prefix a2 permit 172.16.0.64 26
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]rip metricin ip-prefix a2 5
R2路由策略
[R2]ip ip-prefix a34 permit 34.1.1.0 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]rip metricout ip-prefix a34 5
[R2]ip ip-prefix a permit 172.16.0.0 26
[R2]route-policy huawei permit node 10
[R2-route-policy]if-match ip-prefix a
[R2-route-policy]apply cost-type type-1
[R2-route-policy]q
[R2]route-policy huawei permit node 20
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]import-route rip 1 route-policy huawei
R3路由策略
[R3]ip ip-prefix a24 permit 24.1.1.0 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]rip metricout ip-prefix a24 5
[R3]ip ip-prefix a permit 172.16.0.0 26
[R3]route-policy huawei permit node 10
[R3-route-policy]if-match ip-prefix a
[R3-route-policy]apply cost-type type-1
[R3-route-policy]q
[R3]route-policy huawei permit node 20
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]import-route rip 1 route-policy huawei
测试