An IP address is a source or destination (one or multiple) assigned to every device that connects to the internet, which can be a unique address or not. However, devices that aren't actively online can also have an assigned IP address.

This applies to computers, tablets, and phones—plus IoT devices, TVs, home appliances, and even some toys. IP addresses are generated mathematically (not randomly) and allocated using a process now overseen by the Internet Assigned Numbers Authority (IANA).

How do IP addresses work?

An IP address allows a client to locate and retrieve the resources it's trying to access, while giving servers a destination to send data back to. IP addresses are also used for the following: 

  • Identifying a host or network

  • Determining a device's geographical location (in conjunction with other pinpointing services)

  • Allowlisting and denylisting

IP addresses come in two different formats depending on the protocol in question. At first, the IPv4 protocol outlined a standard 32-bit numerical format for IP addresses (for example, 192.168.0.1). Each set of numbers in an IPv4 address ranges from 0 to 255 and are separated by decimal points. This allows for 4.3 billion unique IPv4 addresses. 

However, IP addresses are finite. It became clear that we'd exhaust the availability of IPv4 addresses as more and more devices came online. These limitations led to the creation of the IPv6 standard. Compared to IPv4, the IPv6 standard uses an expanded, 128-bit hexadecimal format ranging from 0000:0000:0000:0000:0000:0000:0000:0000 to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. This new format allows for a staggering 340 trillion IPv6 addresses—enough to last us for the foreseeable future.

Types of IP addresses

Protocols aside, there are four distinct types of IP addresses that impact how (and which) devices connect to various networks: 

  1. Public – These IP addresses are external-facing and assigned to personal devices that connect to home (or business) networks and internet service providers (ISPs). While a device is typically assigned a private IP address, it's later given a public IP address when routed through the router. However, this public IP address isn't needed for devices that communicate on the same network. These addresses enable users to communicate and browse the web, or designate open ports for gaming, streaming, and other services. 

  2. Private – These IP addresses are internal-facing and assigned to devices via a home network (local area network) or office network. These private IP addresses are linked to public addresses. A central router enables communication outside of the local network (but not internally between devices) while often governing IP address reuse with built-in DHCP servers.

  3. Static – These IP addresses are manually configured and strictly tied to a device. Static IPs don't automatically change like dynamic IPs do and remain with a device from one session to the next. 

  4. Dynamic – These unique IP addresses are assigned each time a device connects to the network, meaning a device's IP will often (but not always) differ from one session to the next. The network maintains a pool of available IPs to choose from, which are assigned using the Dynamic Host Configuration Protocol (DHCP). However, the DHCP server can hold an IP address it has previously issued to a client Media Access Control (MAC) address and assign it again to that device, depending on your server settings. MAC randomization common to many devices will impact ongoing mapping between IP addresses and MAC addresses.

Are all IP addresses the same?

While many IP addresses are freely assigned, others are reserved for specific functions across the internet. IANA often reserves the following IPs for networks that leverage TCP/IP to fulfill specific purposes: 

  • 0.0.0.0 is a non-routable address that denotes the default network, while also telling servers to listen for and accept any connections from all devices (and thus all IPs)

  • 127.0.0.1 is a loopback address that machines use to identify themselves, even without a pre-existing IP address. 

  • 169.254.0.1 through 169.254.254.254 is an IP range reserved for devices that cannot otherwise receive an IP address automatically from the DHCP. Also called "link-local" addresses, IPs in this range to avoid conflicts with IP address assignments from temporarily unavailable DHCP servers and enable zero-configuration communication.

  • 255.255.255.255 is used to broadcast messages across computers on a shared network. 

Different IP address ranges are also divided into unique subnet "classes" which smaller networks use to connect to larger networks (using a router). Some IP classes, such as Class E, are reserved for experimental use by the Internet Engineering Task Force (IETF). These uses included research and testing. Class E addresses are hidden from the public internet, and while authorities considered opening them up to the public, this hasn't yet happened.

Finally, IP addresses are vital to the Domain Name System (DNS), which converts domain names into IP addresses—making them reachable while enabling communication between browsers, servers, and other resources.

How does HAProxy use IP addresses?

HAProxy products can inspect an IP address and compare it against lists of permitted or prohibited IP addresses—often called allowlists and denylists. We can also mask these IP addresses to protect user privacy. And while a client's source IP isn't the sole determinant of routing behaviors, it does play a minor role in routing requests to the right place. 

This IP-based filtering powers some of our multi-layered security features, such as Global Rate Limiting. To learn more about IP handling in HAProxy, check out our HAProxy frontend documentation or our blog on Using the Proxy Protocol to Preserve a Client's IP Address.