Last Updated 25 Jul 2024
|

What Is an IP Address and How Does It Work? The Complete Breakdown

Quick Summary ↪ This article explains IP addresses, their types and versions, how to obtain one, and their significance in web browsing and site management. Read on to understand how IP addresses can enhance your troubleshooting skills and deepen your knowledge of how the internet works.

what is ip address

If you have been on the internet long enough, there is a good chance that you might have come across IP addresses in one form or another.

Every device has an IP address and needs it to be able to communicate with other devices over a network, including the internet.

What if we told you that you are here because of an IP address? Even though you may not have typed one, you are reading this blog post thanks to one.

IP addresses are everywhere and nothing on the internet would function without them.

That’s what this post is about.

By the end of this article, you will know everything you need to know about IP addresses.

We’ll cover what IP addresses are, how they work, how to get one, how DNS and ARP works and a lot more.

We’ll also cover how IP addresses are relevant to websites.

If you were looking for a grounding in IP addressing, you’re in the right place!

What Is an IP Address?

So let’s start at the very beginning. What is an IP address?

An IP address is a numerical address given to devices on the internet or local network. They enable different devices within a network to identify and communicate with one another.

Think of them as your phone number and you don’t be far wrong.

Your friends need your number so they can call or WhatsApp you. It’s a similar thing for networks.

Computers and other devices use IP addresses in the same way we use phone numbers to communicate with each other.

Any networked device needs an IP address to be able to send and receive traffic.

Every phone, computer, laptop, tablet, internet-enabled refrigerator and any other device requires one.

That’s why they are so important.

IP addresses are usually strings of numbers, broken up into 4 lots of 3, like 172.217.14.206. This is a Google IP address.

We say ‘usually strings of numbers’ because addressing is changing. We’ll get to that later.

The full IP address range goes from 0.0.0.0 to 255.255.255.255.

It ends at 255 because that’s the maximum number in an octet, which is how 32-bit addressing works.

As there are four sets of numbers, which are octets (8 bits of information), 4 x 8 = 32.

Don’t worry about that part, we just include that for completeness.

What Does IP Addressing Have to Do With Running WordPress Websites?

WordFence WordPress firewall

Learning about IP addresses is fascinating, but how does this relate to running a WordPress website?

There are two situations where knowing IP addresses can be useful, analytics and defense.

Analytics and IP Addresses

If you run an online store or want to track where people visit your website from, IP addresses play a key role.

Analytics tools will capture the IP address and identify where in the world those IP addresses are used to provide that data.

Without them, you wouldn’t know where people were coming from and wouldn’t be able to identify their location or your key markets.

Website Defense and IP Addresses

The other way a website owner utilizes IP addresses is if you use a firewall.

Many WordPress firewalls include blacklists and whitelists. Both depend on IP addresses to work.

A blacklist is a list of IP addresses that are blocked from accessing your website. A whitelist is a list of trusted IP addresses.

A WordPress firewall access reviews all permissions and tracks IP addresses that try to access your website. If it identifies suspicious activity, it will block that IP address from accessing your site.

Conversely, you can manually add your own IP address to the whitelist to ensure you are always able to access it.

Two simple, but fundamental ways IP addresses are used within the average WordPress website!

The Anatomy of an IP Address

IP address network and host element

An IP address is split into two halves. The first half is the network ID and the second half is the host ID.

So, in our Google example above, the 172.217 part is the network ID and the 14.206 part is the host ID.

The network ID identifies the network the IP address is assigned to. For example, your ISP, your company or your home network.

The host ID identifies the device. It’s a pool of numbers that can be allocated to devices within that network. For example, your laptop, phone, PS5 or Xbox.

Types of IP Addresses

There are two main types of IP addresses that we think you should know, dynamic and static.

Dynamic IP Addresses

A dynamic IP address is a type of IP address that can change frequently.

Dynamic IP addresses are provided by your ISP or by your router. ISPs buy IP addresses in bulk and distribute them automatically to customers.

As ISPs typically have thousands of customers connecting and disconnecting all the time, they create IP address pools.

All IP addresses owned by the ISP are put into a pool and a customer router will request one periodically or when it reboots.

The ISP router will allocate a dynamic IP address and map it so your router can connect to the internet.

The address will then refresh periodically depending on the time set by your ISP.

