IP Routing Fundamentals-routing switching Principle 9-"Hcna notes"

Source: Internet
Author: User
Tags ftp client

1. Routing principle

When data is transmitted over a network, it is necessary to query the local routing table and then decide whether to send the packet to the switch for frame exchange or direct to the router for IP addressing, depending on the routing table. First, different data in the transport layer according to different protocols packaged into a variety of transmission messages, the content recorded in the header can control the transmission process, such as TCP messages, UDP packets and so on. The IP header is then added to the network layer depending on the destination, which indicates the IP address of the destination device. Before the message is submitted to the network card, the device queries its own routing table, as shown in this table, which records the local routing policy, that is, how the different types of IP addresses should be passed in the next. (Note: The native IP is 192.168.123.88; A router IP is 192.168.123.254)

routing Table
Number Destination Mask Gateway Interface Metric
1 0.0.0.0 0.0.0.0 192.168.123.254 192.168.123.88 1
2 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
3 192.168.123.0 255.255.255.0 192.168.123.88 192.168.123.88 1
4 192.168.123.88 255.255.255.255 127.0.0.1 127.0.0.1 1
5 192.168.123.255 255.255.255.255 192.168.123.88 192.168.123.88 1
6 224.0.0.0 224.0.0.0 192.168.123.88
192.168.123.88
1
7 255.255.255.255 255.255.255.255 192.168.123.88 192.168.123.88 1

Destination: destination network segment.

Mask: subnet mask.

Gateway: Next-Hop router ingress IP. The gateway is native IP, which means no routers are required.

interface: the local export IP. It also means that the packet should be sent using that NIC.

metric: hop count, the smaller the value, the higher the quality.

the analysis of the above routing table is as follows:

Routing Table Analysis
Number Destination Mask Gateway Interface Metric
1 0.0.0.0 0.0.0.0 192.168.123.254 192.168.123.88 1

If the IP network segment of the destination host is not found on the routing table, it will be sent from the local network card to the router connected by this machine.

2 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1

If the IP network segment of the destination host is a native loopback IP, the local machine is sent back to this machine, and the gateway is not required.

3 192.168.123.0 255.255.255.0 192.168.123.88 192.168.123.88 1

Destination host IP and native same network segment, you should send from the local network card to the switch connected to this machine, so there is no need for the gateway.

4 192.168.123.88 255.255.255.255 127.0.0.1 127.0.0.1 1

The IP of the destination host is the native IP, then the local machine is sent back to this machine, and the gateway is not required.

5 192.168.123.255 255.255.255.255 192.168.123.88 192.168.123.88 1
The destination IP is the broadcast IP of the network segment of the host, which is sent by the local NIC to the switch, so there is no need for a gateway.
6 224.0.0.0 224.0.0.0 192.168.123.88
192.168.123.88
1
The destination IP is a multicast address, which is sent to the switch by a native NIC, and no gateway is required.
7 255.255.255.255 255.255.255.255 192.168.123.88 192.168.123.88 1
The destination IP is a full-network broadcast address, which is sent from the local NIC to the switch, and does not require a gateway.


2. Routing type

According to the previous analysis we know that the route is divided into three categories: to their own, sent to the switch, destined for the router.

sent to itself: including loopback IP and native IP, loopback IP represents the host itself, is the host used for network testing, followed by detailed. The destination address is also a lot of local IP, such as on a computer installed both server and client side, two applications for communication when the destination IP is the IP of the machine. Here the target IP is the loopback address is sent through the virtual loopback interface, the target IP is this machine through the network card issued by the machine, and finally back to the machine, by the virtual loopback interface or the local network card received by the upper layer processing.

sent to the switch: All-network broadcast, multicast, network segment broadcast, and sent to the network segment of the other hosts of the packet all need to through the switch frame exchange, so the local network card sent to the network cable, the switch received and forwarded.

sent to the router: the routing table can not find the destination IP, the default is sent to the default router, in fact, there is a specified network segment of the data sent to the specified router, we will talk about later. Most of the time, the data sent to other segments needs to be forwarded through the router, so the native NIC is sent to the router for IP addressing.


3. Route selection

Taking FTP as an example, the application-level FTP client decides to send a piece of data to the server, which arrives at the transport layer and decides to transmit it using the TCP protocol, and the TCP header is composed of TCP packets. The TCP packet containing the data arrives at the network layer and then the IP message is composed according to the destination host IP and the source host IP plus the IP header, then the routing table is queried according to the type of the destination IP (send to itself, send to switch, send to Router), then decide how to send.

Send yourself: Query the routing table found that the FTP server is also deployed in the local computer, the IP message arrives after the network card does not need the group frame, directly by the NIC transfer back to the net layer, and then according to the protocol type IP packets to the process of processing. This sends the data from the native FTP client to the native FTP server.

To switch: The query routing table discovers that the FTP server is deployed in the same subnet as the native computer, then the IP message arrives at the NIC and then uses the ARP protocol to query its destination MAC address according to the IP address, then sets the frame according to the destination Mac and the source MAC address. After the frame arrives at the switch, the switch passes the frame to the destination host based on the destination MAC address.

Send to Router: Query the routing table found the FTP server in other network segments, the IP message arrives after the network card will be the router's MAC address for the destination address group frame and submitted to the switch, the switch based on the destination MAC address to pass the frame to the router. After the router obtains the frame from the IP header to obtain the destination IP, similar to the source host, the router will also query its routing table based on the type of destination IP to send itself, to the switch, or to another router. The router and switch repeat this process until the data reaches the target host.


loopback address The local loopback address, which does not belong to any one of the class address classes. It represents the local virtual interface of the device, so the default is to be considered an interface that will never go down. There are similar definitions in the Windows operating system, so it is usually possible to ping the local loopback address before the network card is installed. It is generally used to check whether the local network protocol, the basic data interface, etc. are normal.


"Route priority" there may be multiple routes from one point to another in the actual network, and the user can manually modify the routing table, and the router chooses the different paths.

In fact, routing can be generated by the router itself or manually specified by the user. There are many ways to implement the automatic learning process, and different implementations are called routing protocols, and one router can run multiple routing protocols at the same time. Different routing protocols have their own standards to measure the quality of the routes, and each routing protocol sends its best route to the routing table. This reaches a similar destination address, which may be different routes that are learned by multiple routes by different routing protocols. Although each routing protocol has its own metrics, the metric values between the different protocols have different meanings and are not comparable. The router must choose the best path computed by one of the routing protocols to join the routing table as a forwarding path.

In the actual application, the router chooses the routing protocol based on the route priority. Assigning different routing priorities to different routing protocols is a high priority for small values. When there are multiple routes to the same destination address, you can select one of the priority values as the optimal route based on the priority size, and write the route into the routing table. The routing priority principle is as follows:

1. Direct-attached routes have the highest priority.

2. Manually set the route entry priority higher than the dynamically learned route entry.

3. The measure algorithm complex routing protocol priority is higher than the metric algorithm simple routing protocol.


IP Routing Fundamentals-routing switching Principle 9-"Hcna notes"

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.