IP subnet addressing, IP Route Selection, IP header splitting, and IP standardization process

Source: Internet
Author: User

IP subnet addressing

All Hosts must support subnet addressing (rfc950 [mogulandpostel1985]). I
The P address is simply composed of a network number and a host number. Instead, the host number is divided into a sub-network number and a host number.
The reason for this is that Class A and Class B addresses allocate too much space for the master host number, and the number of hosts can be-2 and 21 respectively.
6-2. In fact, there are not so many hosts in a network. Because all the host numbers 0 or 1 are invalid, we subtract 2 from the total number.
Obtain a certain type of I in InterNIC
After the P network number is assigned, the local system administrator determines whether to establish a subnet and how many bits are allocated to the subnet number and host number. For example, there is a Class B network address (140.252). In the remaining 16 bits, 8 bits are used for subnet numbers, and 8 bits are used for host numbers, in the format of 3-5. In this way, 254 subnets are allowed, and each subnet can have 254 hosts.

Figure 3-5 subnet addressing of Class B addresses
Many administrators use the natural division method, that is, the first 8 bits in the 16 bits left to the host in the Class B address are used as the subnet address, and the last 8 B I t is used as the host number. In this way, it is easier to determine the subnet number for the I p address expressed by the dot-decimal method. However, it is not required that the subnet division of Class A or Class B addresses should be based on bytes.
Most of the subnet examples are Class B addresses. In fact, the subnet can also be used for Class C addresses, but it only has a small number of available bits. The subnet of Class A addresses is rare because Class A addresses are very few (however, most class A addresses are subnet-based ).
A subnet hides the details of an internal network organization (on a campus or within a company) from an external router. In our network example, all I p addresses have a class B network number 1 4 0. 2 52. However, there are more than 3 0 subnets, and more than 4 0 hosts are distributed in these subnets. A vro provides I n t e r n e t access, as shown in 3-6.
In this figure, most routers are numbered Rn and n is the subnet number. We provide vrouters connecting to these subnets, and also include nine systems in the figure above the hosts page. In the figure, Ethernet is represented by a crude line and point-to-point link is represented by a dotted line. We did not plot all hosts in different subnets. For example, in subnet 14 0. 2 5 2. 3, there are more than 5 0 hosts, and in subnet 1 4 0. 2 5 2. 1. The number of hosts exceeds 1 0.
Compared with 3 0 class C addresses, the advantage of using a Class B address that contains 3 0 subnets is that it can reduce the scale of the I n t e r n e t route table. The fact that Class B address 1 4 0. 2 5 2 is divided into several subnets is transparent to I n t e r n e t routers other than all subnets. In order to reach the I P address, the start part is 1 4 0. 2 5 2 host, the external router only needs to know the access to the I P address 1 4 0. 2 5 2. 1 0 4. 1 path. That is to say, for network 1 4 0. 2 5 2, only one route table is required. If 3 0 class C addresses are used, 3 0 Route tables are required. As a result, subnet division reduces the size of the route table (in section 1 0. 8, we will introduce a new technology, that is, using class C addresses can also reduce the size of the route table ).
The subnet is not transparent to the vrouters In the subnet. As shown in 3-6, a data packet from I n t e r n e t arrives at G a t e w a Y, and its destination address is 1 4 0. 2 5 2. 5 7. 1. Vro g a t e w a y needs to know that the subnet number is 5 7, and then send it to k p n o. Similarly, k p n o must send the datagram to R 5 5, and then R 5 5 sends it to R 5 7.

Figure 3-6 most subnet arrangements in network noao.edu (140.252)



IP Route Selection

In terms of concept, IP routing is simple, especially for hosts. If the target host is directly connected to the source host (such as a point-to-point link) or both are on a shared network (Ethernet or a licensing Ring Network), IP datagram is directly sent to the target host. Otherwise, the host sends the datagram to a default vro and the vro forwards it. Most hosts use this simple mechanism.
Generally, the IP layer can be configured as either a router or a host. Most of today's multi-user systems, including almost all UNIX systems, can be configured as a router. We can specify a simple routing algorithm that can be used by both the host and the router. Essentially, the difference is that a host never forwards data packets from one interface to another, while a router forwards data packets. A host with the vro function should never forward data packets unless it is set as that.
In a general system, IP addresses can receive and send data packets (locally generated data packets) from TCP, UDP, ICMP, and IGMP, you can also receive and send a datagram (the datagram to be forwarded) from a network interface. The IP layer has a route table in the memory. When you receive and send a data packet, it searches for the table once. When a datagram comes from a network interface, the IP address first checks whether the destination IP address is one of the local IP addresses or the IP broadcast address. If so, the datagram is sent to the protocol module specified by the IP header protocol field for processing. If
(1) If the IP layer is set as a router, data packets are forwarded (that is, processed like the sent data packets ); otherwise (2) the datagram is discarded. Each item in the route table contains the following information:
• Destination IP address. It can be either a complete host address or a network address, which is specified by the flag field in the table (as described below ). The host address has a host number other than 0 to specify a specific host, while the host number in the network address is 0 to specify all hosts in the network (such as Ethernet and ring-based network ).

