Domains and IP Addresses: A Guide to Their Relationship

It's not always one domain, one IP address. Learn how IPv4 scarcity, web servers, and services like Cloudflare enable many websites to live at the same digital address.

Last updated: July 7, 2025

https://unsplash.com/@nataliablauth

Image by https://unsplash.com/@nataliablauth

Introduction

At its core, the Domain Name System (DNS) acts as the internet's phonebook, translating human-friendly domain names (like example.com) into computer-friendly IP addresses (like 127.0.0.1).

For a long time, it was common to think of this as a one-to-one relationship: one domain points to one unique IP address. But if you've ever used a shared web hosting service or investigated a domain, you've likely discovered that many, many domains can share the exact same IP address.

How can hundreds of different websites all use the same IP address? Let's explore.

The Simple Case: One Phone Number, One Person

Imagine a newly formed IT support company. In the beginning, the owner is the only employee and gets a phone number. When you call that number, you know you are going to get the owner every time.

This is the simplest domain-to-IP relationship. A single domain, let's say example.com, points to a single IP address where its website is hosted. This is common for sites that have a dedicated server.

example.com127.0.0.1

Simple, right? But the modern internet needs to be much more efficient, driven by a fundamental problem: scarcity.

Why Share IPs? A Tale of Scarcity and Exhaustion of IPv4

The "many domains, one IP" model wasn't just invented for convenience; it was born out of necessity. The original internet addressing system, IPv4, has a limited supply of about 4.3 billion unique addresses. In the early days, that seemed like an enormous number. Today, with billions of people and countless devices online, we have effectively run out of new IPv4 addresses to give out. (Note: there's more to it than this, which will be covered in a different post.)

Imagine if the world started running out of unique phone numbers. You couldn't just give one to every single person or business anymore. This scarcity made it impractical and expensive for every website to have its own dedicated IPv4 address.

The solution was virtual hosting, which allows one IP address serve many websites, making web hosting affordable and conserving the supply of IPv4 addresses.

The long-term fix is the transition to IPv6, a newer system with a mind-bogglingly vast number of addresses (roughly 340 trillion, trillion, trillion). As the world slowly adopts IPv6, the technical need to share addresses diminishes. However, the economic and operational benefits of shared infrastructure mean the "many-to-one" model is here to stay.

The Modern Reality: One Phone Number, Lots of People

Now, instead of a single-person IT shop, picture a 100-person call center. The entire call center has just one public phone number, but it serves 100 different support agents, each at their own extension.

This is how much of the modern web works. A single, powerful server or set of servers can have one public IP address but host hundreds or even thousands of different websites. This is the "many-to-one" relationship.

But if your web browser only knows the main phone number (the IP address), how does it know which "extension" (which website) you want to visit?

How It Works: The Web Server as a Switchboard

When your browser connects to a server, it sends a request that includes a crucial piece of information called a Host header. This header tells the server which domain name you're trying to reach.

Think of it like calling into that call center. You don't just get connected to a random person; an automated system or a receptionist asks what you're calling about (e.g., "Press 1 for billing, Press 2 for technical support").

The web server software (like Apache, Nginx, or Caddy) acts as that phone number's switchboard. It looks at your browser's request for the Host header (e.g., Host: www.example.com) and serves up the correct files for that specific site. If another request comes in for www.second-example.com to the same IP address, the web server looks at its Host header and serves up the corresponding files for that website instead.

This process, virtual hosting, is the core technology that allows web hosting companies to efficiently serve countless websites from shared infrastructure.

Scaling Up: Load Balancers and Reverse Proxies

What if the 100-person call center is now a 24/7 operation with 500 people distributed worldwide, still managed under one phone number?

This is where load balancers come in. A load balancer is a server that sits in front of a whole fleet of other servers. It might have a single public IP address, but its job is to act as a traffic cop. When a request for example.com arrives, the load balancer intelligently forwards it to one of many backend servers that can handle it, based on traffic levels, server health, or other rules.

The Cloudflare Effect: Reverse Proxies on a Global Scale

Services like Cloudflare take this concept to another level. They act as a reverse proxy, which is a server that sits between you and the website's actual server (the "origin server").

When a website uses Cloudflare, its DNS A record doesn't point to its own server's IP, but to a Cloudflare IP address. Your request goes to Cloudflare's massive global network first. Cloudflare can then:

  • Enhance security by filtering out traffic before it ever reaches the website's server.
  • Improve performance by serving a cached copy of the website from a server physically close to you (this is a Content Delivery Network or CDN).
  • Provide load balancing by forwarding the request to the actual origin server only when necessary.

This keeps the website's true IP address hidden from the public and adds layers of performance and security. It's the ultimate evolution of the "many-to-one" principle, where a single Cloudflare IP might be the entry point for thousands of unrelated domains.

Cloudflare is not the only service offering this, but it is the largest and most common example.

This is a key question for anyone investigating domains. The answer is: it depends.

  • Often, No Relation: On a massive shared hosting provider or behind a Cloudflare IP, your personal blog could share an address with a local plumber's website and a fan fiction archive. They have no relationship other than using the same shared infrastructure.

  • Sometimes, a Strong Relation: An organization might host all its different brand websites (brand-a.com, brand-b.com) on the same dedicated server or load balancer (that isn't part of a massive public cloud). Finding them on the same non-CDN IP is a strong indicator they are owned by the same entity.

  • For Malicious Actors, Almost Always: Threat actors often use the same cheap Virtual Private Server (VPS) or compromised server to host multiple malicious domains. Finding one phishing site and then using a reverse IP lookup to find ten other suspicious-looking domains on the same IP is a classic and highly effective investigative technique.

Conclusion

The relationship between a domain and an IP address is far more flexible than a simple one-to-one mapping. Driven by the necessity of IPv4 address conservation and the economic benefits of shared infrastructure, the "many-to-one" model is the standard for the modern web. Understanding how technologies like virtual hosting, load balancing, and global reverse proxies like Cloudflare manage this relationship is fundamental to grasping how the web is built and, more importantly, how to investigate its vast, interconnected structure.

Get new posts and updates in your inbox
Connect with me