Go to ipseeker Home

How Networks Transfer Data: Switches, Routers and IP Addresses

Why Should You Care How Data Travels?

Every time you visit a website, stream a video, or send a message online, your data goes on a journey — quietly, behind the scenes, in just milliseconds. But that journey involves a lot more than just “connecting to Wi-Fi” or “having internet.”

It starts with your device (called a client) and ends in a remote device (called a server) — like a website you want to visit. But between these two points, there’s a complex process of lookups, decisions, routing, switching, and translations that make the whole thing work.

We already explored the basics of the internet’s components — like clients, servers, switches, routers, and cables — in our article Internet Infrastructure Components: The Basics.

We also laid the foundation in Foundations of LAN & WAN and Foundations of Subnetting — both essential for understanding what comes next.

Now it’s time to connect the dots and dive deeper into how it all works together in real time.

Why This Matters

Understanding how data flows across a network isn’t just for IT professionals. Once you learn what’s supposed to happen when you open a website or send a file, you’ll start to recognize what’s normal — and what’s suspicious.

This is crucial if you care about:

Once you understand how data legitimately flows, you'll see how hackers often try to exploit that very process — and what you can do to protect yourself. This is your first step toward becoming a more informed and secure internet user.

Getting Ready: What Must Happen Before You Can Browse the Web

Before any website loads, before any message is sent, your device needs something essential — a proper network configuration. Whether you're accessing Netflix, sending files to your home printer, or logging into a company wiki or ticketing system, your device must be configured correctly to start the journey.

There are four must-have pieces of information that every device needs to connect to a network — whether it's a personal laptop, a corporate server, personal mobile, tablet, camera or even your car.

1. IP Address

This is your device’s unique identity on the network. It must fall within the correct range based on how the network is designed.

You can get this:

2. Subnet Mask

This defines which part of the IP address belongs to the network, and which part is available for your specific device (the client).

It tells your device, “Hey, here’s who’s local and who’s not.” Most home networks use /24 subnet mask: 255.255.255.0

3. Default Gateway

This is your door to the outside world — usually the IP address of your home router or the corporate router. Any network communication your device wants to send outside the local area network (LAN) is sent to the default gateway, which knows how to reach beyond the local network.

4. DNS Server

DNS (Domain Name System) is like your internet's phonebook. When you type in your browser www.netflix.com, your device asks the DNS server, “What’s the IP address of this domain?” Then it uses the result to connect.

You can use:

These four settings can be:

Hands-On Practice: Check Your Network Settings on Windows

There are two easy ways to view your network configuration on a Windows device: using the Command Prompt or the Graphical User Interface (UI) — which is just the menu system you click through (instead of typing commands).

Option 1: Use the Command Prompt

  1. Press Windows + R, type cmd, and hit Enter.
  2. In the black terminal window that opens, type the following and hit Enter: ipconfig /all
  3. You’ll see detailed information about all your network interfaces:
    • IPv4 Address – your current IP
    • Subnet Mask - your current subnet mask
    • Default Gateway - your current default gateway
    • DNS Servers - your current DNS servers

This is the fastest way to get a full status of your current network interface setup.

Option 2: Use the Settings Menu (UI Method)

This method is more visual and beginner-friendly:

  1. Press the Start button and open Settings.
  2. Go to Network & Internet.
  3. Click on either Wi-Fi or Ethernet, depending on your connection.
  4. Select your active connection (usually labeled with your network name).
  5. Click the arrow down icon (▾) next to your network to expand settings.
  6. Scroll down and click Edit under IP Assignment or DNS Server Assignment.
  7. In the pop-up window:
    • Switch the setting to Manual using the dropdown menu.
    • Toggle IPv4 (commonly used) to On.
    • Fill in the required fields:
      • IP address
      • Subnet mask
      • Gateway
      • Preferred DNS

This manual setup is usually only needed for advanced users or specific networks (like corporate environments or static IP configurations).

Hands-On Practice: Check Your Network Settings on macOS or Linux

