TCP/IP Learning Note (2)----------IP protocol and addressing

Source: Internet
Author: User
Tags rfc

Brief introduction

The next post will eventually parse the TCP/IP protocol in detail

The main focus of this lecture is on addressing

The most core protocol in the family of TCP/IP protocols, providing unreliable, non-connected datagram transport services.

    • Unreliable: There is no guarantee that IP datagrams will be delivered successfully.
    • No connection: The status information of subsequent datagrams is not maintained, and the processing of each datagram is independent of each other. Datagrams may not be received in the order they were sent. Multiple datagrams sent by the same site to another site may arrive through different routes.
Frame format

The IP datagram format is as follows.

  • Version: IP protocol version number, currently 4. So called IPv4.
  • Header length: In 4- byte units. The minimum value is 5, and the IP header size, which does not contain an optional field, is . The maximum value of the IP header is the maximum length of .
  • Service Type (TOS):3bitPriority(has been ignored),4bitof theTOSfields,1bitnot used(0). 4bitof theTOSminimum delay, maximum throughput, maximum reliability, minimum cost, respectively. 4bitcan only be placed in one of the1. Full zero indicates a General Service. now most the TOS attribute is not supported in TCP/IP implementations , but QoS in wireless is useful to this field 。
  • Total length: The length of the entire IP datagram, in bytes . 16bit , I know IP Maximum datagram length is 65535 bytes.
  • Identifier: Uniquely identifies a copy of the IP datagram . The usual value is incremented.
  • Flag bit:
  • Chip Offset:
  • ttl: time  to live , time to live. Sets the maximum number of routers that datagrams can pass. Set by the source host, 0 When span style= "font-family: Arial", is discarded. and send icmp message notification source host.
  • protocol: A protocol based on Ip icmp : 1 , igmp : 2 tcp : 6 udp : 17
  • First checksum: Calculates the data after the header based on the checksum computed by the IP header. The first Test and 0, according to 16bit binary Inverse code summation, the results are stored in the inspection and field.
  • Source IP Address
  • Destination IP address
  • Optional fields:

Security and handling restrictions (for military applications, see RFC 1108)

Record the path (let each router write down its IP address)

Timestamp (let each router write down its IP address and time)

Loose Source station clip (a list of IP addresses that must be passed for a specified number of reports)

Strict source station clip (can only be specified by these addresses)

The optional field must be an integer multiple of 32bit, and if necessary, insert 0 for padding because the IP header is always 32bit Number of integers (this is required for the header length field)

IpRoute Selection

For a host, the IP datagram is sent directly to the destination host if the destination host is directly connected to the source host or is on the same network. Otherwise, the host sends the datagram to the default router, which is forwarded by the router.

the IP layer can be configured as a function of a router, or it can be configured as a host function. The difference is that the host does not forward the datagram, and the router needs to forward the packet.

The IP layer has a routing table in memory that is searched when a datagram is received for sending.

The routing table contains information for each item:

    • Destination IP address. Can be a host address, or a network address, marked by the following flags.
    • The IP address of the next-hop router , or the interface that is directly connected.
    • Sign. A flag indicating whether the destination IP is a network address or a host address, and another flag that indicates if the next station router is a true next-station router or a direct-attached interface.
    • Specifies a network interface for the reported transmission.

IP routing mainly accomplishes the following functions:

1) Search the routing table for entries that exactly match the destination IP. If found, send the message to the next station route or to a straight connector ( depending on the value of the Flag field )

2) Search the routing table for entries that match the destination network number. Find the processing ibid. The matching method of this search network must consider the possible subnet masks.

3) Search the routing table for entries labeled "Default". If found, deal with ibid.

If none of the above is successful, discard the package and return an error that the host is unreachable or the network is unreachable.

Packets are constructed with different link layer headers through different link layers or different networks during transmission, but the IP part does not change (ignoring the NAT function of the router ). The destination address of the link layer, if any, is always the link-layer address of the next station.

Subnet addressing

Oldest:IP address = Network number + host number

Subnet addressing:IP address = Network number + Subnet number + host number

Subnets are transparent to routers outside the subnet and opaque to routers inside the subnet.

RFC 1009 allows a network that contains subnets to use multiple subnet masks.

IpAddress addressing scheme: theIPThe address is divided intoA,B,C,D,Efive categories, of whichA,B,Cas the basic class,D,Eclasses are used as multicast and reserved.

Network category

Maximum number of networks

IP address range

Maximum number of hosts

Private IP address range

A

126(2^7-2)

1.0.0.0--126.255.255.255

16777214

10.0.0.0--10.255.255.255

B

16384 (2^14)

128.0.0.0--191.255.255.255

65534

172.16.0.0--172.31.255.255

C

2097152 (2^21)

192.0.0.0--223.255.255.255

254

192.168.0.0--192.168.255.255

Internal private Address:

class A 10.0.0.0--10.255.255.255

class B 172.16.0.0--172.31.255.255

class C 192.168.0.0--192.168.255.255

Special IP Address:

0 means that all bits are 0,1 means all bits are 1,netid, subnetid and HostID are not full 0 or full 1 , respectively. the corresponding field. The subnet number column is empty to indicate that the address is not subnetting.

IP Address

Each computer must have an IP address in order to be able to connect to the Internet.

Each IP packet must have an address to be able to be sent to another computer.

In the next section of this tutorial, you will learn more about IP addresses and IP names.

The IP address contains 4 sets of numbers:

TCP/IP uses 4 sets of numbers to address the computer. Each computer must have a unique address of 4 groups of numbers.

Each set of numbers must be between 0 and 255, separated by a dot number, for example: 192.168.1.60.

32 bit = 4 bytes

TCP/IP uses 32 bits for addressing. A computer byte is 8 bits. So TCP/IP uses 4 bytes.

A computer byte can contain 256 different values:

00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000 ... Until 11111111.

You should now know why the TCP/IP address is a 4-group number between 0 and 255.

IP V6

IPV6 is an abbreviation for "Internet Protocol Version 6", also known as the next-generation Internet Protocol, which is designed by the IETF Group (Internet Engineering Task Force (ISP) Web Engineering Tasks Force) to replace the existing A new IP protocol for the IPV4 (current) protocol.

We know that the host of the Internet has a unique IP address, the IP address with a 32-bit binary number represents a host number, but the 32-bit address resource is limited, can not meet the needs of users, so the Internet research organization published a new host identification method, that is, IPv6.

In RFC1884 (RFC is the abbreviation for the Request for Comments document.) RFCs are actually some of the standards of Internet-related services, and the prescribed standard syntax suggests that 128 bits (16 bytes) of the IPV6 address be written as 8 16-bit unsigned integers, each integer in 4 hexadecimal digits separated by a colon (:), for example: 3ffe:32 01:1401:1280:C8FF:FE4D::d b39.

Domain name

12 of Arabic numerals are hard to remember. It's easier to use a name.

The name used for the TCP/IP address is called the domain name. w3cschool.cc is a domain name.

When you type a domain name like http://www.w3cschool.cc, the domain name is translated into numbers by a DNS program.

In the world, a large number of DNS servers are connected to the Internet. The DNS server is responsible for translating the domain name into a TCP/IP address and is responsible for updating each other's systems with the new domain name information.

This information is updated by DNS servers around the world when a new domain name is registered with its TCP/IP address.

This is the reference and http://www.cnblogs.com/luckyxiaoxuan/p/3393355.html

TCP/IP Learning Note (2)----------IP protocol and addressing

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.