The idea is to ensure all IP addresses owned by the ISP are utilized and that no customer will ever be left without connectivity.

Static IP Addresses

A static IP address is the type of IP address that remains the same over a period of time, or static.

These can be assigned by ISPs or your own router. Once assigned, your router keeps the static IP address for the entire period you’re a customer.

Static IP addresses are necessary if you manage your own web server instead of using a hosting company.

In such a case, a static IP address prevents DNS confusion.

We’ll get to DNS later.

IP Address Versions

IP addresses in Windows CMD

As well as different types, there are two versions of IP address – IPv4 and IPv6.

IPv4

IPv4 stands for Internet Protocol Version 4. This is the most popular type of IP address present today and has been around since the beginning.

The IPv4 address is represented by a dot-decimal notation. It means that the address is 4 parts separated by a period.

The address we used as an example above is an IPv4 address – 172.217.14.206.

IPv4 uses a 32-bit address space. This means that there can be ‘only’ 232(4,294,967,296) unique addresses.

That’s 4.3 billion, give or take a few.

That number might seem huge, but with the rapid expansion of the internet and connected devices, we are running out of addresses.

This is referred to as ‘IPv4 address exhaustion’ and describes a shortage of unique IPv4 addresses.

As more and more devices come online, the 4.3 billion addresses allowed by IPv4 are rapidly dwindling.

Which has led to the development of IPv6.

IPv6

IPv6 stands for Internet Protocol Version 6.

In IPv6, we use a 128-bit address space, which means we can have 2128 (approximately 3.403×1038) IP addresses.

That’s 340 trillion trillion trillion IP addresses!

As opposed to the numerical digits in IPv4, in IPv6, we use alphanumeric, both letters and numbers, separated by colons instead of periods.

A good example is a Google IPv6 address – 2607:f8b0:4003:c00::6a.

The new alphanumeric system allows for many times more IP addresses in the foreseeable future.

As the IoT, Internet of Things becomes more common, we’re going to need all those addresses!

IP Address Summary

So a quick summary of IP addresses:

  • Every networked device needs an IP address to be able to send and receive data
  • An IPv4 address is made up of two parts, network ID and host ID
  • IPv4 is the current system but is running out of addresses
  • IPv6 looks more complicated but offers many more addresses
  • IPv4 is capable of 4.3 billion addresses
  • IPv6 is capable of 340 trillion trillion trillion IP addresses

How Do You Get an IP Address?

So you have an idea of what IP addresses are, but how do you get one?

There are two main types of IP address, network level addresses and local addresses.

  • Your ISP will assign a network level address to your broadband connection
  • Your network provider will assign your phone a network level address for 4G or 5G use
  • Your router will assign a local address to every device on your network

So, to break it down:

  • Your ISP will provide an IP address to your broadband router so it can communicate with the internet
  • Your router will assign an IP address to devices within your network so they can use the internet or talk to each other

For example, your ISP assigns the IP address 166.166.166.156 to your router. This allows your router to use the ISP network to access the internet.

In turn, your router could assign your desktop computer an IP address of 192.168.222.111.

The 192.168… address is a common internal network address used across the world.

If, for example, you have an Xbox or PS5, your router could assign it an IP address of 192.168.222.112 and any other devices .113, .114 and so on.

Internal network addresses are controlled by your router and the host part, the second half, can be any set of 3 numbers you like.

So how does a device with an IP address of 192.168.222.111 use the internet if your ISP thinks you have an address of 166.166.166.156?

It uses network address translation, NAT.

Network Address Translation

Network Address Translation, or NAT, is a feature of most modern routers. It enables the router to keep the IP address provided by your ISP separate from the internal one the router provides to your network.

It uses a simple table to map what IP address is used by what device on your network, called an ARP table or ARP cache.

We’ll get to ARP in a minute.

NAT works like this:

  1. You open a browser on your desktop and opens a web page
  2. Your router automatically switches the 162.168 address it assigned your desktop with the network address provided by your ISP
  3. Once the router receives the website data, it switches the IP address back to your local address and sends it to your desktop

This happens for every packet of data you send over the internet!

Now let’s explain ARP tables or the ARP cache.

Routers and ARP Caching

ARP cache and ARP tables

Most routers will have an ARP cache or ARP table. Computers use ARP caches too, but we’re more concerned with routers right now.

