rip and ospf routing protocol
- rip routing protocol
- brief introduction
- Information protocol
- historical information
- Protocol layering
- Frequently asked questions
- ospf routing protocol
Routing information protocol (RIP) is the first widely used protocol in IGP. Rip is a kind of distributed routing protocol based on distance vector. It is a standard protocol of Internet. Its biggest advantage is that it is easy to implement and less expensive.
But RIP has many disadvantages. First, it limits the size of the network to a maximum distance of 15 (16 means not reachable). Secondly, the information exchanged by the router is the complete routing table of the router, so with the expansion of the network scale, the overhead will increase. Finally, "bad news spreads slowly", which makes the convergence time of update process too long. Therefore, OSPF protocol should be used for large-scale network. However, in the small-scale network, the use of RIP protocol is still the majority.
Routing Information Protocol (RIP) is the most widely used internal gateway protocol (IGP). IGP is a routing protocol used in the internal network (in a few cases, it can also be used to connect to the Internet). It can dynamically adapt the router to the changes of network connection through continuous exchange of information, which information includes which networks each router can reach, how far these networks are, etc. IGP is an application layer protocol and uses UDP as the transport protocol.
Although RIP is still frequently used, most people think it will and is being replaced by routing protocols such as OSPF and IS-IS. Of course, we also see EIGRP, a kind of routing protocol that belongs to the same basic protocol class as RIP (Distance Vector Routing Protocol), but is more adaptive, and has also been used.
Developed by Xerox in 1970s, it is the first routing protocol used by IP. RIP has become a necessary routing protocol from UNIX system to various routers. RIP protocol has the following characteristics:
(1) RIP is the internal protocol of the autonomous system, that is, the internal gateway protocol, which uses the distance vector algorithm.
(2) RIP uses port 520 of UDP to communicate between RIP processes.
(3) RIP has two major versions: RIPv1 and RIPv2. RIPv1 protocol is described in RFC1058. RIPv2 is an improvement of RIPv1 protocol. Its protocol is described in RFC2453.
(4) RIP takes hops as the network measure.
(5) RIP protocol uses broadcast or multicast to update the route. RIPv1 uses broadcast while RIPv2 uses multicast (126.96.36.199).
(6) RIP protocol supports host passive mode, that is, RIP protocol allows host to only receive and update routing information without sending information.
(7) RIP protocol supports default route propagation.
(8) RIP protocol is suitable for small and medium-sized networks with a network diameter of no more than 15 hops. When 16 hops, the network is not reachable.
(9) RIPv1 is a classed routing protocol, RIPv2 is a classless routing protocol, that is, the message of RIPv2 contains mask information.
The routing algorithm used by RIP is Bellman Ford algorithm. This algorithm was first used in a computer network in 1969, when it was the initial routing algorithm of ARPANET.
RIP is developed from "gateway information protocol" (a part of Xerox Parc general packet protocol cluster for Internet work). It can be said that the gateway information protocol is the earliest version of RIP. Later, it was named "routing information protocol", which is part of Xerox Network Service Protocol cluster.
Routers in the same autonomous system (A.S.) exchange sub messages with neighboring routers every 30 seconds to dynamically establish routing tables.
RIP allows the maximum number of hop s (HOPS) to be 15 or more, which is not reachable.
RIP has three versions, ripv1, ripv2 and RIPng
RIPV1 and RIPV2 are used in IPV4 network environment, and RIPng is used in IPV6 network environment.
RIPv1 uses classified routing, defined in [RFC 1058 . It does not have subnet information in its routing updates, so it cannot support variable length subnet masks. This restriction makes it impossible for peer networks to use different subnet masks in RIPv1 networks. In other words, the number of all subnetworks in the same network is the same. In addition, it does not support the authentication of routing process, which makes RIPv1 have some slight weaknesses and may be attacked.
Due to the defects of RIPv1, RIPv2 was proposed in 1994 to include the information of subnetworks and provide classless inter domain routing in this way. However, the limit of the maximum number of nodes 15 is still reserved. In addition, to solve the security problem, RIPv2 also provides a set of methods to achieve the authentication effect through encryption. Later [RFC 2082  also defined the method of using MD5 to achieve authentication. The relevant provisions of RIPv2 are in [RFC 2453 ] orstd56.
Nowadays, most IPv4 networks use RIPv2, which is an improvement on RIPv1. Compared with RIPv1, RIPv2 has the following differences.
- RIP is a typical distance vector routing protocol.
- RIP messages are sent through the broadcast address of 255.255.255.255. RIPv2 uses the multicast address of 188.8.131.52 to send messages. Both of them use the port 520 of UDP protocol.
- RIP uses the minimum number of hops to the destination network as the routing metric, rather than the bandwidth and delay of the link.
- RIP is designed for small networks. Its hop count is limited to 15 hops and 16 hops are unreachable.
- Rip is a kind of routing protocol, which does not support discontinuous subnet design. RIP-2 supports CIDR and VLSM variable length subnet mask to support discontinuous subnet design.
- RIP periodically updates the complete route and broadcasts the routing table to the neighbor router. The default broadcast period is 30 seconds.
- The protocol management distance of RIP is 120.
- RIP-2 is a Classless Routing Protocol.
- RIP-2 protocol message carries mask information and supports VLSM (variable length subnet mask) and CIDR.
- RIP-2 supports sending route update message in multicast mode, with the multicast address of 184.108.40.206, reducing the consumption of network and system resources.
- RIP-2 supports the verification of protocol messages, and provides two methods of plaintext verification and MD5 verification to enhance security.
- RIP-2 can support VLSM
Rip ng (routing information protocol next generation) is defined in [RFC 2080 , mainly for IPv6 to do some extended specifications. Compared with RIPv2, the main differences are:
RIPv2 supports RIP update authentication, while RIPng does not (IPv6 routers were, at the time, proposed to use IPSec for authentication);
RIPv2 is allowed to attach the label of binary, while RIPng is not allowed;
RIPv2 encodes the next-hop into each route entries, RIPng requires specific encoding of the nexthop for a set of route entries.
Port number of RIPv2 UDP is 520, and port number of RIPng UDP is 521
The reference model of TCP/IP is divided into four layers: Application Layer, host to host layer, Internet Layer and network access layer.
What is RIP
RIP is a Distance Vector Routing Protocol. Basically, the Distance Vector Routing Protocol determines the best path based on the distance vector algorithm according to the distance of the destination (distance = the number of routers passing).
What is the role of RIP
RIP lets routers pass routing information to each other. Through RIP, router can automatically know the remote destination without network administrator adding static routing information to each router.
Transfer routing information
RIP floods all its routing information to its neighbors through the Response packet.
RIP uses "hop count" to calculate cost (metric). For each router, the "hop count" increases by 1. RIP transmits packets through the path with the minimum number of hops.
Open Shortest Path First (OSPF) is a widely used dynamic routing protocol, which belongs to link state routing protocol. It has the advantages of fast convergence speed of routing changes, no routing loop, support for variable length subnet mask (VLSM) and aggregation, hierarchical area division, etc. After using OSPF protocol in the network, most of the routes will be calculated and generated by OSPF protocol itself, which does not need to be manually configured by the network administrator. When the network topology changes, the protocol can automatically calculate and correct the routes, which greatly facilitates the network management. However, if the specific network application environment is not combined and detailed planning is not done, the use effect of OSPF protocol will be greatly reduced and even cause failure.
OSPF is a link state protocol. Each router is responsible for discovering and maintaining the relationship with neighbors, describing the known neighbor list and link state update message, learning the network topology of the whole autonomous system through reliable flooding and periodic interaction with other routers in the autonomous system AS(Autonomous System); The routing information of other AS is injected into the router at the boundary of autonomous system, so AS to get the routing information of the whole Internet. Every other specific time or when the link state changes, the LSA is regenerated, and the router announces the new LSA through the flooding mechanism, so AS to realize the real-time update of the route.
- Initialization forms initial port information: when the router is initialized or the network structure changes (such as the link changes, the router is added or damaged), the relevant router will generate link state broadcast packet LSA, which contains all the connected links on the router, that is, the status information of all ports.
- Routers exchange link state information through flooding mechanism: each router on the one hand transmits its LSA packets to all OSPF routers adjacent to it, on the other hand receives LSA packets from its adjacent OSPF routers, and updates its own database according to it.
- Form a stable regional topology database: OSPF routing protocol gradually converges through flooding method to form a database of regional topology. At this time, all routers keep a copy of the database.
- Form routing table: all routers use the shortest path method to form their own routing table according to their regional topology database copy.
OSPF protocol relies on five different types of packets to establish adjacency and exchange routing information, that is, greeting packet, database description packet, link status request packet, link status update packet and link status confirmation packet.
- Hello group
OSPF uses Hello grouping to establish and maintain adjacency. Before a router can distribute its neighbor information to other routers, it must greet its neighbors first.
- Data base Description (DBD) grouping
The DBD group does not contain the complete "link state database" information, only the summary of each entry in the database. When a router is connected to the network for the first time, or just recovered from a failure, it needs complete "link state database" information. At this point, the router first establishes a two-way communication relationship with neighbors through hello packets, and then receives the DBD packets fed back by each neighbor. The newly connected router will check all profiles, and then send one or more link status request packets to retrieve the complete entry information.
- Link State Request (LSR) packet
LSR packets are used to request neighbors to send details of some entries in their link state database. When a router exchanges database description packets with its neighbors, if it finds that some entries in its link state database are missing or expired, LSR packets are used to obtain the newer parts of the neighbor link state database.
- Link State Update (LSU) packet
LSU packets are used to respond to link state request packets, and flooding can also be realized when link state changes. In the process of network operation, as long as the link state of a router changes, the router will use LSU to update the link state of the whole network with flooding method.
- Link State Acknowledgment (LSAck) packet
LSAck packet is used to answer and confirm the link state update packet, which makes the flooding method adopted by link state update packet reliable.
- OSPF is suitable for a wide range of networks: there is no limit to the number of hops for routing in OSPF protocol, so OSPF protocol can be used in many occasions, but also supports a wider network scale. As long as it is in the multicast network, OSPF protocol can support dozens of routers to operate together.
- Multicast trigger update: after the convergence of OSPF protocol is completed, it will send topology change information to other routers in trigger mode, so as to reduce the utilization rate of network broadband; at the same time, it can reduce interference, especially when using multicast network structure to send information to the outside, it does not have other impact on other devices
- Fast convergence speed: if the network structure changes, the OSPF protocol system will send new messages at the fastest speed, so that the new topology will spread to the whole network quickly; moreover, OSPF uses the HELLO message with shorter period to maintain the neighbor state.
- Cost as a measure: when OSPF protocol is designed, the impact of link bandwidth on routing metrics is considered. OSPF protocol takes the cost value as the standard, and the link cost and link bandwidth just form an inverse relationship. The higher the bandwidth, the less the cost. Thus, OSPF routing is mainly based on the bandwidth factor.
- OSPF protocol is designed to avoid routing loops: in the shortest path algorithm, the link state in the route is received, and then the path is generated, so no loop is generated.
- Widely used: widely used on the Internet, there will be a large number of other application examples. This proves to be one of the most widely used IPG s.
- The configuration of OSPF protocol requires high technical level and is complex. Because the network will divide areas or mark certain attributes for the whole network according to specific parameters, all kinds of situations will be very complex. This requires network analysts to have a good understanding of OSPF protocol configuration, which requires not only general network knowledge and technology, but also a deeper technical understanding. Only with such personnel can OSPF protocol configuration and Routine maintenance.
- The load sharing ability of routing itself is very low. OSPF routing protocol will generate interfaces with different priorities according to several main factors. However, in the same region, the routing protocol will only pass through the interface with the highest priority. As long as the interface priority is lower than the highest priority, the route will not pass. On this basis, different levels of routing can not bear the load on each other, and can only run alone.
- Experimental topology
- ip address assignment
- Configure interface address for RA/RB
<H3C>system-view System View: return to User View with Ctrl+Z. [H3C]int ge0/0 [H3C-GigabitEthernet0/0]ip add 192.168.1.2 24
The rest are the same.
- After configuration, we will test connectivity
# ping is PA--PA loopback address loopback status: success <H3C>ping 192.168.1.1 Ping 192.168.1.1 (192.168.1.1): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.1.1: icmp_seq=0 ttl=255 time=0.000 ms 56 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=0.000 ms 56 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=0.000 ms 56 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=0.000 ms 56 bytes from 192.168.1.1: icmp_seq=4 ttl=255 time=0.000 ms --- Ping statistics for 192.168.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.000/0.000/0.000/0.000 ms # ping is the interface ge0/0 status of RA: success <H3C>ping 192.168.1.2 Ping 192.168.1.2 (192.168.1.2): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=1.000 ms 56 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0.000 ms 56 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=1.000 ms 56 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=1.000 ms 56 bytes from 192.168.1.2: icmp_seq=4 ttl=255 time=0.000 ms --- Ping statistics for 192.168.1.2 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.000/0.600/1.000/0.490 ms # ping is the interface ge0/1 status of RA: success <H3C>ping 192.168.2.1 Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.2.1: icmp_seq=0 ttl=255 time=1.000 ms 56 bytes from 192.168.2.1: icmp_seq=1 ttl=255 time=1.000 ms 56 bytes from 192.168.2.1: icmp_seq=2 ttl=255 time=0.000 ms 56 bytes from 192.168.2.1: icmp_seq=3 ttl=255 time=0.000 ms 56 bytes from 192.168.2.1: icmp_seq=4 ttl=255 time=0.000 ms --- Ping statistics for 192.168.2.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.000/0.400/1.000/0.490 ms # ping is the interface ge0/0 status of RB: failed <H3C>ping 192.168.2.2 Ping 192.168.2.2 (192.168.2.2): 56 data bytes, press CTRL_C to break Request time out Request time out Request time out Request time out Request time out --- Ping statistics for 192.168.2.2 --- 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
Because PA is 192.168.1.0/24 network segment, but the interface ge0/0 of RB is 192.168.2.0/24 network segment, which is not in the same network segment, so it cannot communicate.
# RA routing table information <H3C>display ip routing-table Destinations : 16 Routes : 16 Destination/Mask Proto Pre Cost NextHop Interface 0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0 192.168.1.0/24 Direct 0 0 192.168.1.2 GE0/0 192.168.1.0/32 Direct 0 0 192.168.1.2 GE0/0 192.168.1.2/32 Direct 0 0 127.0.0.1 InLoop0 192.168.1.255/32 Direct 0 0 192.168.1.2 GE0/0 192.168.2.0/24 Direct 0 0 192.168.2.1 GE0/1 192.168.2.0/32 Direct 0 0 192.168.2.1 GE0/1 192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0 192.168.2.255/32 Direct 0 0 192.168.2.1 GE0/1 220.127.116.11/4 Direct 0 0 0.0.0.0 NULL0 18.104.22.168/24 Direct 0 0 0.0.0.0 NULL0 255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
In the routing table, we can't see the routing information pointing to 192.168.2.2/24.
5. Configure static routing protocol
Command line: IP route static destination network number length next hop
# Router RA configuration [RA]IP route-static 192.168.3.0 24 192.168.2.2 # Router RB configuration [RB]IP route-static 192.168.1.0 24 192.168.2.1
# ping PB with PA: success ping 192.168.3.2 Ping 192.168.3.2 (192.168.3.2): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.3.2: icmp_seq=0 ttl=253 time=2.000 ms 56 bytes from 192.168.3.2: icmp_seq=1 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=2 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=3 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=4 ttl=253 time=1.000 ms --- Ping statistics for 192.168.3.2 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 1.000/1.200/2.000/0.400 ms
# RA routing table information [RA]display ip routing-table Destinations : 17 Routes : 17 Destination/Mask Proto Pre Cost NextHop Interface 0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0 192.168.1.0/24 Direct 0 0 192.168.1.2 GE0/0 192.168.1.0/32 Direct 0 0 192.168.1.2 GE0/0 192.168.1.2/32 Direct 0 0 127.0.0.1 InLoop0 192.168.1.255/32 Direct 0 0 192.168.1.2 GE0/0 192.168.2.0/24 Direct 0 0 192.168.2.1 GE0/1 192.168.2.0/32 Direct 0 0 192.168.2.1 GE0/1 192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0 192.168.2.255/32 Direct 0 0 192.168.2.1 GE0/1 192.168.3.0/24 Static 60 0 192.168.2.2 GE0/1 22.214.171.124/4 Direct 0 0 0.0.0.0 NULL0 126.96.36.199/24 Direct 0 0 0.0.0.0 NULL0 255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
There is an additional route information, pointing to 192.168.3.0/24, and the next hop is 192.168.2.2.
- Delete static routing protocol and configure rip protocol
# View static routing table [RA]display route-static routing-table Total number of routes: 1 Status: * - valid *Destination: 192.168.3.0/24 NibID: 0x11000000 NextHop: 192.168.2.2 MainNibID: N/A BkNextHop: N/A BkNibID: N/A Interface: N/A TableID: 0x2 BkInterface: N/A Flag: 0x82d01 BfdSrcIp: N/A DbIndex: 0x1 BfdIfIndex: 0x0 Type: Normal BfdVrfIndex: 0 TrackIndex: 0xffffffff Label: NULL Preference: 60 vrfIndexDst: 0 BfdMode: N/A vrfIndexNH: 0 Permanent: 0 Tag: 0
# Delete static route [RA]delete static-routes all
# RB configures rip protocol (that is, adjacent network segments are good) [RB]rip [RB-rip-1]network 192.168.2.0 [RB-rip-1]network 192.168.3.0 # RA configuration rip protocol [RA]rip [RA-rip-1]net 192.168.2.0 [RA-rip-1]net 192.168.1.0
# PA---PB status: success ping 192.168.3.2 Ping 192.168.3.2 (192.168.3.2): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.3.2: icmp_seq=0 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=1 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=2 ttl=253 time=3.000 ms 56 bytes from 192.168.3.2: icmp_seq=3 ttl=253 time=2.000 ms 56 bytes from 192.168.3.2: icmp_seq=4 ttl=253 time=1.000 ms --- Ping statistics for 192.168.3.2 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 1.000/1.600/3.000/0.800 ms
# View rip protocol configuration [RA]display rip 1 Public VPN-instance name: RIP process: 1 RIP version: 1 Preference: 100 Checkzero: Enabled Default cost: 0 Summary: Enabled Host routes: Enabled Maximum number of load balanced routes: 32 Update time : 30 secs Timeout time : 180 secs Suppress time : 120 secs Garbage-collect time : 120 secs Update output delay: 20(ms) Output count: 3 TRIP retransmit time: 5(s) Retransmit count: 36 Graceful-restart interval: 60 secs Triggered Interval : 5 50 200 BFD: Disabled Silent interfaces: None Default routes: Disabled Verify-source: Enabled Networks: 192.168.1.0 192.168.2.0 Configured peers: None Triggered updates sent: 2
- Delete rip1 protocol and configure rip2 protocol
# Cancel rip agreement [RA]undo rip Undo RIP process? [Y/N]:y # Cancel rip agreement [RB]undo rip Undo RIP process? [Y/N]:y
# RB configures rip2 protocol [RB]rip [RB-rip-1]version 2 [RB-rip-1]net 192.168.2.0 [RB-rip-1]net 192.168.3.0 # RA configuration rip protocol [RA]rip [RA-rip-1]version 2 [RA-rip-1]net 192.168.1.0 [RA-rip-1]net 192.168.2.0
# View rip2 protocol [RA]display rip Public VPN-instance name: RIP process: 1 RIP version: 2 Preference: 100 Checkzero: Enabled Default cost: 0 Summary: Enabled Host routes: Enabled Maximum number of load balanced routes: 32 Update time : 30 secs Timeout time : 180 secs Suppress time : 120 secs Garbage-collect time : 120 secs Update output delay: 20(ms) Output count: 3 TRIP retransmit time: 5(s) Retransmit count: 36 Graceful-restart interval: 60 secs Triggered Interval : 5 50 200 BFD: Disabled Silent interfaces: None Default routes: Disabled Verify-source: Enabled Networks: 192.168.1.0 192.168.2.0 Configured peers: None Triggered updates sent: 2
<H3C>ping 192.168.3.2 Ping 192.168.3.2 (192.168.3.2): 56 data bytes, press CTRL_C to break 56 bytes from 192.168.3.2: icmp_seq=0 ttl=253 time=2.000 ms 56 bytes from 192.168.3.2: icmp_seq=1 ttl=253 time=1.000 ms 56 bytes from 192.168.3.2: icmp_seq=2 ttl=253 time=2.000 ms 56 bytes from 192.168.3.2: icmp_seq=3 ttl=253 time=2.000 ms 56 bytes from 192.168.3.2: icmp_seq=4 ttl=253 time=2.000 ms --- Ping statistics for 192.168.3.2 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 1.000/1.800/2.000/0.400 ms