1.配置IP环回
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 100.1.1.1 24
Apr 23 2024 19:35:08-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]interface l0
[R1-LoopBack0]ip address 192.168.0.1 32
[R1-LoopBack0]q
[R1]interface l1
[R1-LoopBack1]ip address 192.168.1.1 32
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 100.1.1.2 24
Apr 23 2024 19:39:15-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]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 100.2.2.2 24
Apr 23 2024 19:40:52-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 100.2.2.3 24
Apr 23 2024 19:41:26-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]q
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 100.3.3.3 24
Apr 23 2024 19:41:40-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]q
[R3]int l0
[R3-LoopBack0]ip address 192.168.2.1 32
[R3-LoopBack0]q
[R3]int l1
[R3-LoopBack1]ip address 192.168.3.1 32
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 100.3.3.4 24
Apr 23 2024 19:42:30-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]q
[R4]int l0
[R4-LoopBack0]ip address 192.168.4.1 32
[R4-LoopBack0]q
[R4]int l1
[R4-LoopBack1]ip address 192.168.5.1 32
2.宣告网段
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]net
[R1-rip-1]network 100.0.0.0
[R1-rip-1]net 192.168.0.0
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo summary
[R2-rip-1]net 100.0.0.0
[R2-rip-1]q
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]ne 100.2.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R3]ospf 1 rou
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]net 192.168.2.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 192.168.3.1 0.0.0.0
[R3-ospf-1-area-0.0.0.1]net 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]net 100.3.3.0 0.0.0.255
[R4-ospf-1-area-0.0.0.1]net 192.168.4.1 0.0.0.0
[R4-ospf-1-area-0.0.0.1]net 192.168.5.1 0.0.0.0
3.路由引入
[R2]rip 1
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route r
[R2-ospf-1]import-route rip
查看
[R1]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 6 Routes : 6
RIP routing table status : <Active>
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.2.2.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
100.3.3.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.2.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.3.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.4.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.5.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
[R4]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 5 Routes : 5
OSPF routing table status : <Active>
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.1.1.0/24 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
100.2.2.0/24 OSPF 10 2 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.0.1/32 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.2.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.3.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
4.路由过滤
[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
Info: New Sequence of this List.
[R2-route-policy]if-match acl 2000
[R2-rip-1]import-route ospf 1 route-policy o2r
查看:
[R1]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 4 Routes : 4
RIP routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.2.2.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
100.3.3.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.2.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.3.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
[R4]ip ip-prefix aa index 10 deny 192.168.0.0 23 less-equal 32
[R4]ip ip-prefix aa index 20 permit 0.0.0.0 0 less-equal 32
[R4-ospf-1]filter-policy ip-prefix aa import
查看
[R4]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.1.1.0/24 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
100.2.2.0/24 OSPF 10 2 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.2.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.3.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R4]
5.oSPF 区域中不能出现 RIP 协议报文
[R2-rip-1]silent-interface GigabitEthernet 0/0/1
笔记