Computer Network basic knowledge Note (ii)

Source: Internet
Author: User

The process of forwarding packets in IP layer

There are four Class A networks connected by three routers. There can be thousands of hosts on every network. As you can imagine, if you make the routing table by the destination host number, the resulting routing table will be too large. However, if the routing table is made by the network address of the host , then the routing table in each router contains only 4 items. This allows the routing table to be greatly simplified.

The next hop router can be determined based on the destination network address, and the result is that the IP datagram will eventually be able to find the router on the destination network where the destination host is located (possibly through multiple indirect deliveries). Direct delivery to the destination host is attempted only when the last router is reached.

Default route

Routers can also take a default route to reduce the space used by the routing table and the time it takes to search the routing table. This kind of forwarding is useful when a network has very few external connections. The default route is often more likely to show its benefits when the host sends an IP datagram. If a host is connected to a small network with only one router and Internet connection, it is appropriate to use the default route in this case.

Packet forwarding algorithm

(1) Extract the destination host's IP address D from the header of the datagram, and obtain the destination network address N.

(2) If network N is directly connected to this router, the datagram is delivered directly to the destination host D; otherwise it is indirect delivery, execution (3).

(3) If the routing table has a specific host route with destination D, the datagram is routed to the next-hop router indicated in the routing table; otherwise, it is executed (4).

(4) If the routing table has a route to reach network N, the datagram is transmitted to the next hop router indicated in the routing table; otherwise, it is executed (5).

(5) If there is a default route in the routing table, the datagram is routed to the default router indicated in the routing table; otherwise, it is executed (6).

(6) Error reporting forwarding packet.

The basic idea of dividing subnets IP address:: = {< network number;, < subnet number;, < host number;}

Dividing subnets is purely a matter within a unit. The unit is still represented as a network without dividing subnets.

From the host number to borrow a number of bits as the subnet number Subnet-id, and the host number Host-id has correspondingly reduced the number of bits.

  

Dividing subnets

  

When subnets are not divided, the IP address is a level two structure. After subnetting, the IP address becomes a level three structure.

Dividing the subnet is just the IP address of the host number Host-id this part of the division, without changing the IP address of the original network number Net-id.

Reference: IP address, subnet mask, network number, host number, network address, host address

Default Subnet mask

  

A subnet mask is an important attribute of a network or a subnet. When routers exchange routing information with neighboring routers, they must tell neighboring routers the subnet mask of their network (or subnet). Each item in the router's routing table, in addition to the destination network address, must also give the subnet mask for the network. If a router is connected on two subnets, it has two network addresses and two subnet masks.

The known IP address is 141.14.72.24, and the subnet mask is 255.255.192.0. Try to find the network address.

In the example above, if the subnet mask is changed to 255.255.224.0. Try to find the network address and discuss the results.

The same IP address and different subnet masks can be used to obtain the same network address; Two examples of the number of subnets that can be divided and the maximum number of hosts in each subnet are not the same.

  Forwarding by using subnet time group

(1) Extract the destination IP address from the header of the received packet D.

(2) First use the subnet mask of each network and D to phase "and" to see if the corresponding network address matches. If matched, the packet is delivered directly. Otherwise it is indirect delivery, execution (3). (3) If there is a specific host route with destination D in the routing table, the packet is routed to the specified next-hop router, otherwise, it is executed (4).

(4) A subnet mask for each row in the routing table and a D phase-by "and", if the result matches the destination network address of the line, the packet is routed to the next-hop router indicated by the row, otherwise, execution (5).

(5) If there is a default route in the routing table, the packet is routed to the default router indicated in the routing table; otherwise, it is executed (6).

(6) Error reporting forwarding packet.

The routing table is known in the Internet and router R1. Host H1 sends a grouping to H2. Try to discuss the process of finding a routing table after R1 receives a packet sent by H1 to H2.

  

1. First: H1 first check whether the host 128.30.33.138 is connected to the network. If it is, it is delivered directly;

Otherwise, the router R1 is sent, and the routing table is looked up by item. (H2 IP address and subnet mask for H1?) =H1 's network address).

2. routing table R1 after receiving a packet, look for the first row in the routing table to see if the network address of the line matches the network address of the received packet.

(Destination network address and first line subnet mask for and?) = Destination network address of the first row of the routing table ... Then the second line, in the same vein: )。

  

Computer Network basic knowledge Note (ii)

Related Article

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.