Salta al contenuto
Note per Studenti ARP - Address Resolution Protocol Report

ARP - Address Resolution Protocol

In questa pagina 6

The problem

An IP datagram travels inside a frame, and to send the frame on the physical link the MAC address of the next node is needed, because the link layer does not understand IP addresses. The sender knows the destination IP and the IP of the next router (from its routing table); the MAC is obtained with ARP. (Names are translated to IPs by DNS: DNS - Domain Name SystemDNS translates names such as www.amazon.com into IP addresses; it is a distributed hierarchical database (an inverted tree of up to 128 levels, with 13 root servers and domains registered through ICANN-accredited registrars), each ISP has a local DNS whose address the host gets from DHCP, the host asks it (usually over UDP) and it queries root, top-level and organisation servers, every server caches what it learns marking answers as non-authoritative until the TTL expires, records are (name, type, value, class, TTL), with NAT the DNS must return the public address, and there are four types of attack including cache poisoning.DNS - Domain Name System →.)

Definition. ARP is an auxiliary network-layer protocol that, given the IP address of a node on the same local network, finds its MAC address, using the broadcast capability of the underlying link.

Who to ask: destination or router?

The sender computes destination IP AND own mask and compares it with its own network address (Network Layer and IPv4 AddressingThe network layer delivers datagrams host to host through routers (encapsulation, routing, forwarding); an IPv4 address is 32 bits split into a network prefix and a host suffix, and modern classless addressing (CIDR) gives a block of 2^(32-n) addresses from a.b.c.d/n, with network and broadcast addresses computed through the netmask.Network Layer and IPv4 Addressing →). Alice =130.23.43.20/24=130.23.43.20/24: (a) destination 130.23.43.25130.23.43.25 gives the same network, direct forwarding, ARP asks for the MAC of 130.23.43.25130.23.43.25; (b) destination 130.23.44.9130.23.44.9 gives 130.23.44.0≠130.23.43.0130.23.44.0\neq130.23.43.0, indirect forwarding: the frame goes to the default router (e.g. 130.23.43.1130.23.43.1) and ARP asks for the MAC of the router, not of 130.23.44.9130.23.44.9, which would never answer a broadcast of this network (Forwarding and Routing TablesForwarding moves each packet one hop at a time toward its destination; it is direct when the destination is on a local network (ARP gives its MAC) and indirect otherwise (the packet goes to the next hop or default gateway given by the routing table). With netmasks, delivery is direct on interface x if the destination AND the mask equals the interface address AND the mask; otherwise the table is scanned from the longest mask (longest prefix match) and the default route 0.0.0.0/0 always matches; route aggregation shortens tables.Forwarding and Routing Tables →). The IP destination inside the datagram stays 130.23.44.9130.23.44.9.

Operation

Each host has an ARP table (cache) of recently learned (IP, MAC) pairs, consulted before sending; if the pair is missing:

  1. ARP request (broadcast). Contains sender MAC and IP and the target IP; the target MAC field is zero. The frame destination is FF:FF:FF:FF:FF:FF.
  2. ARP reply (unicast). Every host receives the request, but only the node whose IP matches answers, with its IP and MAC, directly to the requester.
  3. Cache update. The requester stores the pair and sends the frame; the target may also learn the requester's pair.
field request reply
frame destination MAC FF:FF:FF:FF:FF:FF requester's MAC
frame source MAC requester target
sender IP and MAC (in message) requester's target's
target IP and MAC (in message) wanted IP, MAC =0=0 requester's

Example. Alice (130.23.43.20130.23.43.20, MAC B2:34:55:10:22:10) wants Bob (130.23.43.25130.23.43.25, MAC A4:6E:F4:59:83:AB, unknown). Request: frame destination FF:FF:FF:FF:FF:FF, source B2:34:55:10:22:10; message sender (130.23.43.20130.23.43.20, B2:...:10), target (130.23.43.25130.23.43.25, 00:00:00:00:00:00). Reply: frame destination B2:34:55:10:22:10, source A4:6E:F4:59:83:AB; message sender (130.23.43.25130.23.43.25, A4:...:AB), target (Alice's pair). Alice stores 130.23.43.25→130.23.43.25\to A4:6E:F4:59:83:AB.

Packet format

field length meaning
Hardware Type 16 bit link technology: 0x0001 Ethernet
Protocol Type 16 bit IPv4 == 0x0800
HLEN 8 bit MAC length: 6 bytes
PLEN 8 bit IP length: 4 bytes
Operation 16 bit 1 ARP request, 2 ARP reply, 3 RARP request, 4 RARP reply
sender hardware address HLEN bytes sender MAC
sender protocol address PLEN bytes sender IP
target hardware address HLEN bytes all 0 in a request
target protocol address PLEN bytes target IP

For Ethernet and IPv4 the packet is 8+6+4+6+4=288+6+4+6+4=28 bytes; since the minimum Ethernet payload is 46 bytes, 46−28=1846-28=18 bytes of padding are added.

ARP over several hops: always the next hop

ARP never resolves the final destination, only the next node on the current link. Alice sends through routers R1 and R2 to Bob: Alice looks up the next hop in her routing table (R1), uses ARP to get R1's MAC, builds the frame; R1 decapsulates, finds the next hop (R2) in its table, uses ARP to get R2's MAC and re-encapsulates; and so on. Addresses along the path:

hop MAC dest MAC source IP dest IP source
Alice to R1 L1L_1 LAL_A NBN_B NAN_A
R1 to R2 L3L_3 L2L_2 NBN_B NAN_A
R2 to Bob LBL_B L4L_4 NBN_B NAN_A

IP addresses stay the same end to end; MAC addresses are rewritten at every hop.

Broadcast domains and proxy ARP

Each IP subnet is a separate broadcast domain, and an ARP message cannot leave the sender's subnet. Proxy ARP, implemented in the router joining the subnets, intercepts ARP requests for addresses of other subnets and answers with its own MAC, then forwards the frames carrying its MAC to the right subnet. It allows dividing a network into subnets without configuring routing tables in every host. Switches do not affect ARP: a broadcast is flooded on all ports. Related protocols: RARP, BOOTP and DHCP (DHCP - Dynamic Host ConfigurationBOOTP (obsolete) statically maps MAC addresses to IP addresses, while DHCP assigns addresses dynamically on lease, even after the operating system has started; the client-server dialogue runs over UDP (server port 67, client port 68) with DHCPDISCOVER, DHCPOFFER, DHCPREQUEST and DHCPACK (plus DHCPRELEASE), and the ACK delivers IP address, netmask, default gateway and DNS server, with lease renewal at 50 percent and rebinding at 87.5 percent of the lease.DHCP - Dynamic Host Configuration →) assign an IP address to a host joining the network.

Versione ripasso

Teoria collegata