TCP/IP Note 2. Network Layer (1) -- IP, subnet, CIDR

Source: Internet
Author: User

TCP/IP Note 2. Network Layer (1) -- IP, subnet, CIDR
1. IP
1.1 supporting agreement
IP is one of the two most important protocols in the TCP/IP system.
There are also four protocols used in combination with the IP protocol:
(1) ARP (Address Resolution Protocol) Address Resolution Protocol
(2) RARP (Reverse Address Resolution Protocol) Reverse Address Resolution Protocol
(3) ICMP (Internet Control Message Protocol) Internet Control Message Protocol
(4) IGMP (Internet Group Management Protocol) Internet Group Management Protocol

1.2. IP Division
(1) IP address classification: This is the most basic addressing method. In 1981, the corresponding standard protocol was adopted.
(2) subnet division: this is an improvement to the most basic addressing method. Its standard [RFC 950] was adopted in 1985.
(3) Constructing a supernetwork: This is a relatively new unclassified addressing method. Soon after the proposal in 1993, it was popularized and applied.
1.3. IP <----> MAC
In network transmission: Changes in MAC and IP addresses
IP --> MAC: ARP
IP <-- MAC: RARP
1.4 IP Format
An IP datagram consists of the header and data.
The first part of the header is a fixed length of 20 bytes, which is required by all IP data packets.
The fixed part of the header is followed by some optional fields, and its length is variable.

(1) version: IPV4, IPV6
(2) Header Length: 4 bits. The maximum value is 15 units (4 bytes in one unit). Therefore, the maximum length of the IP header is 60 bytes.
(3) Service Type: eight bits are used to obtain better services. This field has never been used before.
(4) total length: 16 bits, indicating the length of the sum of the header and data, in bytes. Therefore, the maximum length of a datagram is 65535 bytes. The total length must not exceed the maximum transmission unit MTU.
(5) identification accounts for 16 bits. It is a counter used to generate a datagram identifier.
(6) flag: 3 bits, MF | DF | 0,
MF: Is there any sharding?
DF: fragment not allowed?
(7) part offset: Unit: 8 bytes
(8) TTL (time to live): the lifetime of a datagram in the network, measured in seconds.

2. IP address of the category

Network id: net-id, which indicates the network to which the host (or router) is connected.
Host number: host-id, which indicates the host (or vro)
IP Address: :={ <network number >,< host number>}





3. Dividing subnets
3.1 A Bit
(1) Security
(2) control broadcast storms
(3) Ease of Management
Format 3.2
Several bits are borrowed from the host number as the subnet number subnet-id, and the host number host-id reduces several BITs accordingly.
IP Address: :{< network number >,< subnet number >,< host number>}
3.3 Subnet Mask
Sub Net Mask: Find the subnet in the IP address
IP & Mask = net-id + sub-id
IP | Mask = host-id

4. CIDR (Classless Inter-Domain Routing)
128.14.32.0/20
Features 4.1
(1) CIDR eliminates the traditional concepts of Class A, Class B, and class C addresses and subnetworks, so it can allocate IPv4 address spaces more effectively.
(2) CIDR uses network-prefix of various lengths to replace the network number and subnet number in the classification address.
(3) the IP address is returned from the three-level addressing (using the subnet mask) to the two-level addressing.
Format 4.2
IP address ::{< network prefix >,< host number>}


This ISP has a total of 64 Class C networks. If you do not use the CIDR technology, you need to have 64 items in the routing table of each vro that exchanges route information with the ISP's router. However, after Address Aggregation, you only need to use the 206.0.64.0/18 project after route aggregation to find the ISP.

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.