DEV Community

Cover image for IP addressing
Ashutosh Mallick
Ashutosh Mallick

Posted on

IP addressing

  • What is Ip address?

  • IP address or internet protocol address is an unique number assigned to a server when it's connected to the internet.

  • Basically your internet service provider (ISP) will assign a geologically identifiable number when you connect to Internet.

Purpose of Ip address

  • Ip address is the unique identity off a server. -Each domain like "Apple.com" is bounded with an ip address.
  • Let's say we bind "apple.com" domain with ip address of the server where application is deployed. Hence, when a user will hit the domain name, they can directly navigate to the particular website.
  • Most of the larger websites like Apple has it’s own IP address like 17.172.224.47. You can enter this IP address directly on the browser’s address bar to resolve the domain name of the site.
  • Smaller websites may share single server address amongst hundreds of other websites.
  • On the other hand, the websites and apps also can track your details based on your IP address.
  • Let us take the same example of accessing Apple’s website. When you open the site from China, it will automatically redirects to the Chinese version applce.com/cn/ instead of the English version apple.com.

Types of ip address

  • When we launch a server, it has two ip address : public ip and private ip address. -Public ip is unique for the particular server only when the server is running.
  • By using public ip, we can connect to the servers even if we are outside of the network where the server is deployed.
  • But private ip is only accessible within the same network where the server is deployed.
  • For a database, only private ip is assigned to it. That means only internal resources of that network will be able to communicate and access the server.
  • Hence, by using private ip for the servers, we restrict access to the servers and allow specified users only.

public and private ip

  • Create an instance "Web-1" and note down its public ip address. If we reboot the instance, we can see that the public ip remains unchanged.

rebooting instance-1

rebooting instance-2

  • If we stop the instance it'll have only private ip address and again if we restart the instance then we'll see that the public ip of the instance gets changed.

stopping instance-1

stopping instance-2

public ip gets changed after rebooting

  • A public IP address or primary address represents the whole network of devices associated with it.
  • Every device included within with your primary address contains their own private IP address. ISP is responsible to provide your public IP address to your router.

  • Public IP addresses are further classified into two categories- dynamic and static.

Dynamic IP addresses

  • As the name suggests, Dynamic IP addresses change automatically and frequently. With this types of IP address, ISPs already purchase a bulk stock of IP addresses and allocate them in some order to their customers.

Static IP addresses

  • In comparison to dynamic IP addresses, static addresses are constant in nature.
  • The network assigns the IP address to the device only once and, it remains consistent.
  • Though most firms or individuals do not prefer to have a static IP address, it is essential to have a static IP address for an organization that wants to host its network server.
  • It protects websites and email addresses linked with it with a constant IP address.

Elastic Ip address

  • Elastic IP addresses are most commonly used to help with fault-tolerant instances or software.
  • For example, if you have an EC2 instance that has an Elastic IP address and that instance is stopped or terminated, you can remap the address and re-associate it with another instance in your account.
  • On termination or rebooting the public ip of instance remains fixed if the instance is associated with an elastic ip address.
  • AWS provides 5 elastic ip in a single region.

  • Let's configure elastic ip setup :

  • Launch an instance and allocate an elastic ip to it.

  • Mark the public ip of the elastic ip.

  • Associate the elastic ip with the running instance (Web-1).

  • Now try stopping and restarting the instance and check that the public ip remains unchanged.

el-ip-1

el-ip-2

el-ip-3

el-ip-4

el-5

el-ip-6

IPV4 and IPV6

  • An IPv4 address (Internet Protocol version 4) comprises four sets of numbers, each ranging from 0 to 255, which are separated by periods. For example, a site's IP address is 104.103.88.45.
  • IPv4 is the current standard for IP addresses in the TCP/IP model, while IPv6 is a newer IP version on the rise.

  • Internet Protocol version 6, or IPv6, was first introduced in the late 1990s as a replacement for IPv4.

  • It uses 128-bit addresses formatted as eight groups of four hexadecimal numbers separated by colons.

  • IPv6 is the solution that addresses the relatively limited number of IP addresses possible under IPv4. Under IPv6, there will no longer be a shortage of the total number of possible addresses.

IPV4 vs IPV6

Top comments (0)