我們的目的是希望所有Router都收到除了其他Router Fa interface上的Routing,但Router0和Router1所有的網段是在同一個major net(172.16.0.0/16),所以每個Router收到的routing必須是
subnet過後的。
Router0:
configuration:
interface FastEthernet0/0
ip address 172.16.1.254 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.2.254 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1/0
ip address 10.1.1.1 255.255.255.252
clock rate 19200
!
interface Serial0/1/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
version 2
network 10.0.0.0
network 172.16.0.0
no auto-summary
!
ip classless
RIP需要設定v2,否則其他Router收到的會是summary過後的routing(Classful only)
=======================================================================
Router1:
configuration:
interface FastEthernet0/0
ip address 192.168.1.254 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.254 255.255.255.0
duplex auto
speed auto
!
interface Ethernet0/0/0
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
ip address 10.1.1.2 255.255.255.252
!
interface Serial0/1/1
ip address 10.2.2.1 255.255.255.252
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
redistribute rip subnets
network 10.2.2.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0
!
router rip
version 2
redistribute ospf 1 metric 2
network 10.0.0.0
network 192.168.1.0
no auto-summary
!
ip classless
!
1.Router0無法收到Router2的subnet routing,必須在RIP的redistribution設定中設定metric值,
這個值範圍可為0~16,但必須設定1~15(我設定2),否則無法學習完整的路由(設定15,無
法學到192.168.2.0/24)。
2.RIPv2需要設定no auto-summary,否則Router0收到的不是172.16.3.0/24、172.16.4.0/24,而
是summary過後的172.16.0.0/16。
no auto-summary指的是設定的那一台Router送出去的的是沒有summary過後的Routing。
所以如果Router1不下這個指令, Router0收到的不是172.16.3.0/24、172.16.4.0/24,而
是summary過後的172.16.0.0/16。
同樣的,如果Router0不下這個指令, Router1收到的不是172.16.1.0/24、172.16.2.0/24,而
是summary過後的172.16.0.0/16。
3.RIPv2 redistribute到OSPF需要設定subnet,否則Router2收到的不是172.16.1.0/24、
172.16.2.0/24,而 是summary過後的172.16.0.0/16。
=======================================================================
Router2:
configuration:
interface FastEthernet0/0
ip address 172.16.3.254 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.4.254 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1/0
no ip address
clock rate 2000000
!
interface Serial0/1/1
ip address 10.2.2.2 255.255.255.252
clock rate 19200
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 10.2.2.0 0.0.0.3 area 0
network 172.16.3.0 0.0.0.255 area 0
network 172.16.4.0 0.0.0.255 area 0
!
ip classless
=======================================================================
Router0:
show ip route :
10.0.0.0/30 is subnetted, 2 subnets
C 10.1.1.0 is directly connected, Serial0/1/0
R 10.2.2.0 [120/1] via 10.1.1.2, 00:00:06, Serial0/1/0
172.16.0.0/24 is subnetted, 4 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, FastEthernet0/1
R 172.16.3.0 [120/2] via 10.1.1.2, 00:00:06, Serial0/1/0
R 172.16.4.0 [120/2] via 10.1.1.2, 00:00:06, Serial0/1/0
R 192.168.1.0/24 [120/1] via 10.1.1.2, 00:00:06, Serial0/1/0
R 192.168.2.0/24 [120/2] via 10.1.1.2, 00:00:06, Serial0/1/0
=======================================================================
Router1:
show ip route :
Router#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
10.0.0.0/30 is subnetted, 2 subnets
C 10.1.1.0 is directly connected, Serial0/1/0
C 10.2.2.0 is directly connected, Serial0/1/1
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.1.0 [120/1] via 10.1.1.1, 00:00:13, Serial0/1/0
R 172.16.2.0 [120/1] via 10.1.1.1, 00:00:13, Serial0/1/0
O 172.16.3.0 [110/65] via 10.2.2.2, 00:16:44, Serial0/1/1
O 172.16.4.0 [110/65] via 10.2.2.2, 00:16:44, Serial0/1/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
=======================================================================
Router2:
show ip route :
Router#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
10.0.0.0/30 is subnetted, 2 subnets
O E2 10.1.1.0 [110/20] via 10.2.2.1, 00:22:10, Serial0/1/1
C 10.2.2.0 is directly connected, Serial0/1/1
172.16.0.0/24 is subnetted, 4 subnets
O E2 172.16.1.0 [110/20] via 10.2.2.1, 00:22:10, Serial0/1/1
O E2 172.16.2.0 [110/20] via 10.2.2.1, 00:22:10, Serial0/1/1
C 172.16.3.0 is directly connected, FastEthernet0/0
C 172.16.4.0 is directly connected, FastEthernet0/1
O E2 192.168.1.0/24 [110/20] via 10.2.2.1, 00:22:10, Serial0/1/1
O 192.168.2.0/24 [110/65] via 10.2.2.1, 00:22:10, Serial0/1/1
從任何其他Routing protocol redistribute到OSPF的default metric為20
而各Routing protocol的redistribution default metric如下:
Source | Into |
| RIP | EIGRP | OSPF | ISIS | BGP (MED) |
Connected | 1 | Int metric | 20 (E2) | 0 | 0 |
Static | 1 | Int metric | 20 (E2) | 0 | 0 |
RIP | | Infinite | 20 (E2) | 0 | IGP metric |
EIGRP | Infinite | | 20 (E2) | 0 | IGP metric |
OSPF | Infinite | Infinite | | 0 | IGP metric |
ISIS | Infinite | Infinite | 20 (E2) | | IGP metric |
BGP | Infinite | Infinite | 1 (E2) | 0
|