Just like Windows, macOS and Linux also provide two main ways to view or change your network configuration — through the Terminal (command-line) or the System Settings (UI).

Option 1: Use the Terminal

macOS:

  1. Open Terminal (You can find it via Spotlight: press Cmd + Space and type Terminal).
  2. Type: ifconfig
    or for a simpler IP readout: ipconfig getifaddr en0
    (“en0” is usually the Wi-Fi interface; Ethernet is often “en1”, but run ifconfig to confirm).
  3. To view DNS info, type: scutil --dns

Linux:

  1. Open your Terminal.
  2. Type: ip a or ifconfig
    Note: If ifconfig is not installed, use sudo apt install net-tools first.
  3. To view DNS settings, type:
    cat /etc/resolv.conf

Option 2: Use the Graphical Settings (UI Method)

macOS:

  1. Click the Apple menu → System Settings (or System Preferences on older versions).
  2. Go to Network.
  3. Select your active connection (Wi-Fi or Ethernet).
  4. Click Details… or the small “i” icon.
  5. You’ll find:
    • IP Address
    • Subnet Mask
    • Router (Default Gateway)
    • DNS Servers
  6. To edit these manually:
    • Click Configure IPv4 and choose Manually.
    • Enter your IP, Subnet Mask, and Default Gateway.
    • Under DNS, add or update entries like 8.8.8.8 or 1.1.1.1.

Linux (Ubuntu/GNOME example):

  1. Click on the network icon in the top-right corner.
  2. Select Settings or Network Settings.
  3. Choose the active connection (Wi-Fi or Wired) and click the gear icon.
  4. Under the IPv4 tab:
    • You’ll see your IP Address, Netmask, and Gateway.
    • Switch from Automatic (DHCP) to Manual to input custom values.
  5. Under the DNS section, add servers like:

The Journey Begins: What Happens Once You Visit a Website

Once all four mandatory configurations are in place, your device is officially ready to interact with services across the network — whether that’s within a local area network (LAN) or a wide area network (WAN). From this point forward, we’ll stick with the simpler terms LAN and WAN for clarity.

Let’s walk through a familiar example: visiting wikipedia.org on your phone.

To access wikipedia.org, you need an app that can communicate over the internet — like Chrome browser, which you’ve likely installed yourself. Once you tap the Chrome icon, the app launches. If your homepage is set to wikipedia.org, the site’s landing page appears almost instantly.

But what’s actually happening behind the scenes to make that possible?

Let’s break it down — step by step.

Once the homepage settings are already configured, the browser — in this case, the Chrome app — knows exactly what to do when it launches. That homepage setting is just a saved website name, or in technical terms, a URL (Uniform Resource Locator). Let’s say it’s set to wikipedia.org.

When you tap the Chrome icon, the browser opens and starts loading your homepage. But what does “loading” really mean?

The browser begins by filling in the saved website address — wikipedia.org. However, here’s the catch: the internet doesn’t work based on names. It runs on IP addresses.

So how does your browser turn a name like wikipedia.org into something the internet can understand?

That’s where DNS (Domain Name System) comes in.

Step 1: DNS Resolution — Turning Names into Numbers

The browser doesn’t know the IP address of wikipedia.org on its own. Instead, it relies on your phone’s operating system (like iOS on iPhones or Android on other devices) to figure it out.

Here’s what happens:

Now the browser has what it needs: a real IP address. The next step? Start building the request and sending the data toward that server.

Step 2: Is the Destination IP Inside or Outside the LAN?

Once your browser receives the IP address of the destination website (e.g. 192.0.2.123 from the DNS response), your device needs to figure out how to get there.

But here’s the thing — your device isn’t sending that data blindly. It first asks:
“Is this destination IP address part of my local network (LAN), or do I need to send it out through my gateway to reach the broader internet (WAN)?”

This is called a routing decision.

How the Routing Decision Works

Your device compares:

It uses the subnet mask to “mask out” the network part of both IP addresses. If the network parts match, the destination is in the same LAN. If they don’t match, the destination is outside the LAN and the packet must go to the default gateway (usually your home router).

