1. 程式人生 > >4-高級路由:RIP默認路由

4-高級路由:RIP默認路由

nat 0.0.0.0 fast form http ext via 分享 rect

一、實驗拓撲:

二、命令部署:
1、基本部署:
R1(config)#int f0/0
R1(config-if)#no shutdown
R1(config-if)#ip add 14.1.1.1 255.255.255.0
R1(config-if)#int f1/0
R1(config-if)#no shutdown
R1(config-if)#ip add 12.1.1.1 255.255.255.0

R1(config)#router rip
R1(config-router)#network 14.1.1.1
R1(config-router)#network 12.1.1.1

R2(config-if)#int f0/0

R2(config-if)#no shutdown
R2(config-if)#ip add 12.1.1.2 255.255.255.0
R2(config-if)#int f1/0
R2(config-if)#no shutdown
R2(config-if)#ip add 23.1.1.2 255.255.255.0

R2(config)#router rip
R2(config-router)#network 12.1.1.2
R2(config-router)#network 23.1.1.2

R3(config)#int f0/0
R3(config-if)#no shutdown
R3(config-if)#ip add 23.1.1.3 255.255.255.0

R3(config)#router rip
R3(config-router)#network 23.1.1.3

R4(config)#int f0/0
R4(config-if)#no shutdown
R4(config-if)#ip add 14.1.1.4 255.255.255.0

R4(config)#int lo1
R4(config-if)#ip add 4.4.4.4 255.255.255.0

2、重點部署:
①第一種方法:互指默認路由,在邊界路由器R1 RIP協議內重分發靜態路由。
R1(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.4
R4(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.1

R1(config)#router rip
R1(config-router)#redistribute static

②第二種方法:互指默認路由,在邊界路由器R1 RIP協議內宣告0.0.0.0網段。
R1(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.4
R4(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.1

R1(config)#router rip
R1(config-router)#network 0.0.0.0

③第三種方法(推薦使用此方法):互指默認路由,在邊界路由器R1 RIP協議內部署:default-information originate(強制讓身後R2、R3獲得帶*默認路由)
R1(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.4
R4(config)#ip route 0.0.0.0 0.0.0.0 14.1.1.1

R1(config)#router rip
R1(config-router)#default-information originate

④第四種方法:
R1(config)#no ip route 0.0.0.0 0.0.0.0 14.1.1.4
R4(config)#no ip route 0.0.0.0 0.0.0.0 14.1.1.1

R1(config)#ip default-network 14.0.0.0
R1(config)#router rip
R1(config-router)#network 14.0.0.0

三、驗證:
①第一種方法:
未重分發前:
R2#show ip route
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R 14.0.0.0/8 [120/1] via 12.1.1.1, 00:00:15, FastEthernet0/0
測試:R2#ping 4.4.4.4 顯示不通

重分發後:
R2#show ip route
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R 14.0.0.0/8 [120/1] via 12.1.1.1, 00:00:03, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 12.1.1.1, 00:00:03, FastEthernet0/0
測試:R2#ping 4.4.4.4 成功Ping 通
同理:R3和R2顯示效果一樣。
②第二種方法:
此處R1的SecureCRT卡住了,可能是新版本不允許這樣。

③第三種方法:
R2#show ip route
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R 14.0.0.0/8 [120/1] via 12.1.1.1, 00:00:04, FastEthernet0/0
R 0.0.0.0/0 [120/1] via 12.1.1.1, 00:00:04, FastEthernet0/0
測試:R2#ping 4.4.4.4 成功Ping 通
同理:R3和R2顯示效果一樣。
④第四種方法:
R2#show ip route
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R 14.0.0.0/8 [120/1] via 12.1.1.1, 00:00:01, FastEthernet0/0
R
0.0.0.0/0 [120/1] via 12.1.1.1, 00:00:01, FastEthernet0/0
測試:R2#ping 4.4.4.4 不通很正常,因為沒有到4.4.4.4的路由條目。
技術分享圖片

4-高級路由:RIP默認路由