配置思路:
1.IP配置:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad 100.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip ad 192.168.0.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip ad 192.168.1.1 32
[R1-LoopBack1]q
dis ip int brief 检查接口是否双up
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 100.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad 100.2.2.2 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad 100.2.2.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip ad 100.3.3.3 24
[R3-GigabitEthernet0/0/1]int l0
[R3-LoopBack0]ip ad 192.168.2.1 32
[R3-LoopBack0]int l1
[R3-LoopBack1]ip ad 192.168.3.1 32
[R3-LoopBack1]
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 100.3.3.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip ad 192.168.4.1 32
[R4-LoopBack0]int l1
[R4-LoopBack1]ip ad 192.168.5.1 32
2、配置RIP和OSPF协议
RIP1:
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]network 100.0.0.0
[R1-rip-1]network 192.168.0.0
[R1-rip-1]network 192.168.1.0[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo summary
[R2-rip-1]network 100.0.0.0
OSPF:
area 0:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0area 1:
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ne 100.3.3.0 0.0.0.255[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 1
[R4-ospf-1-area-0.0.0.1]network 100.3.3.0 0.0.0.255
[R4-ospf-1-area-0.0.0.1]ne 192.168.4.1 0.0.0.0
[R4-ospf-1-area-0.0.0.1]ne 192.168.5.1 0.0.0.0
在R2上路由引入:
[R2]rip 1
[R2-rip-1]import-route ospf 1[R2]ospf 1
[R2-ospf-1]import-route rip 1
对于问题三、问题四没有过滤时的路由表
3、在R2上路由过滤
R4汇总后的网段192.168.4.0/23(网段汇总保留到相同的部分后面就去掉)不允许通过,其他通过
抓取流量:
[R2]acl 2000[R2]acl 2000
[R2-acl-basic-2000]rule deny source 192.168.4.0 0.0.1.255
[R2-acl-basic-2000]rule permit source 0.0.0.0 255.255.255.255写策略:
[R2]route-policy o2r permit node 10 (这里的o2r只是你自己取的名字,节点也是)
[R2-route-policy]if-match acl 2000调用策略:
[R2]rip 1
[R2-rip-1]import-route ospf 1 route-policy o2r
4、在R4上的进入方向进行路由过滤(地址前缀列表)
地址前缀列表:
[R4]ip ip-prefix aa index 10 deny 192.168.0.0 23 less-equal 32(192.168.0.0 23是将R1上的环回网段进行汇总后的地址)
[R4]ip ip-prefix aa index 20 permit 0.0.0.0 0 less-equal 32
[R4]ospf 1
[R4-ospf-1]filter-policy ip-prefix aa import
过滤后的路由表:
5、对于最后一个问题:因为配置RIP协议时宣告100.0.0.0将在OSPS协议里的g0/0/1口也宣告进去了所以我们需要将这个接口静默然后就可以不让RIP协议进入OSPF区域里面了
[R2]rip 1
[R2-rip-1]si
[R2-rip-1]silent-interface g0/0/1