cisco 3560 配置 rip 路由协议

简介:

路由信息协议(RIP)

简介
(RIP/RIP2/RIPng:Routing Information Protocol)
作为一种内部网关协议或 IGP(内部网关协议),路由选择协议应用于 AS 系统。连接 AS 系统有专门的协议,其中最早的这样的协议是“EGP”(外部网关协议),目前仍然应用于因特网,这样的协议通常被视为内部 AS 路由选择协议。RIP 主要设计来利用同类技术与大小适度的网络一起工作。因此通过速度变化不大的接线连接,RIP 比较适用于简单的校园网和区域网,但并不适用于复杂网络的情况。
RIP 2 由 RIP 而来,属于 RIP 协议的补充协议,主要用于扩大 RIP 2 信息装载的有用信息的数量,同时增加其安全性能。RIP 2 是一种基于 UDP 的协议。在 RIP2 下,每台主机通过路由选择进程发送和接受来自 UDP 端口520的数据包。RIP协议默认的路由更新周期是30S。
RIP的特点
(1)仅和相邻的路由器交换信息。如果两个路由器之间的通信不经过另外一个路由器,那么这两个路由器是相邻的。RIP协议规定,不相邻的路由器之间不交换信息。
(2)路由器交换的信息是当前本路由器所知道的全部信息。即自己的路由表。
(3)按固定时间交换路由信息,如,每隔30秒,然后路由器根据收到的路由信息更新路由表。
适用
RIP 和 RIP 2 主要适用于 IPv4 网络,而 RIPng 主要适用于 IPv6 网络。本文主要阐述 RIP 及 RIP 2。
RIPng:路由选择信息协议下一代(应用于IPv6)
(RIPng:RIP for IPv6)RIPng与RIP 1和 RIP 2 两个版本不兼容。
RIP协议的“距离”也称为“跳数”(hop count),因为每经过一个路由器,跳数就加1。RIP认为好的路由就是它通过的路由器的数目少,即“距离短”。RIP允许一条路径最多只能包含15个路由器。因此“距离”等于16时即相当于不可达。可见RIP只适用于小型互联网。
应用
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。文档见RFC1058、 RFC1723。
RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达
 

网络拓扑图
 

在拓扑图中两台 cisco 3560G 交换机 ,启用三层路由并且运行 rip 路由协议,用于交换自己的路由表,并学习对方的路由信息,一台 cisco 3560 与  cisco 2950 使用 trunk 端口用于交换vlan 信息,最后整个网络通过 linux nat 服务器与外网通信!

 

配置交换机

大厦 A 层交换机

 
  1. #conf ter 
  2. hostname 1F 
  3.  
  4. ip routing 
  5. vlan 100 
  6. vlan 101  
  7. vlan 102 
  8. vlan 103 
  9. vlan 104 
  10. vlan 105 
  11. vlan 106 
  12. vlan 107 
  13. vlan 108 
  14. vlan 109 
  15.  
  16. int fa0/1 
  17. sw mo acc 
  18. sw acc vlan 101 
  19.  
  20. int fa0/2 
  21. sw mo acc 
  22. sw acc vlan 102 
  23.  
  24. int fa0/3 
  25. sw mo acc 
  26. sw acc vlan 103 
  27.  
  28. int fa0/4 
  29. sw mo acc 
  30. sw acc vlan 104 
  31.  
  32. int fa0/5 
  33. sw mo acc 
  34. sw acc vlan 105 
  35.  
  36. int fa0/6 
  37. sw mo acc 
  38. sw acc vlan 106 
  39.  
  40. int fa0/7 
  41. sw mo acc 
  42. sw acc vlan 107 
  43.  
  44. int fa0/8 
  45. sw mo acc 
  46. sw acc vlan 108 
  47.  
  48. int fa0/9 
  49. sw mo acc 
  50. sw acc vlan 109 
  51.  
  52. int fa0/10 
  53. sw mo acc 
  54. sw acc vlan 100 
  55.  
  56. int vlan 100 
  57. ip add 192.168.50.1 255.255.255.0 
  58.  
  59. int vlan 101 
  60. ip add 192.168.51.1 255.255.255.0 
  61.  
  62. int vlan 102 
  63. ip add 192.168.52.1 255.255.255.0 
  64.  
  65. int vlan 103 
  66. ip add 192.168.53.1 255.255.255.0 
  67.  
  68. int vlan 104 
  69. ip add 192.168.54.1 255.255.255.0 
  70.  
  71. int vlan 105 
  72. ip add 192.168.55.1 255.255.255.0 
  73.  
  74. int vlan 106 
  75. ip add 192.168.56.1 255.255.255.0 
  76.  
  77. int vlan 107 
  78. ip add 192.168.57.1 255.255.255.0 
  79.  
  80. int vlan 108 
  81. ip add 192.168.58.1 255.255.255.0 
  82.  
  83. int vlan 109 
  84. ip add 192.168.59.1 255.255.255.0 
  85. exit 
  86.  
  87. int g0/1 
  88. no switchport  
  89. ip add 192.168.61.1 255.255.255.0 
  90. exit 
  91.  
  92. int g0/2 
  93. no switchport  
  94. ip add 192.168.0.2 255.255.255.0 
  95. exit 
  96.  
  97. router rip 
  98. ver 2 
  99. no auto-summary  
  100. network 192.168.50.0 
  101. network 192.168.51.0 
  102. network 192.168.52.0 
  103. network 192.168.53.0 
  104. network 192.168.54.0 
  105. network 192.168.55.0 
  106. network 192.168.56.0 
  107. network 192.168.57.0 
  108. network 192.168.58.0 
  109. network 192.168.59.0 
  110. exit 