Quick Example:

Your device calculates:

Conclusion: “This is not on my LAN. I’ll send it to my default gateway.”

What Is the Default Gateway?

The default gateway is usually your router — it’s like the front door of your home network.

If a packet isn’t meant for a device inside your LAN, it must go out through this door to the WAN.

Your device forwards the request to your default gateway (e.g. 192.168.1.1), which takes over the job of delivering it to the destination server.

Every time your device needs to reach a resource outside of your LAN, the request is sent to the default gateway, which handles the routing decision. Likewise, any responses from outside come back through the same gateway to your device.

Step 3: Building the Digital Envelope (The Request)

Now that the routing logic is clear — your device knows the destination IP is outside the LAN, and the default gateway will forward the request — it’s time for the browser to prepare the actual request that will be sent through the network.

Think of it like mailing a letter: you’ve figured out who you’re writing to and which post office (your router) will deliver it. Now you need to pack the message in an envelope with all the right labels.

The browser builds this digital “envelope” — technically called a packet — containing the essential information to complete the request:

What’s Inside the Packet?

  1. Client Identification (Source IP Address):
    Your device’s own IP — for example, 192.168.1.20 — assigned by your network. This tells the destination server where to send the reply.
  2. Server Identification (Destination IP Address):
    The IP of the server you’re trying to reach, resolved earlier via DNS — for example, 192.0.2.123, which belongs to wikipedia.org.
  3. The Actual Request (Webpage Path):
    Inside the packet is the content of your request — like asking:
    GET / HTTP/1.1
    This line tells the server, “Please send me the homepage of your site.”
    It also includes headers like:
    Host: wikipedia.org
    This makes sure the server knows which website (and page) you're trying to load — even if it serves many.

Once everything is in place, the browser is ready to send the packet!

Step 4: Inside the LAN — How the Packet Reaches the Router

So now the packet is ready — it's packed with the destination IP address, your device’s IP, and a request for the Wikipedia homepage. Next, the device must send it out through the network. But how does it actually get from your phone to the router? Let’s break it down.

Wi-Fi = Access Point | Wired = Switch

Depending on your setup, this next step looks slightly different:

While they work differently under the hood (wireless vs. wired), their role in this step is the same: Forward your request to the next device on the path — the router.

What Do Access Points and Switches Do?

Both Access Points and Switches are focused on another type of address called MAC addresses - this is not an IP addresses.

They do not care where the final destination is (like wikipedia.org) — they only care about how to forward the packet within the LAN.

They Manage a MAC Address Table:

Access Points and Switches both keep a table called a MAC Address Table (or forwarding table), which maps:

Let’s look at an example from a switch:

MAC Address Port
AA:BB:CC:11:22:33 1
77:88:99:AA:BB:CC 2
Router MAC Address 3

So when your phone sends a packet, the switch or access point looks at the destination MAC address, checks the table, and forwards the packet to the correct port — which in this case belongs to the router (your default gateway).

How Does It Know the Router’s MAC Address?

If your device doesn't already know the router's MAC address, it uses a special protocol called ARP (Address Resolution Protocol) to ask:

“Who has IP address 192.168.1.1? Tell me your MAC!”

Since all ARP requests are sent as broadcasts, every device within the LAN can hear this transmission.

The router replies:

“That's me — here’s my MAC address.”

Now your device can send the packet directly to the router, using:

Wait — Another Address? What’s a MAC Address?!?

That’s right! Every request and response contains both a MAC address and an IP address and they work together:

What Does the Full Packet Look Like?

