DEV Community

Sakshi
Sakshi

Posted on

IP address

This blog is part of a series and will recommend reading in order.

IP Address

WHAT

An Internet Protocol (IP) address is the unique identifying number assigned to every device connected to the internet.

How does an IP address work?

An IP address functions in an IP network like a postal address. For example, a postal address combines two elements: the address of your area and your house address.

The address of your area is a group address for all houses that belong to a specific area. The house address is the unique address for homes in that area. Here, your area is represented by a PIN code number.

In this example, the network address comprises all hosts that belong to a specific network. The host address is the unique address of a particular host in that network.

IP Addresses are unique. HOW??

It depends on whether the IP address is public or private.

A public IP address is unique globally, which is not the case for private addresses. Private addresses must be unique within the same local network but not at the global level since these addresses cannot be routed on the internet.

Private IP addresses are reserved for use within private networks and are not globally routable over the internet. Multiple devices in different private networks can use the same private IP addresses without conflicts.

Does an IP address belong to devices or routers?

Each device has an IP address. Each router has multiple IP addresses, with one being private for the local network and another for facing the internet.

What happens with the IP address of our device, say a phone, when connected to Wifi?

Your phone will be assigned a local IP address from the pool of addresses reserved for the internal network. This address is typically in the private IP address range.

The Wi-Fi router has an internal (local) IP address on its internal network, used for communication within the local network. On the external side, facing the internet, the router has a public IP address, unique on the global internet and assigned by your Internet Service Provider (ISP).

When you are using mobile data, what happens with the IP address?

Your device is assigned an IP address by your Internet Service Provider (ISP).

The type of IP address you receive depends on whether your ISP assigns you a dynamic or static IP address.

Dynamic IP Address:

Most home internet connections use dynamic IP addresses. In this case, your ISP dynamically assigns an IP address to your modem or router each time it connects to the internet. Your router, in turn, assigns local IP addresses to devices connected to your home network. The external IP address visible on the internet is the one assigned by your ISP.

Static IP Address:

Some ISPs offer static IP addresses as an option. In this scenario, your ISP assigns a fixed IP address to your modem or router, which does not change over time. If you have a static IP address, it means that your device (modem or router) always uses the same IP address when connecting to the internet.

IPv4

An IPv4 address uses 32-bit binary numbers to form a unique IP address. It takes the format of four sets of numbers, each ranging from 0 to 255 and representing an eight-digit binary number, separated by a period point.

IPv6

An IPv6 address consists of eight groups of four hexadecimal digits. Here’s an example IPv6 address:

3001:0da8:75a3:0000:0000:8a2e:0370:7334

This new IP address version is being deployed to fulfill the need for more Internet addresses. It aims to resolve issues associated with IPv4. With a 128-bit address space, it allows 340 undecillion unique addresses. IPv6 is also called IPng (Internet Protocol next generation).

Localhost Alias: "127.0.0.1" is often referred to as "localhost." For instance, a web server running on the local machine may be accessed using "http://localhost."

Top comments (0)