实验要求
实验步骤
1.基本配置
例
R1
interface Serial4/0/0 link-protocol ppp ip address 12.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 ip address 14.1.1.1 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.0
动态路由配置
例
R1
rip 1
version 2
network 12.0.0.0
network 14.0.0.0
network 1.0.0.0
R2
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 34.1.1.0 0.0.0.255
重发布
R2
ospf 1 router-id 2.2.2.2
import-route rip 1 route-policy aa
area 0.0.0.0
network 23.1.1.0 0.0.0.255
#
ospf 12
#
rip 1
version 2
network 2.0.0.0
network 12.0.0.0
import-route ospf 1
R4
ospf 1 router-id 4.4.4.4
import-route rip 1 route-policy aa
area 0.0.0.0
network 4.4.4.0 0.0.0.255
network 34.1.1.0 0.0.0.255
#
rip 1
version 2
network 14.0.0.0
import-route ospf 1
路由策略
RIP
偏移列表
R1
#
ip ip-prefix a index 5 permit 23.1.1.0 24
ip ip-prefix a index 10 permit 4.4.4.0 24
ip ip-prefix aa index 10 permit 34.1.1.0 24
#
interface GigabitEthernet0/0/1
ip address 14.1.1.1 255.255.255.0
rip metricin ip-prefix a 10
OSPF
router-policy---路由策略
R2
#
route-policy aa permit node 10
if-match ip-prefix a
apply cost-type type-1
#
route-policy aa permit node 20
if-match ip-prefix b
apply cost-type type-1
#
route-policy aa permit node 30
#
ip ip-prefix b index 10 permit 12.1.1.0 24
ip ip-prefix a index 10 permit 2.2.2.0 24
#
ospf 1 router-id 2.2.2.2
import-route rip 1 route-policy aa
R4
#
route-policy aa permit node 10
if-match ip-prefix a
apply cost-type type-1
#
route-policy aa permit node 20
#
ip ip-prefix a index 10 permit 14.1.1.0 24
#
ospf 1 router-id 4.4.4.4
import-route rip 1 route-policy aa
实验效果
R1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 19 Routes : 20
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.0/24 RIP 100 1 D 12.1.1.2 Serial4/0/0
3.3.3.3/32 RIP 100 1 D 12.1.1.2 Serial4/0/0
RIP 100 1 D 14.1.1.4 GigabitEthernet
0/0/1
4.4.4.0/24 RIP 100 1 D 12.1.1.2 Serial4/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 Serial4/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
12.1.1.2/32 Direct 0 0 D 12.1.1.2 Serial4/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
14.1.1.0/24 Direct 0 0 D 14.1.1.1 GigabitEthernet
0/0/1
14.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
14.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.1.1.0/24 RIP 100 1 D 12.1.1.2 Serial4/0/0
34.1.1.0/24 RIP 100 1 D 14.1.1.4 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
R3
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 20 Routes : 21
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 O_ASE 150 1 D 23.1.1.2 Serial4/0/0
O_ASE 150 1 D 34.1.1.4 Serial4/0/1
2.2.2.0/24 O_ASE 150 49 D 23.1.1.2 Serial4/0/0
3.3.3.0/24 Direct 0 0 D 3.3.3.3 LoopBack0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.0/24 OSPF 10 48 D 34.1.1.4 Serial4/0/1
12.1.1.0/24 O_ASE 150 49 D 23.1.1.2 Serial4/0/0
14.1.1.0/24 O_ASE 150 49 D 34.1.1.4 Serial4/0/1
23.1.1.0/24 Direct 0 0 D 23.1.1.3 Serial4/0/0
23.1.1.2/32 Direct 0 0 D 23.1.1.2 Serial4/0/0
23.1.1.3/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
23.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
34.1.1.0/24 Direct 0 0 D 34.1.1.3 Serial4/0/1
34.1.1.3/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
34.1.1.4/32 Direct 0 0 D 34.1.1.4 Serial4/0/1
34.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0