TCP/IP Study Notes (5)-IP routing, dynamic routing, and some details

Source: Internet
Author: User
1. static IP routing 1. 1. A simple route table

Routing is one of the most important functions of the IP layer. The previous section briefly describes the rules used by the router to select a route based on the IP address of the IP packet. We will not repeat it here. First, let's look at a simple system route table.

Destination gateway genmask flags metric ref use iface
192.168.11.0*255.255.255.0 u 0 0 0 eth0
169.254.0.0*255.255.0.0 u 0 0 0 eth0
Default 192.168.11.1 0.0.0.0 ug 0 0 0 eth0

For a given vrofla, five different flags can be printed.

  1. U indicates that the route is available.
  2. G indicates that the route is to a gateway. Without this sign, it means that the destination is directly connected, and the corresponding gateway should provide the destination address directly.
  3. H indicates that the route is sent to a host. If this flag is not displayed, destination is a network. In other words, destination should be written into a combination of network numbers and subnet numbers, the host number is not included (the host number is 0), for example, 192.168.11.0
  4. D indicates that the route is created for the redirection message.
  5. M The route has been modified by the redirection message

U has nothing to say. G indicates that this is a gateway. If you want to send data to destination, the IP header should be the IP address of destination, the MAC address of the data link layer should be the MAC address of the Gateway. Otherwise, if there is no G sign, the addresses of the data link layer and the IP layer should be corresponding. H indicates the nature of destination. If it is H, it indicates that the address is a complete address, with both a network number and a host number, when matching, the network number and host number must be matched. Otherwise, destination indicates a network. When matching, you only need to match the network number.

In this way, the IP address routing method can be more specific. As follows:

  1. First, use the IP address to match those destinationip addresses with the H sign.
  2. If 1 fails, the network addresses are matched.
  3. If 2 fails, it is sent to the default gateway.

By the way, genmask (Do you still remember the subnet mask) specifies the subnet number of the destination address. For example, the first subnet is 11.

1. 2. Other knowledge about route tables

Generally, when we configure a network interface, a route is directly created. You can also manually add routes. Use the route add command.

When an IP packet is found to be accessible from a vro, The vroicmp sends an "inaccessible host" or "inaccessible network" ICMP packet to the source host to report an error.

Note: Generally, the operating system does not have the routing function by default, and you need to configure it yourself. I will not elaborate on these historical reasons,

1.3.icmp IP redirection messages and routing discovery packets

When an IP packet is switched somewhere, an ICMP redirection packet is sent back to the source host that sends the IP packet, and the source host can use this information to update its route table, as network communication increases, route tables become more and more complete, and data forwarding speeds become faster and faster. Note the following:

  1. The redirection message can only be sent by the router.
  2. The redirection message is used by the host, not the router.

During host boot, an ICMP packet of a route request is generally sent to the network, and multiple routers respond to one route notification packet. In addition, the route itself occasionally releases route notification packets in the network. In this way, based on these packets, each host will have the opportunity to establish its own route table for network communication. The router can advertise multiple addresses in a notice and give the priority level for each address. This priority level is the level of the IP as the default route, as for how to calculate it, I will not go into detail.

Generally, a notification is published at an interval of-seconds, and the lifetime of a notification message is 30 minutes. The host sends a request message every three seconds during the boot process. Once a valid notification message is received, the request message is stopped.

Only solaris2.x supports these two types of packets when writing TCP/IP details. Most systems do not support these two types of packets. (Some useful routing packets will be discussed later)

Dynamic Routing Protocol

The preceding routing method is called Static Routing. In short, when you configure an interface, the route table items are generated by default. Add Table items by using route or update table items by using ICMP packets (usually when errors occur by default ). If none of the three appeal methods are met, we will use dynamic routing.

Dynamic Routing Protocol is an important part of dynamic routing, but they only use communication between routers and between adjacent routers. The system (route selection program) selects the appropriate route entries and places them in the core route table. Then the system can find the most suitable network according to the core route table. That is to say, dynamic routing is performed outside the system's core network. It only uses some routing policies to influence the route table, but does not affect the part that selects the route through the route table. There is a common type of routing protocols called the Internal Gateway Protocol (IGP). In IGP, rip is the most important protocol. A new IGP protocol is calledOpen Shortest Path First (OSPF) ProtocolTo replace rip. Another IGP protocol-Hello, which was first used on the network backbone network, is no longer needed.

Nowadays, any vro supporting dynamic routing must support both OSPF and rip, and other IGP protocols can be selectively supported.

2.1.unix Selector

Generally, there is a routing daemon on UNIX systems --Routed. Another example isGate. Gate supports more protocols than routed. Routed only supports ripv1. Gate supports r1_1, V2, bgpv1, and so on.

2.1.rip: Routing Information Protocol

Its definition can be found in rfc1058, which uses UDP as the carrier (that is, the UDP upper-layer protocol ). What we are most concerned about is one of the rip segments, which is called the measurement segment. This is a hop-based counter (that is, the number of routes taken as the counter) ). This measurement segment will eventually affect the creation of the route table. Reference diagram:

Generally, routed undertakes the following tasks:

  1. To send rip request packets to each known router, other routers are required to provide a complete route table. The command field of this type of message is 1, the address field is 0, and the measurement area is 16 (equivalent to infinity ).
  2. Accept the request. If the request is received, the complete route table is handed over to the requester. If not, process the IP request table items and add some of the table items to the number of hops, while others to the number of hops. Then send it to the requester.
  3. Accept the response. Update your route table. Use a small hop number rule.
  4. Regularly update the route table. Generally, the route table is updated for 30 s (which is really frequent) to inspire neighboring routes. This form can make the broadcast form.

This protocol seems to work very well, but there are actually many hidden concerns. For example, rip does not have the concept of subnet, such as the danger of loops. The maximum number of hops also limits the network size.

Therefore, there are many alternatives to r1_1, such as r1_2 and OSPF. They all influence the route table through a certain policy, so don't talk about it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.