RIP:Routing Information Protocol。RFC1058.c++
距離矢量協議:有間隔的多少和方向。傳遞的是路由條目。每一個路由器不知道網絡的完整拓撲結構,OSPF知道。shell
度量值:每種協議都有會計算出發點到目的地之間的度量也就是單位。rip的度量值(單位)是跳數。跳數超過15就不日後傳播了,也就是沒法到達目的地。微信
每30秒收斂一次。網絡
收斂:前面的路由會按期把本身的整個路由表發送給後面的路由器。rip是每30秒發送一次。負載均衡
rip有2個版本:oop
管理距離(AD):120。學習
路由表裏中括號裏的值就是管理距離。當用不一樣的協議,得到了相同的路由時,看哪一個協議得到的路由的管理距離小,路由表裏只能留下一個路由,留管理距離小的路由。code
例如:若是有下面2條路由,則只能留下[1/0]的路由,由於管理距離小。orm
S 192.168.1.0/24 [1/0] via 192.168.0.2 192.168.1.0/24 [1/0] via 192.168.0.2 R 192.168.1.0/24 [100/0] via 192.168.0.2 192.168.1.0/24 [1/0] via 192.168.0.2
使用UDP協議傳輸router
源和目的端口號都是520
報文形式:請求和響應報文,使用的格式相同。
默認支持等價負載均衡:4,最大可調到6.
添加後,接口當即生效,不須要開啓(no sh)。
#interface loopback ? <0-2147483647> Loopback interface number R1(config)#interface loopback 0 R1(config-if)# *Mar 1 00:08:43.587: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
添加後,在路由器上就多了一個虛擬接口
R1#show ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 12.1.1.1 YES manual up up Loopback0 1.1.1.1 YES manual up up
給換回接口添加ip,注意子網掩碼必須是255.255.255.255.表明主機的意思。
R1(config-if)#ip addr 1.1.1.1 255.255.255.255
1,進入全局模式,啓動rip
R1(config)#router rip R1(config-router)#
2,指定使用哪一個版本的rip。若是不指定版本的話,使用的既不是版本1,也不是版本2,而是1和2中間的版本,具體來講是:以廣播方式發送,既能接收廣播的也能接收組播的。
R1(config-router)#version 2 R1(config-router)#
3,關閉自動彙總:no auto-summary
R1(config-router)#no auto-summary R1(config-router)#
什麼是自動彙總?接口上的ip假如是12.1.1.1/24 ,自動彙總後,就變成了12.0.0.0/8,就至關於變成了版本1的有類路由協議了,不能精確到子網,因此,纔要關閉自動彙總。
4,告訴路由器,我要把本地的哪一個直連(C)的接口上的網段,用於rip協議,發送和接收rip包
R1:
R1(config-router)#do show ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 12.1.1.1 YES manual up up FastEthernet1/0 unassigned YES unset administratively down down Loopback0 1.1.1.1 YES manual up up R1(config-router)#do show ip route 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, FastEthernet0/0 R1(config-router)#network 1.1.1.1 R1(config-router)#net 12.1.1.0 R1(config-router)#
R2:
R2#show ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 12.1.1.2 YES manual up up FastEthernet1/0 23.1.1.2 YES manual up up Loopback0 2.2.2.2 YES manual up up R2#show ip route 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 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 R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#router rip R2(config-router)#net 2.2.2.2 R2(config-router)#net 23.1.1.0 R2(config-router)#net 12.1.1.0
R3:
R3#show ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 23.1.1.3 YES manual up up FastEthernet1/0 unassigned YES unset administratively down down Loopback0 3.3.3.3 YES manual up up R3#show ip route 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 23.0.0.0/24 is subnetted, 1 subnets C 23.1.1.0 is directly connected, FastEthernet0/0 R3#conf t Enter configuration commands, one per line. End with CNTL/Z. R3(config)#router rip R3(config-router)#ver 2 R3(config-router)#no au R3(config-router)#net 3.3.3.3 R3(config-router)#net 23.1.1.0
R1的路由條目:
注意:R 3.3.3.3 [120/2]裏面的【2】,含義:到目標網絡須要2跳
R1#show ip route 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets R 2.2.2.2 [120/1] via 12.1.1.2, 00:00:22, FastEthernet0/0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/2] via 12.1.1.2, 00:00:22, FastEthernet0/0 23.0.0.0/24 is subnetted, 1 subnets R 23.1.1.0 [120/1] via 12.1.1.2, 00:00:22, FastEthernet0/0 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, FastEthernet0/0
R2的路由條目:
R2#show ip route 1.0.0.0/32 is subnetted, 1 subnets R 1.1.1.1 [120/1] via 12.1.1.1, 00:00:21, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/1] via 23.1.1.3, 00:00:07, FastEthernet1/0 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
R3的路由條目:
R3#show ip route 1.0.0.0/32 is subnetted, 1 subnets R 1.1.1.1 [120/2] via 23.1.1.2, 00:00:15, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets R 2.2.2.2 [120/1] via 23.1.1.2, 00:00:15, FastEthernet0/0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 23.0.0.0/24 is subnetted, 1 subnets C 23.1.1.0 is directly connected, FastEthernet0/0 12.0.0.0/24 is subnetted, 1 subnets R 12.1.1.0 [120/1] via 23.1.1.2, 00:00:15, FastEthernet0/0
33-35集講RIP協議