Network Layer-network layer in the Internet (IP control protocol and address resolution)

Source: Internet
Author: User
Tags rfc

 

IP Control Protocol

 

The IP protocol is only responsible for transmitting IP packets and cannot detect and control problems in the network. These tasks are completed through the Internet control protocol.

 

ICMP (Internet Control Message Protocol)

(1) The IP protocol provides the best-effort communication service.

(2) The loss, repetition delay, and disorder of data packets are inevitable.

(3) ICMP provides a mechanism for reporting errors in communication services to the source site.

 

ICMP Message format

ICMP data is encapsulated in an IP group together with its header. However, in the protocol hierarchy of the TCP/IP model, ICMP is not a single layer.

Type 0; 1 code; 2 ~ 3 checksum; 4 ~ N data Zone

 

Main Types of ICMP packets

Type
Type domain ICMP Message Type

Error Message
3. The destination site is inaccessible (many different types are indicated by code segments)

11
Datagram timeout

12
The datagram parameter is incorrect.

Control packets
4. Source suppression (used for congestion control)

5
Redirection

Request/Response Message
8. Respond to the request (response requests and responses are generally used to test whether the network is connected)

0
Response

13
Time cut requests (these two are mainly used for the synchronization clock between two hosts)

14
Time cut response

 

ICMP application example

(1) The ping command uses ICMP to respond to requests and responses. Using the ping command, an ICMP Response Request Packet (including some optional data) will be sent to the target site. If the target site receives the packet, an ICMP response packet must be sent back to the source site, if the source site receives a response packet (and any data in the packet is the same as the sent packet), the destination site is considered reachable; otherwise, the destination site is inaccessible.

(2) trace tracert command (traceroute in UNIX ). The tracert process obtains a route list through the ICMP datagram overtimes. The source host sends an IP packet to the target host, and sets hop to 1. When the first router arrives, the hop is reduced by 1 and 0. Then, the router returns an ICMP datagram timeout packet, the IP address of the router obtained from the source host is the first port address of the router. Then, the source host sends a second IP packet to the target host, sets hop to 2, and then sends 3rd and 4th IP data packets ,...... Until the target host is reached. However, the environment for Internet operation is dynamic and the path selection may be inconsistent. Therefore, tracert makes sense only on the relatively stable (relatively slow) Internet.

(3) obtain the minimum MTU in the path. The source host sends a series of test IP datagram with df = 1, that is, segmentation is not allowed. For example, the MTU through a network is small, the router will discard the datagram and take advantage of an ICMP datagram parameter error, requiring segmentation, the source host will gradually reduce the datagram length, and still set df = 1, the minimum MTU in the path is obtained until a Test message reaches the target host. After all, data packets can be separated as far as possible without segmentation, which is troublesome for restructuring.

 

Address Resolution

 

ARP (RFC 1512) (Address Resolution Protocol)

Functions of Address Resolution

(1) Protocol address

The abstract IP Address Provided by the software, such as an IP address, makes the entire Internet a network, but the real physical network cannot identify the machine through the IP address.

(2) physical address

The hardware address, such as the MAC address.

(3) Address Resolution

The conversion between the Protocol address and the physical address, such as the conversion between the IP address and the MAC address, converts the IP address to the MAC address. Address Resolution must be performed on a physical network. When a host sends data to another computer on the same physical network, it performs address resolution and then directly sends data frames based on the physical address. The IP address is virtual. When it reaches a vro, it unpacks the IP packet, obtains the IP address, parses the IP address, obtains the MAC address, encapsulates it, and then sends it.

 

Address Resolution Protocol ARP

Working principle (using an IP network as an example)

(1) an ARP request message is a data frame, which includes the hardware address and Protocol address of the sending site, and the IP address of the destination site, and broadcasts the data frame in the physical network.

(2) An ARP response message is a data frame, which includes the hardware address and Protocol address of the response site, and the IP address of the original sending site, and sends the data frame to the original sending site.

(3) static: Each site has a table. Centralized: one server is responsible for the ATM network table. Distributed: for Internet use, each machine saves its own IP address and MAC address, and broadcasts it when searching.

