实验需求
1、让 R3 可以学到R1的 192.168.10.0/24和192.168.20.0/24的 路由,不能学到192.168.30.0/24。
2、让 R1可以学到 R3 的 172.16.20.0/24和172.16.30.0/24的路由,不能学到 172.16.10.0/24,并且cost 设置为 10。
拓扑
配置
AR1
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn AR1
[AR1]undo info-center en
Info: Information center is disabled.
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 12.1.1.1 30
[AR1-GigabitEthernet0/0/0]QU
##创建三个回访口,并配置规划好的IP地址
[AR1]int LoopBack 1
[AR1-LoopBack1]ip address 192.168.10.1 24
[AR1-LoopBack1]qu
[AR1]int lo2
[AR1-LoopBack2]ip address 192.168.20.1 24
[AR1-LoopBack2]qu
[AR1]int lo3
[AR1-LoopBack3]ip address 192.168.30.1 24
[AR1-LoopBack3]qu
## 进入RIP进程1,修改RIP版本为2,宣告的时候不用带掩码
[AR1]rip
[AR1-rip-1]version 2
[AR1-rip-1]network 12.0.0.0
[AR1-rip-1]network 192.168.10.0
[AR1-rip-1]network 192.168.20.0
[AR1-rip-1]network 192.168.30.0
[AR1-rip-1]quit
AR2
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR2
[AR2]undo info-center enable
Info: Information center is disabled.
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 12.1.1.2 30
[AR2-GigabitEthernet0/0/0]qu
[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 23.1.1.1 30
[AR2-GigabitEthernet0/0/1]qu
[AR2]rip
[AR2-rip-1]version 2
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]quit
[AR2]ospf 10 router-id 2.2.2.2
[AR2-ospf-10]area 0
[AR2-ospf-10-area-0.0.0.0]network 23.1.1.0 0.0.0.3
[AR2-ospf-10-area-0.0.0.0]quit
需求1
## 选择要放行的流量
[AR2]acl 2000
[AR2-acl-basic-2000]rule permit source 192.168.10.0 0.0.0.255
[AR2-acl-basic-2000]rule permit source 192.168.20.0 0.0.0.255
[AR2-acl-basic-2000]qu
## 创建路由策略“Learn_R1”,动作允许,序号为10
[AR2]route-policy Learn_R1 permit node 10
[AR2-route-policy]if-match acl 2000 ## 包含ACL 2000流量
[AR2-route-policy]quit
## 将RIP进程1 导入OSPF进程10中
[AR2]ospf 10
[AR2-ospf-10]import-route rip 1 route-policy Learn_R1
[AR2-ospf-10]qu
需求2
[AR2]acl 2001
[AR2-acl-basic-2001]rule permit source 172.16.20.0 0.0.0.255
[AR2-acl-basic-2001]rule permit source 172.16.30.0 0.0.0.25
[AR2-acl-basic-2001]qu
[AR2]route-policy Learn_R3 permit node 10
Info: New Sequence of this List.
[AR2-route-policy]if-match acl 2001
[AR2-route-policy]apply cost 10
## 将OSPF进程10 导入RIP进程1中
[AR2]rip
[AR2-rip-1]import-route ospf 10 route-policy Learn_R3
[AR2-rip-1]qu
AR3
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn AR3
[AR3]undo info-center en
Info: Information center is disabled.
[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip address 23.1.1.2 30
[AR3-GigabitEthernet0/0/0]qu
##创建三个回访口,并配置规划好的IP地址
[AR3]int lo1
[AR3-LoopBack1]ip address 172.16.10.1 24
[AR3-LoopBack1]qu
[AR3]int lo2
[AR3-LoopBack2]ip address 172.16.20.1 24
[AR3-LoopBack2]qu
[AR3]int lo3
[AR3-LoopBack3]ip address 172.16.30.1 24
[AR3-LoopBack3]qu
## 进入OSPF进程10,RID指定为3.3.3.3 ,并进去骨干区域0宣告自己内部流量
[AR3]ospf 10 router-id 3.3.3.3
[AR3-ospf-10]area 0
[AR3-ospf-10-area-0.0.0.0]network 172.16.10.0 0.0.0.255
[AR3-ospf-10-area-0.0.0.0]network 172.16.20.0 0.0.0.255
[AR3-ospf-10-area-0.0.0.0]network 172.16.30.0 0.0.0.255
[AR3-ospf-10-area-0.0.0.0]network 23.1.1.0 0.0.0.3
检验
AR1身上已经学到了AR3的两条路由,并且跳数设置为11
AR1到AR2需要1跳,AR1又从AR2身上学到了AR3的两条路由,跳数又为10
所以总得跳数就为11啦,说明实验效果成功啦
此时AR3已经学到了AR1的192.168.10.0/24和192.168.20.0/24