No More Backdoors: Know Who Has Access to What, Right Now
Jun 13
Virtual
Register Today
Teleport logoTry For Free
Home > Teleport Academy > Infrastructure Access

How IPv4 and IPv6 works

Posted 28th Dec 2022 by Sakshyam Shah

IP address denotes the location of a networked device or a service on the internet. IPv4 is a 32 bit network address scheme widely used on the internet. But due to the ever-growing internet, the 32 bit addressing is thought to be a limited factor. So IPv6 was invented, which is a 128 bit long network addressing, allowing to create a combination of over 340 trillion trillion trillion IP addresses, enough to to assign an IP address to every grain of sand on earth.

IPv4 Addressing

IPv4 Address Structure

IPv4 is a 32-bit value divided into four octets. The four octets are separated with a dot “.” notation. In a binary form, the value of these octets range from 00000000 to 11111111 and in decimal form, the values range from 0 to 255. Each of the octets are either used to denote network or host bits. The network bits are used for routing and the host bits are used to reach a specific host.

IPv4 address classification

IP addresses are classified into five classes: A, B, C, D and E. In class A address, the first octet is used to denote network and the remaining ones are used to denote host bits. In class B, the first two octets are used to denote network bits and the remaining two are to denote host bits. In class C, the first three octets are used to denote network bits and only the last octet is for host bits. Class D addresses are used for multipoint broadcasts and the class E is used for research only.

Private and Public IP address

Total number of IP addresses, which is approximately 4.3 billion, is a limited number. To reduce waste of IP allocation, private IP addressing allows the creation of a network that is fully routable but requires an interface with public IP (e.g., using NAT) in order to connect to the public network.

Private IP address range includes:

  • Class A private Subnet: 10.0.0.0/8
  • Class B private subnet: 172.16.0.0/12
  • Class C private subnet: 192.168.0.0/16
  • Class A loopback subnet: 127.0.0.0/8

IPv4 Subnetting

A class A network supports 127 networks and each network can support 16 million hosts. This makes it a challenge for routing efficiently. This is where the idea of subnetting fits in. Subnetting lets you create and manage a small network inside a larger network that helps for efficient routing and network management.