• The IP address of the next (or next hop) router (next-hoprouter) or a directly connected network IP address. A next-Stop router is a vro on a directly connected network. It can forward data packets. The next stop router is not the ultimate goal, but it can forward the datagram sent to it to the ultimate goal.

• Logo. One flag indicates whether the destination IP address is a network address or a host address, and the other indicates whether the next stop router is a real next stop router or a directly connected interface.

• Specify a network interface for data transmission.

IP route selection is based on hop-by-hop. From this route table information, we can see that the IP address does not know the complete path to any target (except for those directly connected to the host ). All IP routes provide only the IP address of the next router for datagram transmission. It assumes that the next-Stop router is closer to the destination than the host that sends the datagram, And the next-Stop router is directly connected to the host.
IP Route Selection mainly includes the following functions:
1) search the route table to find the table that exactly matches the destination IP address (both the network and host numbers must match ). If yes, the packet is sent to the next-Stop router or directly connected network interface specified in the table (depending on the value of the flag field ).
2) search the route table to find the table that matches the destination network number. If yes, the packet is sent to the next-Stop router or directly connected network interface specified in the table (depending on the value of the flag field ). All hosts on the target network can use this table. For example, all hosts on an Ethernet network use this table to find the path. Possible subnet masks must be taken into account in this search network matching method. We will discuss this in the next section.
3) search the route table and find the table marked as "default. If yes, the packet is sent to the next-Stop router specified in this table. If none of the preceding steps are successful, the datagram cannot be transmitted. If the data that cannot be transmitted comes from the local machine, an "inaccessible host" or "inaccessible network" error is generally returned to the application that generates the data.
The complete host address match is executed before the network number match. The default route is selected only when both of them fail. The default route and ICMP indirect packets sent by the next router (if we select the default route for the datagram) are powerful features of the IP routing mechanism. We will discuss them in Chapter 9th.
Specifying a vro for a network without having to specify a vro for each host is another basic feature of the IP routing mechanism. In this way, the route table scale can be greatly reduced. For example, there are thousands of vrouters on the Internet, but not more than 1 million.
First, consider a simple example: our host bsdi has an IP datagram to be sent to the host sun. Both parties are on the same Ethernet (see the diagram on the overview page ). The data transmission process is shown in 3-3.
When the IP receives the datagram from a top layer, it searches the route table and finds that the destination IP address ( is on a directly connected network (Ethernet 140.252.20 ). Therefore, find the matching network address in the table (the actual network address is due to the existence of the Ethernet subnet mask, but this does not affect the route selection discussed here ).
The datagram is sent to the Ethernet driver and then sent to the Sun host as an Ethernet data frame.
The destination address in the IP datagram is Sun's IP address (, and the destination address in the Link Layer header is the Ethernet interface address of the 48bit sun host. The 48bit ethernet address is obtained through arp.

Figure 3-3 data transmission process from host bsdi to Sun
Now let's look at another example: Host B s d I has an I p datagram to be uploaded to f t p. u. on the n e t host, its I P address is 1 9 2. 4 8. 9 6. 9. The first three routers 3-4 are shown. First, the host B s d I searches for the route table, but does not find a table that matches the host address or network address. Therefore, you can only use the default table to send the datagram to the next router, host s u n. After the datagram is transmitted from B s d I to s u n host, the destination I P address is the final host address (1 9 2. 4 8. 9 6. 9), but the link layer address is the Ethernet interface address of the s u n host. This is different from Figure 3-3 where the destination I P address and destination link layer address in the datagram refer to the same host (S U N ).

Figure 3-4 initial path from B s d I to F T P. U. N E T (
When s u n receives the datagram, it finds that the destination I P address of the datagram is not any address of the local machine, and S U N has been set to have the router function, therefore, it forwards data packets. After searching the route table, the default table category is selected. According to the default table of s u n, it forwards the datagram to the next stop router n e t B. The router address is 1 4 0. 2 5 2. 1. 1 8 3. The datagram is transmitted through the point-to-point s l I p link and adopts the minimum Encapsulation Format shown in Figure 2-2. Here, we do not provide the header like the data frame at the Ethernet link layer, because there is no such header in the s l I p link.
After receiving the datagram, n e t B performs the same steps as the S U N HOST: the destination address of the datagram is not the local address, n e t B is also set to have the router function, so it also forwards the datagram. The default route table is used to send the datagram to the next router g a t e w a Y (1 4 0. 2 5 2. 1. 4 ). Ethernet 1 4 0. 2 5 2. the host n e t B on 1 is obtained with a R p corresponding to 1 4 0. 2 5 2. 1. the 48-bit ethernet address of 4. This ethernet address is the destination address on the link layer data frame.
The router g a t e w a y also performs the same steps as the previous two routers. The router I P address of the next stop specified in its default route table is 1 4 0. 2 5 2. 1 0 4. 2 (we will confirm in Figure 8-4 that when the tr a c e r o u t e program is used, it is the next stop router used by G a t e w a Y ).
Some key points need to be pointed out in this example: 1) All Hosts and routers in this example use the default route. In fact, most hosts and some routers can use default routes for any purpose, unless it is on the local LAN.
2) the destination I P address in the datagram never changes (in 8. in section 5, we will see that the destination I P address can be modified only when the source route option is used, but this rarely happens ). All route selection decisions are based on this destination I P address.
3) each link layer may have different data frame headers, And the destination address (if any) of the Link Layer always refers to the link layer address of the next stop. In this example, two Ethernet packets encapsulate the link layer header containing the next Ethernet address, but the s l I p link does not. The ethernet address is generally obtained through a R p.

