Bird
Raised Fist0
Interview Prepcomputer-networkseasyAmazonGoogleMicrosoftTCSInfosys

ARP - Address Resolution Protocol, ARP Cache & Spoofing

Choose your preparation mode3 modes available
▶
Steps
setup

Initialize ARP Cache and Network Nodes

The host initializes its ARP cache as empty and sets up the network nodes: Client (Host A), Router, and Server (Host B). No packets are in transit yet.

💡 Initialization is crucial to understand the starting point where no MAC address mappings exist, so ARP resolution is necessary.
Line:arp_cache = {} client = Node('client') router = Node('router') server = Node('server')
💡 The ARP cache starts empty, so the host must send an ARP request to resolve the MAC address.
📊
ARP - Address Resolution Protocol, ARP Cache & Spoofing - Watch the Algorithm Execute, Step by Step
Watching this step-by-step packet flow is the fastest way to understand ARP because it reveals the exact message exchanges and cache state changes that are otherwise abstract in code or theory.
Step 1/10
·Active fill★Answer cell
ARP cache initialized empty; network nodes ready.
Hop: 0
Host A
Router
Host B
Cache miss detected; preparing ARP request broadcast.
Hop: 0
Host A
Router
Host B
src→192.168.1.2:—
dst→192.168.1.3:—
ARP cache lookup: Host B IP not found
ARP request broadcast packet created and sent.
Hop: 1
Host A
Router
Host B
📦Packet
↗ fromclient
↘ tobroadcast
📄 payloadARP Request: Who has 192.168.1.3? Tell 192.168.1.2
🔌 protocolARP
🚩 flagsbroadcast
src→192.168.1.2:—
dst→255.255.255.255:—
data→Who has 192.168.1.3? Tell 192.168.1.2
flags→broadcast
ARP cache lookup: Host B IP not found
ARP request broadcast sent by Host A
Host B recognizes its IP in ARP request and prepares reply.
Hop: 2
Host A
Router
Host B
📦Packet
↗ fromrouter
↘ toserver
📄 payloadARP Request: Who has 192.168.1.3? Tell 192.168.1.2
🔌 protocolARP
🚩 flagsbroadcast
src→192.168.1.2:—
dst→255.255.255.255:—
data→Who has 192.168.1.3? Tell 192.168.1.2
flags→broadcast
ARP cache lookup: Host B IP not found
ARP request broadcast sent by Host A
ARP request received by Host B
ARP reply packet created and sent unicast to Host A.
Hop: 3
Host A
Router
Host B
📦Packet
↗ fromserver
↘ toclient
📄 payloadARP Reply: 192.168.1.3 is at MAC 00:11:22:33:44:55
🔌 protocolARP
🚩 flags
src→192.168.1.3:—
dst→192.168.1.2:—
data→MAC 00:11:22:33:44:55
ARP request broadcast sent by Host A
ARP request received by Host B
ARP reply sent by Host B to Host A
Host A ARP cache updated with Host B's MAC address.
Hop: 4
Host A
Router
Host B
src→192.168.1.3:—
dst→192.168.1.2:—
data→MAC 00:11:22:33:44:55
ARP request received by Host B
ARP reply sent by Host B to Host A
ARP reply received by Host A; cache updated
Data packet sent using MAC address resolved by ARP.
Hop: 5
Host A
Router
Host B
📦Packet
↗ fromclient
↘ toserver
📄 payloadData Packet
🔌 protocolIP
🚩 flags
src→192.168.1.2:12345
dst→192.168.1.3:80
data→HTTP GET /
ARP reply sent by Host B to Host A
ARP reply received by Host A; cache updated
Data packet sent from Host A to Host B using resolved MAC
Host B received and is processing the data packet.
Hop: 6
Host A
Router
Host B
src→192.168.1.2:12345
dst→192.168.1.3:80
data→HTTP GET /
ARP reply received by Host A; cache updated
Data packet sent from Host A to Host B using resolved MAC
Data packet received by Host B
ARP cache at Host A updated with Host B's MAC address.
Hop: 7
Host A
Router
Host B
Data packet sent from Host A to Host B using resolved MAC
Data packet received by Host B
ARP cache at Host A: 192.168.1.3 → 00:11:22:33:44:55
ARP resolution cycle finished; Host A ready for direct communication.
Hop: 7
Host A
Router
Host B
Data packet received by Host B
ARP cache at Host A: 192.168.1.3 → 00:11:22:33:44:55
ARP resolution process complete