Now that you understand both IP and MAC addresses, the full digital envelope — called a packet — looks like this:

  1. Client Physical Identification (Source MAC Address): The MAC address of your mobile phone’s network interface card.
  2. Server Physical Identification (Destination MAC Address): If the destination IP is outside your LAN, the destination MAC will be that of your default gateway router.
    If it’s inside your LAN, the destination MAC will be the MAC of that internal device.
    In our example, the MAC address is the default gateway since the IP address is not within our LAN.
  3. Client Logical Identification (Source IP Address): Your device’s own IP — for example, 192.168.1.20 — assigned by your network. This tells the destination server where to send the reply.
  4. Server Logical Identification (Destination IP Address): The IP of the server you’re trying to reach, resolved earlier via DNS — for example, 192.0.2.123, which belongs to wikipedia.org.
  5. The Actual Request (Webpage Path): GET / HTTP/1.1
    Host: wikipedia.org

At this point, the packet is forwarded using your phone’s Wi-Fi antenna through your access point or switch, across the LAN, and it heads to the router — your default gateway — ready to exit the LAN and continue its journey across the WAN.

The journey has officially begun!

Step 5: Out to the World — Routers & ISPs

Now that the packet has reached your home router, it’s time for it to leave your LAN and travel across the internet — through your Internet Service Provider (ISP) and beyond.

But how does your router know where to send it next?

The Router’s Job: Making Routing Decisions

A router is like a traffic controller — it receives packets and decides where they should go next, based on their destination IP address. This decision-making is called routing.

But the router doesn’t know about every server in the world (that would be impossible). Instead, it looks at:

Routers Have a Default Gateway Too

Just like your device uses a default gateway to exit your LAN, your home router also uses a default gateway — your home router is part of your ISP’s infrastructure and they responsible to configure the default gateway.

From there, the packet continues hopping from router to router, moving through:

Each router along the way:

How Do Routers Learn Where to Send Packets?

Routers don’t know the exact location of every server on the internet. Instead, they rely on routing knowledge passed between other routers — like a chain of digital messengers.

There are two ways routers figure out where to send your data:

This dynamic system keeps traffic flowing — even if a cable is down, a router is offline or internet traffic spikes in one region.

ISPs: A Massive Network of Routers

Your ISP is basically a big network of routers — all forwarding data across their own systems and handing it off to other ISPs when necessary.

If you’re trying to reach a server in another country:

All of this happens in milliseconds — and it’s all thanks to routers, default gateways and dynamic routing.

Step 6: At the Server — Handling the Request and Sending Data Back (The Response)

After traveling through multiple routers, networks and possibly even continents — your packet finally reaches its destination - the server. Remember our example: you’re trying to access wikipedia.org.

What Happens When the Packet Arrives?

The server — maybe located in a massive data center — receives your packet and checks what it’s asking for. Inside your digital envelope, it reads:

If everything looks good, the server will process your request — otherwise, the request will be ignored by the server.

The Server’s Response

If everything looks okay (the page exists, the the destination IP is the server IP, etc.), the server prepares a response packet — like a reply letter with the page content. The response includes:

Note: In this example, we didn’t include a NAT (Network Address Translation) device — but in real-world scenarios, NAT is essential. The network 192.168.0.0/16 is a private range and cannot communicate directly over the internet. In practice, your private IP is translated by your router to a public IP before it reaches the internet.

This is the start of your phone receiving the response — piece by piece — until it has everything it needs to display the full website.

Then What?

Now, the response packet begins its return journey, following the reverse path:

In less than a second, your device receives all the packets it needs to assemble the page — and boom — wikipedia.org loads.

Every additional click on any article within wikipedia.org or any other type of web content you access — like Instagram, YouTube, TikTok, LinkedIn or your favorite app — triggers the exact same chain of events, happening again in milliseconds.

Final Thoughts

What feels like “just opening a website” is actually a lightning-fast journey of IP assignments, routing decisions, MAC lookups, DNS resolutions and more — all happening in milliseconds, millions of times a day, all around the world.

By understanding what’s going on behind the scenes, you’re not just learning how the internet works — you’re gaining the tools to troubleshoot network issues, strengthen your digital security and recognize how legitimate processes can be exploited by attackers - something we’ll cover soon.

Every browser click, every message you send, every video you stream — it's all part of this beautifully orchestrated system. And now you understand it.

Key Takeaways