IP header Disassembly

The IP datagram format is 3-1. The header length of a common IP address is 20 bytes, unless it contains an option field.

Figure 3-1 IP datagram format and fields in the header

Analyze the header in Figure 3-1. The highest bit is on the left, and the lowest Bit is on the right.
The 32-bit values of four bytes are transmitted in the following order: the first is 0 ~ 7 bit, followed by 8 ~ 15bit, then 16 ~ 23bit, last 24 ~ 31bit. This transmission order is called the bigendian byte order. Because all the binary integers in the TCP/IP Header must be transmitted in this order, it is also called the network byte order. Machines that store binary integers in other forms, such as the littleendian format, must convert the header to the network byte order before data transmission.
The current Protocol version is 4, so IP is also called IPv4. Section 3.10 will discuss a new version of the IP protocol.
The Header Length refers to the number of 32-bit characters in the header, including any options. Because it is a 4-bit field, the header is up to 60 bytes. In Chapter 8th, we will see that this restriction makes some options, such as the route record option, useless today. The value of the common IP datagram (no choice) field is 5.
The service type (ToS) field includes a 3bit priority subfield (which has been ignored now), a 4bit TOS subfield and a 1bit unused bit, but must be set to 0. The 4bit TOS represents the minimum latency, maximum throughput, maximum reliability, and minimum cost. Only 1bit can be set in 4bit. If all 4bit values are 0, it means a General Service. Rfc1340 [reynoldsandpostel1992] describes how to set these service types for all standard applications. Rfc1349 [almquist1992] corrected the RFC and described the features of the TOS in more detail.
Figure 3-2 lists the recommended TOS values for different applications. The hexadecimal value is given in the last column, because this is the output of the tcpdump command to be seen later.

Figure 3-2 recommended service type fields

