Introduction

This is about the address resolution problem, i.e., to provide mapping between an IP address to the corresponding link address. To understand the problem, we examine how we transmit and forward an IP network in an internetwork.

Address Resolution

The solution is simple. It is just to ask hosts to report their link addresses.

IPv4 Address Resolution

Observe the following,

  1. Do this,

      brooklyn@flatbush:~$ sudo scapy3
      >>> packets = sniff(prn=lambda p: p.summary(), filter='arp')
    
    
  2. Do this,

      brooklyn@flatbush:~$ sudo scapy3
      >>> packet = Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst='10.1.1.1')
      >>> sendp(packet)
      .
      Sent 1 packets.
      >>>
    
  3. Observe this

      brooklyn@flatbush:~$ sudo scapy3
      >>> packets = sniff(prn=lambda p: p.summary(), filter='arp')
      Ether / ARP who has 10.1.1.1 says 10.1.1.2
      Ether / ARP is at 08:00:27:08:0d:a1 says 10.1.1.1 / Padding
    

Alternatively, we can use sr, the layer 3 sending and receiving function.

>>> ans,unans =  sr(packet)
Begin emission:
..*Finished sending 1 packets.

Received 3 packets, got 1 answers, remaining 0 packets
>>> ans.summary()
ARP who has 10.1.1.1 says 10.1.1.2 ==> ARP is at 08:00:27:08:0d:a1 says 10.1.1.1 / Padding
>>>

We can also the layer 2 sending and receiving function.

>>> ans,unans = srp(packet, iface='enp0s9')
Begin emission:
*Finished sending 1 packets.

Received 1 packets, got 1 answers, remaining 0 packets
>>>

But, what about this,

>>> ans,unans = srp(packet)
Begin emission:
Finished sending 1 packets.

Exercises and Exploration

Complete the exercises in the above.