TCP/IP Protocol family Chapter 8th Address Resolution Protocol APR

Source: Internet
Author: User
Tags sleep time limit
8.1 Address Mapping

At the network level, hosts and routers are identified by their logical addresses (IP addresses). The logical address is unique globally.

At the physical level, hosts and routers are identified by local addresses. 8.1.1 Static Mappings

Map physical and logical addresses to a single table. Save to each machine, Cons: Need to update 8.1.2 dynamic Mappings periodically

Use protocols to find static addresses based on logical addresses. There are currently two types of protocols:

Address Resolution Protocol (APR): Resolves a logical address to a physical address,

Inverse Address Resolution Protocol (RARP). Resolves a physical address to a logical address (replaced by another protocol) 8.2 Apr protocol

Apr accepts a logical address from the IP protocol, maps it to a physical address, and then submits the physical address to the data link layer.

When ARP is working, it sends out an Ethernet broadcast packet containing the desired IP address (including the physical address of the sender, the IP address, and the IP address of the receiving party). There is no host or router on the network will receive the broadcast, but only the expected receiver can recognize its own IP address, and a packet containing IP and Ethernet address pairs as a reply, in the form of unicast response to the query.
8.2.1 Grouping format


The Hardware Type field indicates the type of hardware interface The sender wants to know, and the Ethernet value is 1.

The Protocol Type field indicates the type of high-level protocol provided by the sender, with an IP of 0806 (16 binary).

The length of the hardware address and the length of the protocol indicate the length of the hardware address and the logical address so that the ARP message can be used in any hardware and any protocol network.

The action field is used to indicate the purpose of the message, and the ARP request is a 1,arp response of 2,
8.2.2 Package

Apr data is encapsulated directly in the frame of the data link layer


8.2.3 Operation

Apr request is sent by broadcast, Apr reply is sent by single advertisement.

After the sender receives the response, it knows the physical address of the target machine. The IP datagram that is carried to the target machine is then encapsulated into frames and sent to the end point in a unicast manner. 8.3 atmapr

ATM Address Recognition Protocol (Resolution Protocol)
8.3.1 grouping format


8.3.2 ATMAPR Operation

Permanent virtual circuit: PVC connection

In the case of PVC, the reverse request message (Inverse request message) and the reverse response message (inverse reply message) can bind the physical address and IP.

SVC Link: When the router wants to establish a connection with another router (or host), a new virtual circuit must be established.

3 steps to establish a process: Connect to a server, receive a new physical address, establish a connection

In the case of SVC, the physical address and the IP address can be bound with the request message and the reply message.

The request message and the reply message can also be used to build the server mapping table.
8.3.3 Logical Subnet (LIS)

The LIS allows the ATM to be classified as several logical subnets, and to use ATMAPR, a separate server is required in each subnet. 8.4 Apr Package



8.4.1 Cache Table

Space is limited, and the mappings in the table cannot be saved with no time limit.

Status, hardware type, protocol type, hardware address length, protocol address length, connection number, queue number, attempt, timeout, hardware address, protocol address

8.4.2 Queue

The ARP protocol maintains a queue, with each queue maintaining an endpoint. Used to save IP packets when ARP attempts to resolve hardware addresses.

The output module sends unresolved IP packets to the corresponding queue, the input module takes out the packet from the queue, and the physical address is sent to the data link layer transmission.

8.4.3 Output Module

arp--output--module{
	Sleep, waiting to receive IP packet check cache table from IP software
	, looking for IP packet corresponding physical address
	if (found) {
	    if (status is resolved)
	     {
	        extract the value of the hardware address from the table entry to
	        send the packet together with the physical address to the data link layer
	         return
	     }
	     if (the state is pending) {
	     			put the packet into the response queue,
	     			return	     
	     }
	
	} else{//not found
	     
       . Create a cache table entry with a status of pending. Attempts	     
	     creates a queue for 1
	     sends a packet into the queue to
	     send an ARP request
	     return	
	}
}

8.4.4 Input Module

arp--input--module{
	Sleep until an ARP request (or answer) arrives
	to check the cache table, look for the appropriate table entry
	if (found)
	{
		Update this table entry
		if (status is Pending) {while
			(corresponding queue non-empty) {
			   send this group together with physical Address}}}
  if (not found) {
    Create a table entry
    put the new table entry in the table
  }
  If (this grouping is request grouping)
  {
    send arp reply
  }
}

8.4.5 Cache Control Module

The Cache control module is responsible for maintaining cached tables.

arp_cache_control_module{
		Sleep, timed task end
		for (table item)
		{
		   if (state free)
		    {
		      continue		    
		    }
		    if (Status is pending) {
		    	Put the attempt value +1
		    	  if (try > Max)
		    	   {change the state to free to
		    	     revoke the corresponding queue		    	   
		    	   }
		    	   else{
		    	     send an ARP request
		    	   }
		    }
		    if (state resolved)
		    {
		        decrements the value of the timeout field
		        if (timeout field value <=0)
		        {Change status to free
		        	Undo effect Queue
		        }
		    }
		}
}

**************************************************************************


Under local testing.

A simple ping. You can see that there's a 43 broadcast above. I did not respond to this machine.

44 I sent out a broadcast who had ..., 45 received a separate response from the target machine.

Arp-a can view the local cache.

To test you can arp-d delete the specified IP map.


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.