Te l n e t and r l o g I n interaction applications require the minimum transmission latency because they are mainly used to transmit a small amount of interactive data. On the other hand, f t p file transmission requires the maximum throughput. The highest reliability is indicated to network management (Sn m p) and routing selection protocol. Usenet News (NNTP) is the only application that requires the minimum cost.
Currently, most t c p/I p implementations do not support the to s feature. However, new versions of the system since 4.3bsd Reno are configured. In addition, new routing protocols such as o s p f and I s-I s can make routing decisions based on the values of these fields.
In section 2. 1 0, we mentioned that s l I p generally provides a service-type queuing method that allows interactive communication data to be processed before processing large data blocks. Because most implementations do not use the to s field, this queuing mechanism is determined and processed by s l I p, the driver first checks the protocol field (determine whether it is a t c p segment), then checks the t c p source and the port number of the sink to determine whether it is an interactive service. The comment of a driver assumes that this "nasty processing method" is required because most implementations do not allow the application to set the TOS field.
The total length field refers to the length of the entire I p datagram, in bytes. By using the header length field and the total length field, you can know the start position and length of the data content in the I p datagram. Because this field is 1 6 bits long, the I p datagram can be up to 6 5 5 3 5 bytes (recall Figure 2-5, super channel m T U is 6 5 5 3 5. It doesn't actually mean a real m t u-it uses the longest I p datagram ). When a datagram is split, the value of this field also changes.
Although a 6, 5, 3, 5, and 5-byte I p datagram can be transmitted, most link layers fragment it. In addition, the host must not receive 5 to 6 bytes of data. Since t c p divides user data into several slices, this restriction generally does not affect t c p. In the subsequent sections, we will encounter a large number of applications that use u d p (r I p, T f t p, B o t p, d N S, and S n m p ), they both limit the length of user datagram to 5 1 2 bytes, less than 5 7 6 bytes. However, in fact, most of the current implementations (especially those that support the Network File System n f S) allow more than 8 1 9 2 bytes of I p datagram.
The total length field is necessary in the I p header, because some data links (such as Ethernet) need to fill in some data to reach the minimum length. Although the minimum frame length of Ethernet is 4 6 bytes, the I p data may be shorter. If there is no total length field, the I p layer does not know how many of the 4 6 bytes are the content of the I p datagram.
The ID field uniquely identifies each datagram sent by the host. Generally, the value of each sent packet is increased by 1.
Rfc791 [Postel 1981a] considers that the identification field should be selected by the upper layer of the IP address to send the datagram. Suppose there are two consecutive I p datagram, one of which is generated by T C P and the other is generated by U D p, then they may have the same ID field. Although this can also work as usual (processed by the restructuring algorithm), in most systems derived from Berkeley, each time an I p datagram is sent, the I p layer adds the value of a kernel variable to 1, regardless of the layer from which the data is sent to the IP. The initial value of the kernel variable is set based on the system boot time.
The t l (t I m e-t o-l I V E) survival time field sets the maximum number of routers that a datagram can pass. It specifies the survival time of the datagram. The initial value of t l is set by the source host (usually 3 2 or 6 4). Once a router processes it, its value is equal to 1. When the value of this field is 0, the datagram is discarded and the I c m p message is sent to the source host. Chapter 2 we will come back to discuss this field when discussing the tr a c e r o u t e program.
The header test and field are the test and code calculated based on the I p header. It does not calculate the data after the header. I c m p, I g m p, U D p, and t C P both contain both the header and the data verification code.
In order to calculate the I p test of a datagram, the test field is set to 0. Then, calculate the binary inverse sum of each 16 bit in the header (the whole header is regarded as composed of a string of 16 bit characters), and the result is included in the test field. When an I p datagram is received, the sum of the binary anticode for each 16 bit in the header is also carried out. Because the receiver contains a checksum in the sender's header during the computation process, if the header has no errors during transmission, the receiver's computation result should be 1 in total. If the result is not all 1 (namely, check and error), I p discards the received datagram. However, no error messages are generated. The upper layer discovers the lost data packets and re-transmits them.
I c m p, I g m p, U D P and T C P both adopt the same test algorithm, although T C P and U D P besides their header and data, the I p header also contains different fields. The rfc1071 [Braden, Borman and Patridge 1988] section describes how to calculate the I n t e r n e t-test and implementation techniques. Because the router often only modifies the t tl field (minus 1), when the router forwards a packet, the test can be added without re-computing the entire I p header. R f c 1141 Mallory and kullberg 1990] An effective method is provided.
However, the standard BSD does not adopt this method when forwarding data reports. Each I p datagram contains the source I p address and destination I P address. As we said in section 1. 4, they are all 32 bit values. The last field is any option and is an optional variable length information in the datagram. Currently, these options are defined as follows:
Security and processing restrictions (for military purposes)

Record path (let every vro write down its I P address ,)

Timestamp (let every vro write down its I P address and time ,)

Loose Origin Site routing (specify a series of mandatory I p addresses for the datagram ,)

Strict Source Site Selection (similar to loose source site selection, but only the specified addresses are required, not other addresses ). These options are rarely used, and not all hosts and routers support these options. The option fields always use 32 bit as the boundary. When necessary, insert a byte with a value of 0. This ensures that the I p header is always an integer multiple of 32 bits (this is required by the header length field ).

IP standardization process

Who controls the TCP/IP protocol family, who defines new standards and other similar things? In fact, there are four groups responsible for Internet technology.
1) Internet Association (ISOC, internetsociety) is a professional organization that promotes, supports, and promotes the continuous growth and development of the Internet. It uses the Internet as the infrastructure for global research and communication.
2) The Internet Architecture Board (IAB, internetubuntureboard) is a body for technical supervision and coordination. It consists of 15 international volunteers from different specialties and serves as the final editor and technical review of Internet standards. IAB is affiliated with Isoc.
3) The Internet Engineering team (IETF, internetengineeringtaskforce) is a short-term standard-oriented organization that has nine fields (applications, routing and addressing, and security ). IETF has been developed into Internet standards. To help the IETF Chairman, an Internet Engineering Steering Group (iesg, internetengineeringsteeringgroup) was established ).
4) The Internet research team (irif, internetresearchtaskforce) primarily studies long-term projects. Both IRTF and IETF belong to IAB. The document [crocker1993] provides more detailed information about the internal standardization process of the Internet, and also introduces its early history.

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.