Tcpip explanation note (3) IP Internet Protocol

Source: Internet
Author: User

1. IP is the most core protocol in TCP/IP. All TCP, UDP, ICMP, and other protocols are transmitted in IP datagram format. The IP protocol provides unreliable and connectionless services. It does not guarantee that data packets can be delivered for a certain purpose, nor guarantee the order of data packets.

2. IP Header

Note: The network byte order: the 32-bit transmission order is 0-7bit, 8-15bit, 16-23bit, and 24-31bit (that is, the big endian byte order)

3. IP routing

The IP route is selected one by one. The IP address does not know the complete path to any target (except those directly connected to the host ). All IP routes provide only the I P 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
If yes, the packet is sent to the next-Stop router or directly connected network interface specified in this table (depending on
Field value ).
2) search the route table to find the table that matches the destination network number. If yes, the report is sent to the table.
The specified next stop router or directly connected network interface (depending on the value of the flag field ). Destination Network
All Hosts can use this table. For example, all hosts on an Ethernet network use this table.
.
Possible subnet masks must be taken into account in this search network matching method. In the next section
Discussion.
3) search the route table and find the table marked as "default. If yes, the report is sent to the table.
The router of the specified next stop.

If none of the preceding steps are successful, the datagram cannot be transmitted. If the data cannot be transmitted from
The local machine will generally generate a datagram to the applicationProgramThe error "host inaccessible" or "Network inaccessible" is returned.

The IP route selection is implemented step by step. The destination IP address of the datagram remains unchanged during transmission of each station,
The encapsulation and target link layer addresses can be changed on each site. Most hosts and many Routers
Use the default next stop router.

Two features of the IP Route Selection Mechanism:
(1) complete host address matching is executed before network number matching
(2) specify a route for the network without specifying a route for each host

4. subnet division
Generally, both Class A and Class B addresses must be divided into subnets. the host number is further divided into a sub-network number and a host number, which reduces the number of hosts in a network and also reduces the size of the route table. A subnet hides the details of an internal network for an external router.

5. Subnet Mask

The subnet mask is used to determine how many bits are used for the network number and how many bits are used for the host number.

Given the IP address and subnet mask, the host can determine the purpose of IP datagram:
(1) hosts on the subaccount network;
(2) hosts in other subnets of the Network;
(3) hosts on other networks.

If you know the IP address of the local machine, you will know whether it is a class A, Class B, or Class C address (from the high IP address ), the line between the network number and the subnet number. According to the subnet mask, we can see the line between the sub-network number and the host number.

6. Special IP addresses

7. ifconfig, netstat

Ifconfig can be used to configure and query Network Interface Information: ifconfig
Netstat can also provide interface information: netstat-in
Netstat can also query the route table information: netstat-Rn

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.