(4) Site W has data sent to the target site y, but it does not know the MAC address of site y yet, and cannot form a data frame. The ARP request message contains the IP address of the target site y, and the ARP response message contains the MAC address of the target site y.

 

ARP messages are directly encapsulated and sent in physical frames over Ethernet. The type of the ARP message frame is 0x806.

 

Temporarily store ARP responses and process received ARP messages

(1) ARP responses are stored in the cache or memory. You can query the table later. You do not need to send more Query Packets to reduce network traffic.

(2) extract the Protocol address and hardware address of the sender from the message and update the existing information in the cache.

(3) check whether the request is a response, and if it is a response, receive it; if it is a request, check whether it is sent to the site, and if so, send a response message.

 

RARP, BOOTP, and DHCP

These three Protocols convert MAC addresses to IP addresses, which are often used in diskless workstation. A diskless workstation has no disk and cannot store TCP/IP configuration files. Therefore, you must have a protocol to convert MAC addresses to IP addresses.

 

RARP (RFC 903) (Reverse Address Resolution Protocol)

Give an ethernet address and find the corresponding IP address.

Each subnet requires an RARP server. When the workstation wants to obtain its IP address, it broadcasts its ethernet address. The RARP server obtains this information and finds this ethernet address in its configuration file, return the corresponding IP address to the workstation. RARP messages cannot be sent across vrouters. Therefore, each subnet must have an RARP server.

 

BOOTP (Bootstrap Protocol)

BOOTP is a high-level program. It can obtain the IP address, Startup File address, and configuration information through the RARP server. The BOOTP protocol uses the Client/Server working mode. The party that needs to obtain the configuration information is called The BOOTP customer, and the party that provides the configuration information is called The BOOTP server. The customer first sends a request message using the IP address of local broadcast (if the bootp server exists in the subnet) or global broadcast (The BOOTP server is not in the same subnet, otherwise, the sender's IP address in the request packet is completely 0, indicating that the customer needs to obtain the IP address. The BOOTP server returns a response packet containing the customer's IP address and other startup information with the broadcast address.

BOOTP Problems

You need to manually configure the table corresponding to the IP address and MAC address. When a new host is added to a LAN, it cannot be started immediately with BOOTP. You must wait until the Administrator assigns it an IP address, manually write the booing between the IP address and the MAC address to the bootp configuration file.

 

DHCP (Dynamic Host Configuration Protocol)

(1) You can allocate IP addresses to hosts statically or dynamically. (When dialing the Internet, the DHCP server dynamically allocates an IP address; otherwise, no IP address is available)

(2) working methods based on customers/servers.

(3) there is no need to set up a DHCP server for each lan. Multiple LANs can share one DHCP server, but each lan must have a DHCP relay proxy to forward customer requests.

DHCP Process

(1) The customer first broadcasts a packet containing its own customer ID (DHCP discover packet) to declare its presence.

(2) Each server that receives the client's DHCP discover determines whether to allocate a static address or dynamic address when checking the user's configuration file. If a dynamic address is required, the server selects an IP address from the address pool. If you want a static address, the server extracts the static address from the configuration file, the server extracts the client's static address from the configuration file and places the address in a DHCP
The offline message is sent back to the user.

(3) After receiving the DHCP offer packet, the customer selects a server among the numerous servers, which is usually determined by the options provided in the DHCP offer packet.

(4) The customer broadcasts another DHCP request message, which server is selected and applies for using the IP address provided by the server.

(5) When the server receives the DHCP request packet and uses the address provided by the packet, the server marks the address as rented, if the packet received by the weapon indicates that the customer has received the address provided by another server, the address is returned to the address pool. If the packet is not received for a period of time, the server also returns the address to the "address pool". The selected server sends a response and DHCP packets.
Ack.

(6) The customer determines whether the configuration information is legal. After receiving the legal lease, the customer specifies a Declaration bound to the binding server and continues to use the IP address and option.

From: http://blog.chinaunix.net/space.php? Uid = 7921481 & Do = Blog & id = 1616850

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.