DEV Community

Radz-04
Radz-04

Posted on Edited on

You Know the Website's IP. So Why Does Your PC Still Need ARP?


When I started studying networking, I learned about DNS, IP addresses, MAC addresses, ARP, TCP and UDP.

Understanding their individual definitions was one thing. Understanding how they actually work together was another.

Here's a question that helped me connect some of those concepts:

If DNS already gives my computer the IP address of a website, why does it still need a MAC address?

Let's walk through a simple example.

1. DNS finds the destination

Suppose you open https://example.com in your browser.

If the address isn't already cached, your system may perform a DNS lookup to obtain an IP address associated with that domain.

At this point, your computer knows the destination IP address.

But knowing where the server is doesn't automatically explain how the first packet leaves your local network.

2. Your computer checks its routing table

Before sending the packet, the operating system determines which network interface and route to use.

If the destination is outside your local network, the traffic will normally be sent through your default gateway.

You can inspect a routing decision on Linux with:

ip route get 1.1.1.1
Enter fullscreen mode Exit fullscreen mode

The output can show the selected interface, source IP address and next-hop gateway.

Here's where things get interesting.

The destination IP belongs to the remote server, but the next device your computer needs to reach is usually your router.

3. ARP finds the next-hop MAC address

On an IPv4 Ethernet network, your computer needs the MAC address of the local next hop.

If that information isn't already cached, ARP can resolve the gateway's IPv4 address to its MAC address.

You can inspect the neighbor table with:

ip neigh show
Enter fullscreen mode Exit fullscreen mode

For traffic sent through an Ethernet LAN, the frame normally contains:

  • Destination IP: the remote website's server
  • Destination MAC: the local gateway
  • Source IP: your computer's IP address
  • Source MAC: your computer's network interface

The Ethernet frame reaches the router, which forwards the IP packet toward the destination.

The link-layer addresses change as the packet travels across different network links.

The destination IP normally remains the remote endpoint, although mechanisms such as NAT can modify IP addresses along the path.

That's the distinction that made IP addressing and MAC addressing much easier for me to understand.

4. TCP, TLS and HTTP handle different jobs

Once the network can reach the destination, other protocols become involved.

For a typical HTTPS connection using HTTP/1.1 or HTTP/2:

  1. TCP establishes a connection.
  2. TLS establishes a secure communication channel.
  3. The browser sends an HTTP request.
  4. The server returns an HTTP response.

HTTP/3 works differently because it uses QUIC over UDP rather than TCP.

The important point is that these protocols aren't competing to do the same job.

They work together at different stages of communication.

5. Try checking your own Linux system

These commands can help you examine some of the concepts:

# Show network interfaces and addresses
ip -br addr

# Check the route to an external IP
ip route get 1.1.1.1

# Resolve a domain name to IPv4 addresses
getent ahostsv4 example.com

# Examine known neighbors
ip neigh show

# Request HTTP response headers
curl -I https://example.com
Enter fullscreen mode Exit fullscreen mode

These aren't a full packet capture, but they provide a useful starting point for understanding your network configuration and testing connectivity.

Try running them and examining the results rather than just copying the commands.

Why I'm documenting these topics

I'm currently studying cybersecurity and preparing for the eJPT certification.

While studying Linux, networking and penetration testing, I've been putting together a public GitHub repository called Cybersecurity Survival Notes.

It contains notes, explanations and command examples covering:

  • Linux architecture, permissions, networking and system commands
  • Networking fundamentals, TCP/IP, DNS, DHCP, ARP and network communication
  • Nmap, including host discovery, port scanning and service detection
  • Information Gathering and reconnaissance
  • Cybersecurity fundamentals

I'm still reviewing and expanding the material as I learn.

The idea is to keep a reference I can return to when working on labs, instead of having to search for the same explanations every time.

I've also built a website to make the Markdown notes easier to browse.

GitHub: https://github.com/Radz-04/Cybersecurity-survival-notes

Website: https://radz-04.github.io/Cybersecurity-survival-notes/

Everything is free and open source.

If you're learning cybersecurity too, feel free to explore the repository. And if you find it useful, consider giving it a star on GitHub.

I'd also appreciate feedback, especially if you notice technical mistakes or explanations that could be clearer.

What networking concept took you the longest to understand?

Top comments (0)