Key Takeaways

✓ ARP resolves IP addresses to MAC addresses by broadcasting requests and receiving targeted replies.

This insight is hard to see from code alone because the broadcast and unicast nature of ARP packets is implicit, but the visualization shows it explicitly.

✓ The ARP cache stores resolved mappings to avoid repeated broadcasts, improving network efficiency.

Seeing the cache update and lookup visually clarifies why ARP cache is critical for performance.

✓ Only the host owning the requested IP responds to ARP requests, ensuring correct MAC resolution.

The decision to reply or ignore is a key branching point that the visualization highlights clearly.

Practice

(1/5)
1. In which scenario would you most likely use CIDR notation instead of traditional classful addressing?
easy
A. When you want to efficiently allocate IP addresses to networks of varying sizes without wasting addresses
B. When you want to separate the network and host portions strictly by the first octet
C. When you need to allocate IP addresses in fixed blocks of Class A, B, or C sizes
D. When you want to assign IP addresses only within Class C networks

Solution

  1. Step 1: Understand classful addressing limitations

    Classful addressing allocates IP blocks in fixed sizes (Class A, B, C), often wasting many IP addresses.
  2. Step 2: Recognize CIDR's flexibility

    CIDR allows variable-length subnet masks, enabling allocation of IP blocks tailored to network size, reducing waste.
  3. Step 3: Evaluate options

    When you need to allocate IP addresses in fixed blocks of Class A, B, or C sizes describes classful allocation, not CIDR. When you want to separate the network and host portions strictly by the first octet is about classful fixed boundaries. When you want to assign IP addresses only within Class C networks restricts to Class C, which CIDR overcomes.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    CIDR is used for efficient IP allocation across variable network sizes [OK]
Hint: CIDR = flexible IP blocks, classful = fixed blocks
Common Mistakes:
  • Believing CIDR only applies to Class C networks
  • Thinking CIDR is just a different notation without functional difference
  • Assuming classful addressing is still standard for IP allocation
2. Trace the sequence of events when an external client accesses an internal web server via port forwarding configured on a NAT router.
easy
A. The router changes the destination IP and port to the internal server's IP and port, forwards the packet, and rewrites the source IP of the reply back to the router's public IP.
B. The router changes the destination IP and port to the internal server's IP and port, then forwards the packet; the server replies directly to the client.
C. The router only changes the destination IP but leaves the port unchanged; the internal server receives the packet and replies to the router.
D. The router forwards the packet without any translation; the internal server replies directly to the external client.

Solution

  1. Step 1: Understand port forwarding (DNAT)

    Port forwarding rewrites destination IP and port of incoming packets to internal server's IP and port.
  2. Step 2: Trace reply path

    The server replies to the router's internal IP, which rewrites the source IP back to its public IP before sending to the external client.
  3. Step 3: Analyze options

    The router changes the destination IP and port to the internal server's IP and port, forwards the packet, and rewrites the source IP of the reply back to the router's public IP correctly describes both forward and reply translation. The router changes the destination IP and port to the internal server's IP and port, then forwards the packet; the server replies directly to the client is incorrect because the server cannot reply directly to the client without NAT rewriting. The router only changes the destination IP but leaves the port unchanged; the internal server receives the packet and replies to the router misses port translation. The router forwards the packet without any translation; the internal server replies directly to the external client ignores NAT translation entirely.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Port forwarding requires bidirectional NAT translation [OK]
Hint: Port forwarding rewrites destination IP/port inbound and source IP outbound
Common Mistakes:
  • Assuming server replies directly to external client
  • Forgetting port translation in forwarding
  • Ignoring reply path NAT rewriting
