Routing Information Protocol

Routing Information Protocol

The Routing Information Protocol (RIP) is one of the oldest distance-vector routing protocols which employ the hop count as a routing metric. RIP prevents routing loops by implementing a limit on the number of hops allowed in a path from source to destination. The maximum number of hops allowed for RIP is 15, which limits the size of networks that RIP can support. A hop count of 16 is considered an infinite distance and the route is considered unreachable. RIP implements the split horizon, route poisoning and holddown mechanisms to prevent incorrect routing information from being propagated.

Originally, each RIP router transmitted full updates every 30 seconds. In the early deployments, routing tables were small enough that the traffic was not significant. As networks grew in size, however, it became evident there could be a massive traffic burst every 30 seconds, even if the routers had been initialized at random times. It was thought, as a result of random initialization, the routing updates would spread out in time, but this was not true in practice. Sally Floyd and Van Jacobson showed in 1994 that, without slight randomization of the update timer, the timers synchronized over time.

In most networking environments, RIP is not the preferred choice for routing as its time to converge and scalability are poor compared to EIGRP, OSPF, or IS-IS. However, it is easy to configure, because RIP does not require any parameters unlike other protocols.

RIP uses the User Datagram Protocol (UDP) as its transport protocol, and is assigned the reserved port number 520.

There are three versions of the Routing Information Protocol: RIPv1, RIPv2, and RIPng.

RIP version 1
The original specification of RIP, defined in RFC 1058, was published in 1988 and uses classful routing. The periodic routing updates do not carry subnet information, lacking support for variable length subnet masks (VLSM). This limitation makes it impossible to have different-sized subnets inside of the same network class. In other words, all subnets in a network class must have the same size. There is also no support for router authentication, making RIP vulnerable to various attacks.

RIP version 2
Due to the deficiencies of the original RIP specification, RIP version 2 (RIPv2) was developed in 1993 and last standardized in 1998. It included the ability to carry subnet information, thus supporting Classless Inter-Domain Routing (CIDR). To maintain backward compatibility, the hop count limit of 15 remained. RIPv2 has facilities to fully interoperate with the earlier specification if all Must Be Zero protocol fields in the RIPv1 messages are properly specified. In addition, a compatibility switch feature allows fine-grained interoperability adjustments.

In an effort to avoid unnecessary load on hosts that do not participate in routing, RIPv2 multicasts the entire routing table to all adjacent routers at the address 224.0.0.9, as opposed to RIPv1 which uses broadcast. Unicast addressing is still allowed for special applications.

(MD5) authentication for RIP was introduced in 1997.

RIPv2 is Internet Standard STD56 (which is RFC 2453).

Route tags were also added in RIP version 2. This functionality allows a distinction between routes learned from the RIP protocol and routes learned from other protocols.

RIPng
RIPng (RIP next generation), defined in RFC 2080, is an extension of RIPv2 for support of IPv6, the next generation Internet Protocol. The main differences between RIPv2 and RIPng are:

Support of IPv6 networking.
While RIPv2 supports RIPv1 updates authentication, RIPng does not. IPv6 routers were, at the time, supposed to use IPsec for authentication.
RIPv2 encodes the next-hop into each route entry, RIPng requires specific encoding of the next hop for a set of route entries.
RIPng sends updates on UDP port 521 using the multicast group FF02::9.

RIPv1 Operation
RIP defines two types of messages.

Request Message
Response Message
When a RIP router comes online, it sends a broadcast Request Message on all of its RIP enabled interfaces. All the neighbouring routers which receive the Request message respond back with the Response Message containing their Routing table. The Response Message is also gratuitously sent when the Update timer expires. On receiving the Routing table, the router processes each entry of the routing table as per the following rules

If there are no route entries matching the one received then the route entry is added to the routing table automatically, along with the information about the router from which it received the routing table.
If there are matching entries but the hop count metric is lower than the one already in its routing table, then the routing table is updated with the new route.
If there are matching entries but the hop count metric is higher than the one already in its routing table, then the routing entry is updated with hop count of 16 (infinite hop). The packets are still forwarded to the old route. A Holddown timer is started and all the updates for that from other routers are ignored. If after the Holddown timer expires and still the router is advertising with the same higher hop count then the value is updated into its routing table. Only after the timer expires, the updates from other routers are accepted for that route.
Timers
The routing information protocol uses the following timers as part of its operation

Update Timer
Invalid Timer
Flush Timer
Holddown Timer
Update Timer
The update timer controls the interval between two gratuitous Response Messages. By default the value is 30 seconds. The response message is broadcast to all its RIP enabled interface.

Invalid Timer
The invalid timer specifies how long a routing entry can be in the routing table without being updated. This is also called as expiration Timer. By default, the value is 180 seconds. After the timer expires the hop count of the routing entry will be set to 16, marking the destination as unreachable.

Flush Timer
The flush timer controls the time between the route is invalidated or marked as unreachable and removal of entry from the routing table. By default the value is 240 seconds. This is 60 seconds longer than Invalid timer. So for 60 seconds the router will be advertising about this unreachable route to all its neighbours. This timer must be set to a higher value than the invalid timer.

Hold-down Timer
The hold-down timer is started per route entry, when the hop count is changing from lower value to higher value. This allows the route to get stabilized. During this time no update can be done to that routing entry. This is not part of the RFC 1058. This is Cisco’s implementation. The default value of this timer is 180 seconds

Limitations
The hop count cannot exceed 15, or routes will be dropped.
Variable Length Subnet Masks are not supported by RIP version 1 (which is obsolete).
RIP has slow convergence and count to infinity problems
Implementations
Cisco IOS, software used in Cisco routers (supports version 1, version 2 and RIPng)
Cisco NX-OS software used in Cisco Nexus data center switches (supports RIPv1 and RIPv2)
Junos software used in Juniper routers, switches, and firewalls (supports RIPv1 and RIPv2)
Routing and Remote Access, a Windows Server feature, contains RIP support
Quagga, a free open source routing software suite based on GNU Zebra
BIRD, a free open source routing software suite
Zeroshell, a free open source routing software suite
A RIP implementation first introduced in 4.2BSD, routed, survives in several of its descendants, including FreeBSD and NetBSD.
OpenBSD introduced a new implementation, ripd, in version 4.1 and retired routed in version 4.4.
Netgear routers commonly offer a choice of two implementations of RIPv2; these are labelled RIP_2M and RIP_2B. RIP_2M is the standard RIPv2 implementation using multicasting – which requires all routers on the network to support RIPv2 and multicasting, whereas RIP_2B sends RIPv2 packets using subnet broadcasting – making it more compatible with routers that do not support multicasting, including RIPv1 routers.

RIP (Routing Information Protocol) là giao thức định tuyến vector khoảng cách điển hình, là nó đều đặn gửi toàn bộ routing table ra các Router hàng xóm và các Router này sẽ phát tán ra tất cả Router bên cạnh đều đặn theo chu kỳ là 30 giây. RIP chỉ sử dụng metric là hop-count để tính ra tuyến đường tốt nhất tới mạng đích. Thuật toán mà RIP sử dụng để xây dựng nên routing table là Bellman-Ford.

RIP sử dụng hop-count như một thước đo định tuyến để tìm kiếm đường đi tốt nhất giữa hai điểm. Hop-count là số lượng Router mà một packet phải đi qua cho đến khi đến được địa chỉ đích. Để tránh tình trạng Lop vô tận thì RIP giới hạn Hop-count tối đa là 16. Khi một Router nhận được một thông tin láng giềng Router sẽ tăng chỉ số Hop lên 1 vì Router cũng xem nó là 1 Hop trên đường đi, nếu sau khi tăng chỉ số Hop lên 1 mà chỉ số này lớn hơn 15 thì Router xem như không tồn tại mạng đích trên tuyến đường này.

Giao thức định tuyến RIP (Routing Information Protocol)

Đặc điểm chính của RIP

  • RIP có hai phiên bản là RIPv1 và phiên bản mới hơn là RIPv2
  • Đây là một giao thức dạng Vector khoảng cách
  • Nó chọn đường đi theo số nút mạng đi qua(# of hops, Max =15 hops).

RIP time

  • Route update timer: là thời gian trao đổi thông tin định tuyến của Router với tất cả các active interface. Thông tin ở đây là toàn bộ bảng định tuyến và thởi gian định kỳ là 30s.
  • Routing invalid Timer: là khoảng thời gian xác định một tuyến đường invalid. Được bắt đầu nếu hết thời gian Hold time mà không nhận được update, sau khoảng thời gian đó Router sẽ gửi một update tới tất cả các Interface là tuyến đường đó đã invalid.
  • Holddown timer: giá trị này được sử dụng khi có thông tin định tuyến bị thay đổi. Sau khi nhận thông tin thay đổi, Router đặt tuyến đường đó vào trạng thái hold-down. Điều này có nghĩa là Router không gửi quảng bá cũng như không nhận quảng bá về thông tin đó trong khoảng thời gian Hold down timer. Sau khoảng thời gian này Router mới nhận và gửi thông tin về tuyến đường đó. Điều này làm giảm thông tin sai mà Router học được. Giá trị mặc định là 180 giây.
  • Route flush timer: là khoảng thời gian được tính từ khi tuyến đường ở trạng thái không hợp lệ đến khi tuyến bị xoá khỏi bảng định tuyến. Giá trị Route invalid timer phải nhỏ hơn giá trị Route flush timer vì Router cần thông báo tới các Router bên cạnh của nó về trạng thái invalid của tuyến đường đó trước khi local routing được update.

So sánh giữa RIPv1 và RIPv2

Có hai version hoạt động của giao thức RIP là version 1 và 2. Hai version này giống nhau hoàn toàn về cách thức hoạt động như đã mô tả ở trên. Tuy nhiên, cũng có một số điểm khác biệt:

  • RIPv1 là một giao thức classful trong khi RIPv2 là một giao thức classless. Các giao thức classful có nhiều điểm hạn chế nên ngày nay các tiến trình RIP được chạy chủ yếu là RIPv2.
  • RIPv1 sử dụng địa chỉ broadcast 255.255.255.255 để gửi đi các bản tin cập nhật trong khi RIPv2 sử dụng địa chỉ multicast 224.0.0.9 để gửi đi các bản tin cập nhật.
  • RIPv1 không hỗ trợ xác thực trong định tuyến trong khi RIPv2 có hỗ trợ xác thực. Điều này dẫn đến những nguy cơ về bảo mật khi sử dụng RIPv1.

Cấu hình

R(config)#router rip

R(config-router)#version 2

R(config-router)#network mang_quang_ba

Những tùy chỉnh cần nhớ trong RIP

  • Auto-summary: Gộp các subnet lại thành một network chung.
  • Default-information originate: Quảng bá tuyến default route của nó cho các router cùng chạy RIP bên trong
  • Redistribute static: Quảng bá những static route của nó cho các router cùng chạy RIP bên trong.
  • Distance: Set giá trị AD.
  • Passive-interface: Không cho gửi thông tin RIP đến các cổng connected với host để giảm traffic vô ích.

Lab cơ bản

Lab Giao thức định tuyến RIP
Cấu hình router R1:

R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 192.168.1.0
R1(config-router)#network 192.168.3.0

Cấu hình router R2:

R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.168.2.0
R2(config-router)#network 192.168.3.0