大厦 B 层交换机

 
  1.  
  2.  
  3. #conf ter 
  4. hostname 2F 
  5.  
  6. ip routing 
  7.  
  8. vlan 10 
  9. vlan 20  
  10. vlan 30  
  11. vlan 40  
  12. vlan 50  
  13. vlan 60  
  14. vlan 70  
  15. vlan 80  
  16. vlan 90 
  17.    
  18. int fa0/1  
  19. sw mo acc  
  20. sw acc vlan 10 
  21.  
  22. int fa0/2
  23. sw mo acc 
  24. sw acc vlan 20 
  25.  
  26. int fa0/3  
  27. sw mo acc  
  28. sw acc vlan 30 
  29.  
  30. int fa0/4  
  31. sw mo acc  
  32. sw acc vlan 40 
  33.  
  34. int fa0/5  
  35. sw mo acc  
  36. sw acc vlan 50 
  37.  
  38. int fa0/6 
  39. sw mo acc 
  40. sw acc vlan 60 
  41.  
  42. int fa0/7  
  43. sw mo acc  
  44. sw acc vlan 70 
  45.  
  46. int fa0/8  
  47. sw mo acc  
  48. sw acc vlan 80 
  49.  
  50. int fa0/9  
  51. sw mo acc 
  52. sw acc vlan 90 
  53.  
  54. int fa0/24  
  55. switchport mode trunk 
  56. switchport trunk encapsulation dot1q 
  57.  
  58. int vlan 10 
  59. ip add 192.168.1.1 255.255.255.0 
  60.  
  61. int vlan 20 
  62. ip add 192.168.2.1 255.255.255.0 
  63.  
  64. int vlan 30  
  65. ip add 192.168.3.1 255.255.255.0 
  66.  
  67. int vlan 40 
  68. ip add 192.168.4.1 255.255.255.0 
  69.  
  70. int vlan 50 
  71. ip add 192.168.5.1 255.255.255.0 
  72.  
  73. int vlan 60  
  74. ip add 192.168.6.1 255.255.255.0 
  75.  
  76. int vlan 70 
  77. ip add 192.168.7.1 255.255.255.0 
  78.  
  79. int vlan 80 
  80. ip add 192.168.8.1 255.255.255.0 
  81.  
  82. int vlan 91 
  83. ip add 192.168.9.1 255.255.255.192 
  84.  
  85. int vlan 92 
  86. ip add 192.168.9.65 255.255.255.192 
  87.  
  88. int vlan 93 
  89. ip add 192.168.9.129 255.255.255.192 
  90.  
  91. int vlan 94 
  92. ip add 192.168.9.193 255.255.255.192 
  93. exit 
  94.  
  95. int g0/1 
  96. no switchport  
  97. ip add 192.168.61.2 255.255.255.0 
  98. exit 
  99.  
  100. int g0/2 
  101. no switchport  
  102. ip add 192.168.62.1 255.255.255.0  
  103. exit 
  104.  
  105. router rip  
  106. ver 2  
  107. no auto-summary  
  108. network 192.168.1.0  
  109. network 192.168.2.0  
  110. network 192.168.3.0  
  111. network 192.168.4.0  
  112. network 192.168.5.0  
  113. network 192.168.6.0  
  114. network 192.168.7.0  
  115. network 192.168.8.0  
  116. network 192.168.9.0  
  117. network 192.168.61.0  
  118. network 192.168.62.0  
  119. exit 

 

有用的命令

1 查看路由,注意 R打头的行 R - RIP

 
  1. #show ip route  
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 
  6.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 
  7.        * - candidate default, U - per-user static route, o - ODR 
  8.        P - periodic downloaded static route 
  9.  
  10. Gateway of last resort is 192.168.0.1 to network 0.0.0.0 
  11.  
  12.      192.168.0.0/30 is subnetted, 1 subnets 
  13. C       192.168.0.0 is directly connected, GigabitEthernet0/2 
  14. R    192.168.1.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  15. R    192.168.2.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  16. R    192.168.3.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  17. R    192.168.4.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  18. R    192.168.5.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  19. R    192.168.6.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  20. R    192.168.7.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  21. R    192.168.8.0/24 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  22.      192.168.9.0/26 is subnetted, 4 subnets 
  23. R       192.168.9.0 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  24. R       192.168.9.64 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  25. R       192.168.9.128 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  26. R       192.168.9.192 [120/1] via 192.168.61.2, 00:00:22, GigabitEthernet0/1 
  27. C    192.168.50.0/24 is directly connected, Vlan150 
  28. C    192.168.51.0/24 is directly connected, Vlan151 
  29. C    192.168.52.0/24 is directly connected, Vlan152 
  30. C    192.168.53.0/24 is directly connected, Vlan153 
  31. C    192.168.54.0/24 is directly connected, Vlan154 
  32. C    192.168.55.0/24 is directly connected, Vlan155 
  33. C    192.168.56.0/24 is directly connected, Vlan156 
  34. C    192.168.57.0/24 is directly connected, Vlan157 
  35. C    192.168.58.0/24 is directly connected, Vlan158 
  36. C    192.168.59.0/24 is directly connected, Vlan159 
  37. C    192.168.61.0/24 is directly connected, GigabitEthernet0/1 
  38. S*   0.0.0.0/0 [1/0] via 192.168.0.1 

 

2 显示路由器的协议信息

 
  1. #show ip protocols 
  2. Default version control: send version 1, receive any version 
  3.     Interface             Send  Recv  Triggered RIP  Key-chain 
  4.     Ethernet0/0            1     1 2 
  5.     Loopback0             1     1 2     //默认接收版本1、2,发送版本1 
  6.     Loopback2             1     1 2    //发送为RIPv1,不携带子网掩码

  7. Default version control: send version 2, receive 2
  8. Interface Send Recv Triggered RIP Key-chain
  9. GigabitEthernet0/1 2 2
  10. Vlan151 2 2         //默认接收版本 2,发送版本2
  11. Vlan152 2 2

3 显示 rip

 
  1. show ip rip database  
  2. 0.0.0.0/0    auto-summary 
  3. 0.0.0.0/0 
  4.     [0] via 0.0.0.0, 00:12:44 
  5. 192.168.0.0/30    auto-summary 
  6. 192.168.0.0/30    directly connected, GigabitEthernet0/2 
  7. 192.168.1.0/24    auto-summary 
  8. 192.168.1.0/24 
  9.     [1] via 192.168.61.2, 00:00:19, GigabitEthernet0/1 
  10. 192.168.2.0/24    auto-summary 
  11. 192.168.2.0/24 
  12.     [1] via 192.168.61.2, 00:00:19, GigabitEthernet0/1 

 

拓展

http://netname.blog.51cto.com/941793/656185

http://baike.baidu.com/view/30530.htm

 

结束

rip 可以在多个三层交换机或者路由器之间动态更新路由表,而不需要网络管理人员手动添加静态路由信息,这是非常棒的但是它的一些特性决定了, RIP只适用于小型互联网,比如RIP允许一条路径最多只能包含15个路由器 ,当然这对于小企业(比如我们公司)是没有什么障碍的!

 

结束 
更多请: 
linux 系统运维  37275208 
vmware 虚拟化  166682360


本文转自 dongnan 51CTO博客,原文链接:http://blog.51cto.com/dngood/713553

相关文章
|
4月前
|
负载均衡 网络协议 算法
IP路由协议(RIP、IGRP、OSPF、IS-IS、BGP)
1、路由分类 路由产生方式: 直接路由:路由器会自动生成本路由器激活端口所在网段的路由条目 静态路由:网络管理员手工配置,静态路由信息在缺省的情况下私有的,不会传递给其他的路由器
|
7月前
|
网络架构
交换机与路由器技术-21-RIP路由协议
交换机与路由器技术-21-RIP路由协议
39 0
|
网络协议
Cisco静态路由和OSPF结合小实验
Cisco静态路由和OSPF结合小实验
194 0
Cisco静态路由和OSPF结合小实验
|
网络协议 网络架构
|
网络架构 网络协议
|
网络协议 网络架构
|
网络虚拟化 网络架构
|
数据安全/隐私保护 网络架构