Network Basics: How IP and MAC Addresses Work

Network Basics: How IP and MAC Addresses Work

Both IP addresses and MAC addresses identify devices on a network, but they work slightly differently. MAC addresses are hard-coded into the device, while IP addresses are virtual addresses.

Let's say you want to visit a website. It's easy. Just type in the URL and you're off. It's a simple process that most of us perform multiple times a day. But most people don't realize that there's a lot going on in the background to get us there. For example, the MAC address, IP address, and subnet mask are responsible for making sure you're browsing to the right place. How does it work? What do these different addresses mean? Let's explore how it all works.

What is a MAC address?

A MAC address is the "physical" address of a device. It is hard-coded into a network card by the manufacturer. Represented by a 12-digit hexadecimal number, every device in the world has a unique MAC address. While most people don't remember or care about MAC addresses, they work in the background to identify devices on a network.

What is an IP address?

An IP address is a virtual address that changes depending on the network the device is connected to or even when you restart your computer. Years ago, computers kept the same IP address, but now IP addresses are usually assigned dynamically. Some websites always have the same IP address, which is called a static IP address.

We can think of it as the street address where you live for receiving mail, but IP addresses can change over time.

What is a subnet mask?

A subnet mask works like a filter, helping determine which part of an IP address identifies a network and which part identifies a device on that network. Every IPv4 address has a network portion and a host portion. These portions are defined by the subnet mask assigned to the address.

The common subnet mask 255.255.255.0 tells us that the first three octets of the address represent the network portion and the last octet represents the host portion of the address. With an address of 192.158.3.4 and a mask of 255.25.255.0, 192.168.3.0 is the network and the last octet, 0.4, is the host on that network.

How MAC Addresses, IP Addresses, and Subnet Masks Work Together

Let's say there is a house with a router. The router connects all your devices to the internet. We will have a subnet that starts with 192.168.1. It is the default subnet on most residential routers. Therefore, each device has an IP address that starts with these three octets and ends with a unique number.

The following are examples of devices on a subnet:

  • Computer 1: 192.168.1.5
  • Computer 2: 192.168.1.6
  • Xbox: 192.168.1.7
  • iPhone: 192.168.1.8

Notice that every device on the network starts with 192.168.1, and then the router assigns each device a unique number at the end.

When we tell a computer to communicate with another device, the computer says "Hi, router. I'm 192.168.1.5, and I'm trying to contact 192.168.1.6. It's on this network."

The router will have an internal table called the ARP cache. This table holds a mapping of IP addresses to physical MAC addresses. If the IP address trying to talk is listed in the table, the router will immediately forward the traffic to the destination.

If the router does not know the MAC address, it asks all devices on the network. This is called broadcasting an ARP message.

The router says, "Hello, network. Who is 192.168.1.6?"

The second computer says, "Oh, that's me, here's my MAC address."

Once the exchange is complete, the router stores the new IP to MAC address relationship in its ARP cache for later use.

This is how a Local Area Network (LAN) uses IP and MAC addresses, and understanding these simple mechanisms is essential, even if you are setting up a home network. It is worth noting that setting up a network for a business or large organization can be much more complex.

Summarize

Understanding how MAC addresses, IP addresses, and subnets work together is fundamental to understanding how networks work. While most residential customers may only need to understand the basics, if you are seeking a career in IT, you will need to go a little deeper.

<<:  Technology trends 2024: The impact of AI, 5G, IoT and blockchain

>>:  What are the most common types of communications antennas?

Blog    

Recommend

Exploring cross-industry collaboration between 5G and edge computing

The combination of 5G networks and edge computing...

Talk about what you want to know and don't know about SDN

SDN has been very popular for a while. For a whil...

How far is 400G from true commercial deployment?

With the continuous growth of data traffic, the d...

Spiderpool: How to solve the problem of zombie IP recycling

In the Underlay network, how to recycle zombie IP...

What should you do if you forget the wireless router backend login address?

If you want to modify the configuration of the wi...

How to find the causes of various network failures?

Network outages, freezes, unstable connections, a...

Good news! 5G is so important, China Mobile has made a great contribution

When it comes to 5G networks, everyone should be ...

“Transparent” Ruijie gives people a sense of security

This is a very "pure" partner conferenc...

Whether to upgrade WiFi 6 routers depends on the consumer's own situation

Nowadays, remote home office and classes have bec...

Double your O&M efficiency! What you need to know about the Ansible Copy module

In automated operation and maintenance, file dist...