The ARP cache is a database that maps IP addresses to MAC addresses and then to router ports.

What, what? MAC address?

IP addresses are not unique. Every router in the world could assign the same local network IP address to a computer, which could be very confusing!

IP addresses can also be dynamic, meaning they can be changed at any time, for any reason.

The Internet Protocol overcomes that by using MAC addresses for routing traffic.

A MAC address, Media Access Control Address, is a truly unique identifier.

A MAC address looks like this – 2C:F0:5D:98:45:0C. Like the one bordered in red in the image below.

MAC address screen for Windows

Every single network card or chip (for phones and tablets) in the world has a completely unique MAC address. It’s also called a ‘burned in’ address as it is programmed at the factory and cannot be changed.

A router uses ARP (Address Resolution Protocol) to detect the MAC address of every network card or chip connected to and creates a database called the ARP table or cache.

That database will map a particular MAC address to an IP address so it knows where to send traffic.

If the device uses a wired connection, the router will also record the port number it is connected to.

A port is the physical Ethernet port on the router. If you check yours, you’ll see they are all numbered. This is the port number.

Routers use port numbers to help send traffic to the right device without sending it to every other device too.

An ARP cache would look a little something like this:

‘Desktop0 = 2C:F0:5D:98:45:0C = Port0 = 192.168.222.111.

It doesn’t technically look like that, but you get the idea.

The router maintains the table so it knows any network traffic from 192.168.222.111 comes from the device that has a network device with a MAC of 00:00:5e:00:53:af.

The router also knows any internet traffic destined for Desktop0 should be sent only through port0 rather than anywhere else.

Still with us?

Here’s a breakdown of how it all works:

  1. Your ISP assigns a network IP address to your broadband router
  2. Your router detects what devices are connected to it and assigns each a local IP address
  3. The router builds the ARP cache that maps IP addresses to unique MAC addresses and ports
  4. When you access the internet from a device, the router switches your local IP address with its network address using Network Address Translation so you can use your broadband
  5. When it receives traffic, the router switches the IP address back and forwards it to your device using the port it has mapped
  6. All this happens in milliseconds so you never really know anything about it

ARP caching is an IPv4 function. When IPv6 finally takes over, it will use NDP, Neighbor Discovery Protocol. It works in much the same way though.

How Does All This Work in Practice?

So that’s all the theory, how does it all work in real life?

Let’s use an example of how a router learns what’s on its network:

  1. You turn on your router with broadband connected. The router sends a ping to your ISP to announce it is available
  2. The ISP verifies the connection, checks you’re a paying customer and allocates an IP address so you can use the internet
  3. The router verifies that it can use that IP address
  4. The router then sends a broadcast message through every port that says something like ‘Hello, is anyone there. If so, send me your MAC address so we can chat’.
  5. Every device on the network hears the message and replies ‘Hey there! I’m Desktop0 and my MAC address is 2C:F0:5D:98:45:0C. Let’s connect!’
  6. The router enters the MAC address and port it is connected to into the ARP table. It also checks what IP addresses are available and allocates one
  7. Each device can now access the internet through the router

Yes, it is kind of complicated but most of this happens behind the scenes. Your router and ISP will take care of most of these tasks without you ever knowing about it.

Summary of How You Get an IP Address

Here’s quick summary of how IP addresses are assigned:

  • Network level addresses are assigned by your ISP
  • Local IP addresses are assigned by your router
  • Your router maps local IP addresses to a router port (for wired connections) and devices using the ARP cache
  • The ARP cache maps the MAC address of your network card to your assigned IP address
  • The router uses Network Address Translation to change the local IP address to its own IP address so it can send and receive traffic over the internet
  • The router then translates traffic back to local IP addresses and forwards it to your device

IP Addressing and Web Browsing

Accessing google using IP Address

As you now know, devices use MAC addresses and IP addresses to communicate with each other.

So why don’t we type IP addresses into our web browser to visit a website?

You could if you wanted to, but can you imagine remembering dozens of IP addresses just to visit your favorite sites?

We can’t either, which is why DNS was invented.

Domain names were introduced to be memorable. They could be bought and sold, branded and increasingly complicated domain names invented.

But at the end of the day, servers use IP addresses to communicate.

