R2#show run
router ospf 1
log-adjacency-changes
redistribute rip metric 200 subnets (把
RIP发进
OSPF过来的
cost 我定义为
200)
network 172.16.255.0 0.0.0.3 area 0
!
router rip
redistribute ospf 1 metric 11 (把
ospf 发进
RIP过来的
cost 我定义为
11)
network 192.168.1.0
|
R1# sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R
172.16.0.0/16 [120/11] via 192.168.1.2, 00:00:07, Serial1/1(ospf那边过来的
,RIP把它当
R)
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
|
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/30 is subnetted, 3 subnets
C 172.16.255.0 is directly connected, Serial1/0
C 172.16.255.4 is directly connected, Serial1/1
O 172.16.255.8 [110/128] via 172.16.255.6, 00:49:26, Serial1/1
O E2 10.0.0.0/8 [110/200] via 172.16.255.1, 00:49:26, Serial1/0
O E2 192.168.1.0/24 [110/200] via 172.16.255.1, 00:49:26, Serial1/0
(通过
R2过来的定义了
200)
O E1 192.168.2.0/24 [110/328] via 172.16.255.6, 00:49:26, Serial1/1
(通过
R5过来的,那么为什么是
328呢?这条路由经过
R5过来的,它会以
R5上的重分发的
cost值计算,因为我在
R5重发布的时候做了
redistribute rip metric 200 metric-type 1 subnets 这样就会叠加经过
ospf 区域的
cost
:RIP
à
OSPF (cost 200) + R4―>R5 (cost 64) + R3―>R4 (cost 64) = cost 328)
|
R5#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/30 is subnetted, 3 subnets
O 172.16.255.0 [110/192] via 172.16.255.9, 00:03:00, Serial1/0
O 172.16.255.4 [110/128] via 172.16.255.9, 00:03:00, Serial1/0
C 172.16.255.8 is directly connected, Serial1/0
O E2 10.0.0.0/8 [110/200] via 172.16.255.9, 00:02:59, Serial1/0
(居然绕了
4个路由器
)
O E2 192.168.1.0/24 [110/200] via 172.16.255.9, 00:02:59, Serial1/0
(也绕远了
,不直接通过
R1走
)
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R5#
|
R5(config)#access-list 1 permit 10.0.0.0 0.255.255.255(
建立一个对目的网络的访问控制列表)
R5(config)#router rip
R5(config-router)#distance 85 192.168.2.0 0.0.0.255 1(
定义到R1的管理距离为85匹配access-list1)
|
R5#show access-lists 1
Standard IP access list 1
10
ermit 10.0.0.0, wildcard bits 0.255.255.255 (1 match) 已经有
1个匹配了
|
R5#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/30 is subnetted, 3 subnets
O 172.16.255.0 [110/192] via 172.16.255.9, 02:32:03, Serial1/0
O 172.16.255.4 [110/128] via 172.16.255.9, 02:32:03, Serial1/0
C 172.16.255.8 is directly connected, Serial1/0
R
10.0.0.0/8 [85/1] via 192.168.2.1, 00:00:11, FastEthernet0/0 (
现在变成R了,并且走R1了
)
O E2 192.168.1.0/24 [110/200] via 172.16.255.9, 00:09:57, Serial1/0(
这条路径加一条ACL就能改到走R1了,那样将会变成R不会是O E2
)
C 192.168.2.0/24 is directly connected, FastEthernet0/0
|
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/30 is subnetted, 3 subnets
C 172.16.255.0 is directly connected, Serial1/1
O 172.16.255.4 [110/128] via 172.16.255.2, 02:46:52, Serial1/1
O 172.16.255.8 [110/192] via 172.16.255.2, 02:46:52, Serial1/1
O E1 10.0.0.0/8 [110/392] via 172.16.255.2, 00:15:01, Serial1/1
C 192.168.1.0/24 is directly connected, Serial1/0
O E1 192.168.2.0/24 [110/392] via 172.16.255.2, 02:46:52, Serial1/1
R2#
|
R2(config)#access-list 1 permit 10.0.0.0 0.0.0.255 (建立第
一个到目的网络的访问控制列表
)
R2(config)#access-list 1 permit 192.168.2.0 0.0.0.255(建立第二
个到目的网络的访问控制列表
)
R2(config)#router rip
R2(config-router)#distance 85 192.168.1.1 0.0.0.0 1 (设定到
R1的管理距离
)
|
R2(config-router)#do sho ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/30 is subnetted, 3 subnets
C 172.16.255.0 is directly connected, Serial1/1
O 172.16.255.4 [110/128] via 172.16.255.2, 04:12:19, Serial1/1
O 172.16.255.8 [110/192] via 172.16.255.2, 04:12:19, Serial1/1
R 10.0.0.0/8 [85/1] via 192.168.1.1, 00:00:18, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
R 192.168.2.0/24 [85/1] via 192.168.1.1, 00:00:18, Serial1/0
|