1.配置IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.1.1 24
Apr 24 2024 20:52:10-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 192.168.0.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.1 32
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
Apr 24 2024 20:54:20-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.2.2.2 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.2.2.3 24
Apr 24 2024 20:56:08-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 100.3.3.3 24
Apr 24 2024 20:56:26-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]int l0
[R3-LoopBack0]ip add 192.168.2.1 32
[R3-LoopBack0]int l1
[R3-LoopBack1]ip add 192.168.3.1 32
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 100.3.3.4 24
Apr 24 2024 20:57:36-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 192.168.4.1 32
[R4-LoopBack0]int l1
[R4-LoopBack1]ip add 192.168.5.1 32
2.配置路由协议
(1)rip
[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
(2)ospf
a. 区域0
[R2]ospf 1 router-id 1.1.1.1
[R2-ospf-1]area 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]area 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.0
b.区域1
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 100.3.3.0 0.0.0.255
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[R4-ospf-1-area-0.0.0.1]
3.路由引入
[R2]rip 1
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route rip
4.路由过滤
[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-acl-basic-2000]q
[R2]route-policy o2r permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match acl 2000
[R2-route-policy]q
[R2]rip 1
[R2-rip-1]import-route ospf 1 route-policy o2r
[R2-rip-1]q
5.使用地址前缀列表使R4无法学习到R1的业务网段路由
[R4]ip ip-prefix aaa index 10 deny 192.168.0.0 23 less-equal 32
[R4]ip ip-prefix aaa index 20 permit 0.0.0.0 0 less-equal 32
[R4]ospf 1
[R4-ospf-1]filter-policy ip-prefix aaa import
[R4-ospf-1]
6.ospf区域不出现rip协议报文
[R2]rip 1
[R2-rip-1]silent-interface GigabitEthernet 0/0/1