So how does your browser know that typing www.google.com into the URL bar means it needs to go to the web server at 172.217.14.206?

Using DNS.

Every domain name is linked with a specific IP address.

DNS and IP Addressing

DNS and IP Addressing

This linking is done through the Domain Name System (DNS). DNS is like an address book for domain names.

Think of it as a huge ARP cache containing millions of domains and their IP addresses.

For example, a website at www.amazingwebsitename.com could have a web server IP address of 62.62.621.621

So the DNS record could look like this:

www.amazingwebsitename.com = 62.62.621.621

It won’t look exactly like this, but that’s how it works.

There are two types of DNS server, authoritative DNS and recursive DNS.

Authoritative DNS Server

Authoritative DNS servers are central servers owned by large internet companies like Google, Cloudflare and others.

They are substantial servers that maintain accurate DNS records for millions of websites.

Recursive DNS Server

A recursive DNS server is usually owned by your ISP. It will maintain thousands, perhaps millions of records of its own.

It will query the authoritative DNS server if it cannot find what it’s looking for.

DNS, IP Addresses and Web Browsing

DNS, IP Addresses and Web Browsing

When you try to access a website, you type the domain name in the URL bar.

Your router queriesDNS to look up the IP address for the web server that hosts the website.

  1. If your ISP’s DNS has the record, it returns the web server IP address to your browser.
  2. Your browser then requests to visit that IP address. Your router looks up the address, sees it isn’t connected and queries your ISP router.
  3. That router checks to see if that IP address is connected. If it is, it connects you.
  4. If it isn’t, it queries a core router deep in the internet to see where that IP address is located.
  5. The core router knows where that IP address is and sends the message all the way back to your router.
  6. Your router passes on that information and your browser goes directly to the web server hosting of that website.

The website loads and everyone is happy.

If your ISP’s DNS doesn’t have the record, it will query its closest authoritative DNS server for it.

If that server has it, your ISP server tells your browser and keeps its own copy of that record to save effort next time.

Usually, there are only one or two DNS queries, but occasionally, the closest authoritative server will need to consult another authoritative server.

This would, in theory, continue until one of them could find the entry!

All this happens in seconds and would go unnoticed by the majority of web users.

As you can see, there are two different queries happening here.

One, the DNS lookup where your router tries to find the IP address of the domain name you typed.

Two, the IP address lookup where your router via your ISP and core routers, try to identify where in the world the web server for that domain is located.

All this happens within a second or two, despite the distances often being thousands of miles.

Summary of IP Addressing and Web Browsing

Here’s a quick summary of IP addressing and web browsing:

  • Even though servers use MAC and IP addresses, humans like domain names
  • DNS (Domain Name System) maps domain names to the IP address of the web server hosting the website
  • Every time you enter a domain name into your browser, it, via your router, queries DNS to find out where to go
  • Your ISP will have a recursive DNS server with lots of addresses mapped
  • Companies like Google and Cloudflare operate large authoritative DNS servers
  • Queries are made behind the scenes and are invisible to users
  • Once your router has the web server IP address, it has to send another query to try to locate it
  • That query will be sent up the chain to the web’s core routers until someone knows where that server is
  • Once located, your router will send all traffic to that web server to load the page you requested

Final Thoughts

IP addressing is a huge, and often complicated, subject. Yet It’s crucial to how we use the internet and manage websites.

While you don’t need to understand how IP addresses work, the more informed you are, the more able you are to troubleshoot problems and amaze your friends with your knowledge!

Plus, if you’re managing websites, it’s always useful to know how visitors actually arrive on your site, isn’t it?

Did we cover IP addressing in enough depth? Do you have any questions? Share your thoughts in the comments below!

Article by
Pratik Chaskar
LinkedInTwitter

Pratik Chaskar holds the pivotal role of CTO at Brainstorm Force, serving as the backbone of the company. Renowned for his organizational skills, strategic thinking, problem-solving attitude, and expertise in leading and executing plans, Pratik plays a crucial role in the BSF’s technological landscape.

Disclosure: This blog may contain affiliate links. If you make a purchase through one of these links, we may receive a small commission. Read disclosure. Rest assured that we only recommend products that we have personally used and believe will add value to our readers. Thanks for your support!

Leave a Comment

Your email address will not be published. Required fields are marked *

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Membership Retention Checklist Download

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top