3. Which of the following statements about the TCP connection termination process is INCORRECT?
medium
A. The connection closes immediately after the first FIN packet is sent
B. Either side can initiate termination by sending a FIN packet
C. Connection termination requires four steps involving FIN and ACK packets from both sides
D. After termination, both sides enter a TIME_WAIT state to ensure all packets are received

Solution

  1. Step 1: Review TCP termination steps

    Termination involves a four-step exchange: FIN from initiator, ACK from receiver, FIN from receiver, ACK from initiator.
  2. Step 2: Analyze each statement

    Connection termination requires four steps involving FIN and ACK packets from both sides is correct describing the four-step process. Either side can initiate termination by sending a FIN packet is correct; either side can initiate. After termination, both sides enter a TIME_WAIT state to ensure all packets are received is correct; TIME_WAIT ensures delayed packets are handled. The connection closes immediately after the first FIN packet is sent is incorrect because connection does not close immediately after first FIN; it requires the full handshake.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Termination is a multi-step process, not instantaneous.
Hint: Termination = 4 steps, not immediate close after FIN
Common Mistakes:
  • Assuming connection closes right after first FIN
  • Thinking only server can initiate termination
  • Ignoring TIME_WAIT state
4. Which of the following statements about UDP is INCORRECT?
medium
A. UDP provides built-in congestion control to avoid network overload
B. UDP is connectionless and does not guarantee packet delivery
C. UDP is suitable for applications where speed is more important than reliability
D. UDP packets may arrive out of order or be duplicated

Solution

  1. Step 1: Review UDP characteristics

    UDP is connectionless, unreliable, and does not guarantee delivery or order.
  2. Step 2: Analyze congestion control

    UDP does not implement congestion control; it sends packets without adjusting to network conditions.
  3. Step 3: Evaluate options

    UDP provides built-in congestion control to avoid network overload is incorrect because UDP lacks congestion control. Options A, C, and D correctly describe UDP behavior.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    UDP is simple and fast but does not manage congestion.
Hint: UDP = no connection, no reliability, no congestion control.
Common Mistakes:
  • Assuming UDP has congestion control like TCP
  • Believing UDP guarantees packet order
  • Confusing connectionless with unreliable
5. If a real-time chat application needs to support thousands of clients with intermittent connectivity and occasional message bursts, which limitation of WebSockets should be considered, and what fallback mechanism is most appropriate?
hard
A. WebSocket cannot handle intermittent connectivity; fallback to opening multiple WebSocket connections per client
B. WebSocket does not support message ordering; fallback to SSE to guarantee ordered delivery
C. WebSocket connections consume significant server resources per client; fallback to HTTP Long Polling to reduce persistent connections
D. WebSocket has high latency for message bursts; fallback to HTTP/2 multiplexing to improve throughput

Solution

  1. Step 1: Identify WebSocket resource usage

    Each WebSocket connection requires server resources to maintain persistent connections, which can be costly at scale.
  2. Step 2: Consider intermittent connectivity

    Clients with intermittent connectivity may cause connection drops, increasing server load.
  3. Step 3: Evaluate fallback options

    HTTP Long Polling can reduce persistent connections by using short-lived requests, making it a suitable fallback.
  4. Step 4: Analyze other options

    WebSocket does not support message ordering; fallback to SSE to guarantee ordered delivery is incorrect; WebSocket supports message ordering. WebSocket cannot handle intermittent connectivity; fallback to opening multiple WebSocket connections per client is wrong because opening multiple connections per client worsens resource usage. WebSocket has high latency for message bursts; fallback to HTTP/2 multiplexing to improve throughput misattributes latency issues to WebSocket and suggests unrelated HTTP/2 multiplexing.
  5. Final Answer:

    Option C -> Option C
  6. Quick Check:

    WebSocket resource cost + intermittent clients -> fallback to Long Polling
Hint: WebSocket scales poorly with many persistent connections; Long Polling reduces connection count
Common Mistakes:
  • Assuming WebSocket handles intermittent connectivity gracefully without resource impact
  • Believing WebSocket lacks message ordering
  • Confusing HTTP/2 multiplexing with WebSocket fallback
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard