• Articles
  • Tutorials
  • Interview Questions

IP Address - What Is, Types, and How Does it Work

IP Address - What Is, Types, and How Does it Work

In the world of the Internet, every device connected to it possesses a unique identifier known as an IP address. Whether you’re casually browsing the web or managing a complex network, understanding the fundamentals of IP addresses is essential. 

Table of Contents

Master the concepts of cybersecurity with us. Check out our YouTube video on cybersecurity:

Video Thumbnail

What is an IP (Internet Protocol) Address?

An IP address, or Internet Protocol address, is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. It serves two main functions: host or network interface identification and location addressing. IP addresses are essential for the functioning of the Internet, as they enable devices to send and receive data within the network.

IP addresses are crucial for routing data between devices on a network. When you access a website or send an email, data packets are transmitted across the Internet, and each packet contains the IP addresses of both the source and destination devices. Routers and other networking devices use these addresses to ensure that the data reaches its intended destination.

Version of IP address

There are two versions of IP addresses which are as follows:

1. IPv4: Internet Protocol version 4 (IPv4) addresses are composed of four sets of numbers separated by dots (e.g., 192.168.0.1). Each part can range from 0 to 255 in decimal notation. The first octet’s three digits represent a specific internet network, and the remaining digits indicate the host address—a workstation or server that is located within the local network. 

However, computers process data in binary code, composed of only 0s and 1s. Consequently, the decimal range 0-255 converts to binary as (00000000 – 11111111), with each digit represented by 8 bits. Thus, a complete IPv4 address consists of 32 bits. In IPv4, each computer is allocated a distinct 32-bit binary sequence, accommodating approximately (2^32) different combinations, totaling around 4,294,967,296 unique devices that can be assigned IPv4 addresses.

IPv4 addresses are categorized into five classes: Class A, B, C, D, and E which is represented in the table given below:

ClassRangeMaximum Number of Networks
Class A1.0.0.0 to 126.255.255.255128 networks (2^7 – 2 = 126 can be used)
Class B128.0.0.0 to 191.255.255.25516,384 networks
Class C192.0.0.0 to 223.255.255.2552,097,152 networks
Class D224.0.0.0 to 239.255.255.255Reserved for multicast
Class E240.0.0.0 to 255.255.255.255Reserved for experimental purposes 

IPv4 addresses support unicast, multicast, and broadcast communication. Due to the limited address space of IPv4 (4.3 billion unique addresses), techniques like Network Address Translation (NAT) are employed to conserve addresses and allow multiple devices within a private network to share a single public IP address.

IPv4 has been foundational for internet connectivity for decades, but its address exhaustion issues led to the development of IPv6. Despite the ongoing transition to IPv6, IPv4 remains in widespread use, and various mechanisms, such as dual-stack configurations and tunneling, are employed to facilitate interoperability between IPv4 and IPv6 networks.

2. IPv6: Internet Protocol version 6 (IPv6) is the latest generation of the Internet Protocol, designed as a successor to IPv4 to address the limitations of its predecessor. IPv6 uses 128-bit addresses, represented in hexadecimal notation and separated by colons, providing an exceedingly larger address space compared to the 32-bit addresses of IPv4. An example of an IPv6 address is 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Each group of four hexadecimal digits represents a specific network, and the remaining digits indicate the host address within that network.

IPv6 addresses support unicast, multicast, and anycast communication. There are conventions for shortening IPv6 addresses, such as omitting leading zeros in each 16-bit block and using a double colon (::) to represent consecutive blocks of zeros. 

For Example, 2001:0db8:00a0:0000:0000:12ef:0000:5678 can be shortened to 2001:db8:a0::12ef:0:5678

IPv6 incorporates built-in support for address autoconfiguration through Stateless Address Autoconfiguration (SLAAC) and Dynamic Host Configuration Protocol version 6 (DHCPv6). Address allocations are hierarchical, featuring a global routing prefix and subnet identifiers.

Transition mechanisms exist to facilitate the coexistence of IPv4 and IPv6 during migration, including dual-stack configurations, tunneling, and translation mechanisms. IPv6 also enhances security with mandatory support for IPsec.

The large address space of IPv6 accommodates the growing number of devices connected to the internet, and its adoption is increasing. Modern networks and internet service providers (ISPs) often operate with dual-stack configurations, supporting both IPv4 and IPv6 to ensure a seamless transition while maintaining compatibility with existing IPv4 systems.

As we have discussed the two versions of IP addresses, it’s important to note the difference between the Domain Name System (DNS) and the IP address explained in the next section.

Enroll in our CEH Certification and learn Ethical Hacking from the basics!

Difference between Domain Name System and IP address

While DNS (Domain Name System) is responsible for translating human-readable domain names into IP addresses, IPv4 and IPv6 are two different versions of the Internet Protocol, with IPv4 using 32-bit addresses and IPv6 utilizing 128-bit addresses, providing a larger address space to accommodate the growing number of devices connected to the internet. The table provides a concise overview of the key differences among DNS and IP addresses.

FeatureDNSIP Address
PurposeResolves domain names to IP addressesIdentifies a device on a network
FormatHierarchical, human-readable namesNumeric, in the form of 192.168.1.1 (IPv4) or 2001:0db8:85a3:0000:0000:8a2e:0370:7334 (IPv6)
FunctionMaps domain names to IP addressesIdentifies the location of a device in a network
Human ReadabilityMore human-friendlyLess human-friendly
Exampleswww.example.com192.168.1.1
Resolution ProcessInvolves querying DNS servers to obtain the corresponding IP addressDirectly used for routing packets in a network
Dynamic NatureDynamic, subject to changes (e.g., IP address changes for a domain)Static for a specific device unless manually changed
Managed byManaged by DNS servers globallyAssigned and managed by network administrators or DHCP servers
HierarchyOrganized in a hierarchical structure with top-level domains, second-level domains, etc.No hierarchical structure, flat addressing
UpdatesCan be updated to reflect changes in IP addresses or domain configurationsTypically requires manual intervention to update

Transform your knowledge in the domain of cybersecurity with our expert-led Cybersecurity Course. Enroll now!

Why are IP Addresses Unique?

IP addresses are unique because they serve as identifiers for devices within a network. In the context of the global Internet, they must be unique to ensure proper communication. Every device connected to a network requires a distinct address so that data can be correctly routed to and from that specific device. If multiple devices share the same IP address, it would lead to confusion, data misrouting, and other operational issues.

The uniqueness of IP addresses is maintained through the allocation and management processes overseen by organizations like the Internet Assigned Numbers Authority (IANA) and its regional counterparts, such as the Regional Internet Registries (RIRs). These entities are responsible for distributing blocks of IP addresses to Internet service providers (ISPs), organizations, and other entities. Each allocated IP address is intended for use by a specific device or network, ensuring that there are no conflicts in the addressing scheme.

Get 100% Hike!

Master Most in Demand Skills Now!

How Do IP Addresses Work?

If you’re having trouble with a device not connecting or your internet not working, it’s useful to know how IP addresses work. IP addresses are like unique labels for devices on a network. Understanding them can help you figure out and fix connection issues.

Internet Protocol functions similarly to any other language, operating on established guidelines for transmitting information. Devices locate, send, and share data with other connected devices through this protocol. Through this shared language, computers from any location can communicate with one another.

Let’s understand the steps that allow IP addresses to enable communication between devices:

Firstly, IP addresses are assigned to network interfaces on devices by a network or network administrator. For home networks, this usually happens automatically when the router uses DHCP. The IP address consists of a network portion and a host portion. The network portion identifies the network, while the host portion identifies the specific device on that network.

Afterward, when a device sends data across the internet, the IP address ensures the data is sent to the correct destination network. This works because routers examine the network portion of the IP address to determine where to send the data next. The data travels from router to router, getting closer to the destination network each time as the routers look at the IP network portion. This is known as “routing.”

Finally, when the data reaches the destination network, that network’s router examines the host portion of the IP address to deliver the data to the intended device on that network. So the IP address identifies the destination network using routing and then identifies the destination device on that network for final delivery. This allows end-to-end communication between devices across multiple interconnected networks. Responses follow the same process back to the original sender IP address by using the source and destination IP address fields in the data packet headers.

Explore the top Computer Networks interview questions with Intellipaat and ace your next interview to get your dream job!

How are IP Addresses Generated?

IP addresses are not arbitrarily assigned; instead, they are systematically generated and allocated by the Internet Assigned Numbers Authority (IANA), a division of the Internet Corporation for Assigned Names and Numbers (ICANN). Established as a non-profit organization in the United States in 1998, ICANN plays a crucial role in maintaining the security and accessibility of the Internet. When individuals or organizations register a domain on the Internet, they do so through a domain name registrar, which, in turn, pays a nominal fee to ICANN for the registration process. This structured approach ensures the orderly distribution and management of IP addresses across the global network.

Below, we have provided an overview of how IP addresses are generated:

  • IP addresses are composed of two parts: the network portion and the host portion. The network portion identifies a network, while the host portion identifies a particular device on that network.
  • Public IP addresses are assigned in blocks by Regional Internet Registries (RIRs) to Internet Service Providers (ISPs) and other large organizations.
  • ISPs and organizations then assign smaller subsets of their allocated blocks to customer networks.
  • Within a network, IP addresses can be assigned in two main ways:
    • Dynamically by a DHCP Server: The DHCP server pulls available addresses from a preconfigured pool to assign them on demand. Addresses go back into the pool when released.
    • Statically by an Administrator: Specific IP addresses are manually assigned to specific devices on the network by an administrator.
  • When a device connects to a network with dynamic IP assignment, it requests an IP address from the DHCP server. The server assigns it an available address from the pool for a lease period.
  • IP address assignments depend on the size and architecture of a network. Larger networks use subnetting and Classless Inter-Domain Routing (CIDR) to maximize address utilization.

Types of IP Addresses

Types of IP Addresses

IP addresses are classified into various categories, each containing distinct types within them. Below, we have mentioned three types of IP addresses:

1. Private IP Addresses

Private IP addresses are used within a private network, such as a home or business network. These addresses are not routable over the public Internet, meaning they are not directly accessible from outside the private network. Private IP addresses are typically used for internal communication among devices within a local area network (LAN). The ranges defined for private IP addresses are:

  • IPv4 Private Addresses: 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255, and 192.168.0.0 to 192.168.255.255
  • IPv6 Unique Local Addresses: fc00::/7

2. Consumer IP Addresses

Consumer IP addresses commonly refer to the IP addresses assigned to individual users or households. These are the IP addresses that internet service providers (ISPs) allocate to residential customers. Consumer IP addresses are used to identify and communicate with specific devices (such as computers, smartphones, or tablets) within a home network when they connect to the internet.

3. Public IP Address

A public IP address is globally unique and accessible over the internet. Typically assigned by an ISP or a network administrator, it serves to identify a specific device on the public internet. Public IP addresses are essential for devices or servers requiring external accessibility. Examples include websites, email servers, and online gaming servers, all of which necessitate public IP addresses.

Public IP addresses are of two types, which are:

  • Dynamic IP Addresses: Dynamic public IP addresses are assigned by an ISP from a pool of addresses for a specific duration. The assignment is temporary and may change over time, especially when the device is disconnected and reconnected to the internet. Dynamic IP addresses are more common for residential internet connections.
  • Static IP Addresses: Static public IP addresses, on the other hand, remain constant and do not change over time. They are manually configured and are often used for servers or devices that need a consistent and unchanging address for services such as hosting a website, running a mail server, or providing remote access.

Types of Website IP Addresses

For website owners who do not manage their servers and instead depend on a web hosting package, which is the situation for the majority of websites, there are two categories of website IP addresses: shared and dedicated IP addresses.

1. Shared IP Address

Shared IP addresses are addresses used by multiple websites hosted on the same server. In a shared hosting environment, multiple websites share the same IP address. This is a cost-effective solution, as it allows hosting providers to allocate resources more efficiently. However, since multiple websites share the same IP address, any issues affecting one website may potentially impact others on the same server.

2. Dedicated IP Address

Dedicated IP addresses are unique addresses assigned to a single website or server. Unlike shared IP addresses, where multiple websites share the same IP, a dedicated IP is exclusively associated with a specific domain. Dedicated IP addresses are often used for websites that require additional security measures, such as SSL certificates for secure transactions. They can also be beneficial for websites with high traffic or those that need to run specific applications or services.

Methods for IP Address Lookup

An IP address lookup is the process of finding information about an IP address, such as its geographical location, ISP (Internet Service Provider), and other relevant details. 

To easily find your router’s public IP address, you can search “What is my IP address?” on Google. The search engine will display your public IP information at the top of the page. Similarly, other websites can provide the same information since your router reveals its public IP address when requesting to access these sites.

It’s important to note that this method generally provides an approximate location based on the service provider’s location, rather than the precise location of your device. If you’re using a VPN, make sure to log out to obtain accurate information. Keep in mind that obtaining the actual physical location linked to a public IP address requires a search warrant submitted to the Internet Service Provider (ISP).

Some other methods to perform an IP address lookup are as follows:

Windows Platform

  • Using Command Prompt:
    • Open the Windows search and type “cmd” (without quotes).
    • In the displayed pop-up box, enter “ipconfig” (without quotes) to retrieve the information.
  • In this example:
    • Link-local IPv6 Address: The link-local IPv6 address, indicated by “fe80::ceb8:c043:8598:3c4e%9,” is automatically assigned to the network interface for local communication within the same subnet.
    • IPv4 Address: The IPv4 address, specified as “10.0.28.97,” is the unique identifier assigned to the network interface on the local network.
    • Subnet Mask: The subnet mask, denoted as “255.255.240.0,” defines the range of IP addresses within the local network and is used to determine the network and host portions of the IPv4 address.
    • Default Gateway: The default gateway, represented as “10.0.16.1,” is the IP address of the router that serves as the exit point for traffic outside the local network.
  • Using Settings:
    • Go to Start>Settings>Network & Internet>Wifi or Ethernet, and then select the network you are connected to.
    • Under Properties, locate your IP address, which is displayed next to the IPv4 address.

Mac Platform

  • Go to System Preferences.
  • Select Network: This will display your IP address information.

Online IP Lookup Tools: Various online tools allow you to input an IP address and retrieve information about it. Examples include websites like WhatIsMyIP.com, IPLocation, and IPinfo.io.

Geolocation Services: Geolocation services use databases to map IP addresses to physical locations. Services like MaxMind or IPstack provide APIs that can be used for geolocation lookups.

IP Addresses Common Security Threats

IP Addresses Common Security Threats

IP address security threats are risks and vulnerabilities related to keeping IP addresses safe. These threats pose dangers such as unauthorized access by cybercriminals to devices, the initiation of various attacks, or the compromise of a network’s integrity. Below are some common threats associated with IP addresses:

  • IP Address Hijacking: IP address hijacking involves taking control of the IP address of a legitimate user or device, leading to unauthorized access and potential data interception. In Border Gateway Protocol (BGP) hijacking, an attacker advertises IP prefixes that they do not own, rerouting traffic intended for the legitimate owner. For instance, a cybercriminal might announce a more specific IP prefix, causing traffic to be redirected through their network, enabling eavesdropping or manipulation.
  • Blacklisting: Blacklisting is a security measure where specific IP addresses are denied access or services due to their association with malicious activities. IP reputation services maintain lists of known malicious IP addresses based on historical behavior. For example, an IP address that has been identified as the source of numerous malware or phishing attacks may be blacklisted to prevent it from accessing certain websites or services. This helps organizations protect their networks from potentially harmful traffic.
  • Denial of Service (DoS) Attacks: Denial of Service attacks aim to overwhelm a system, network, or service, making it unavailable to users. Attackers flood the target with excessive traffic, exhausting its resources and causing a disruption in normal functioning. For instance, a Distributed Denial of Service (DDoS) attack might involve a botnet flooding a website with traffic, rendering it inaccessible to legitimate users.
  • Malware Infections: Malicious software, commonly known as malware, presents a considerable risk to IP addresses. This category includes viruses, worms, and ransomware, which exploit vulnerabilities to infiltrate systems. As an illustration, a user might inadvertently download a Trojan horse disguised as a seemingly legitimate file. This act can lead to unauthorized access to their device and, potentially, the propagation of the malware to other devices within the network.
  • DNS Spoofing and Cache Poisoning: Domain Name System (DNS) is a crucial component of the internet that translates human-readable domain names into IP addresses. In DNS spoofing, attackers manipulate DNS responses to redirect users to malicious sites. In cache poisoning, false information is injected into DNS caches. For example, an attacker might modify DNS records to redirect users from a legitimate banking site to a fraudulent one, aiming to collect sensitive information.

Elevate your interview experience with us. Check out our well-curated Cybersecurity Interview Questions and Answers.

How Can You Protect Your IP Address?

How Can You Protect Your IP Address?

Protecting your IP address is important for maintaining online security and privacy. Below, we have mentioned several measures you can take to safeguard your IP address:

  • Enable a Firewall: Firewalls monitor and control incoming and outgoing network traffic, acting as a barrier between your device and potential threats. Ensure that your operating system’s firewall is activated, and consider using a third-party firewall for added protection.
  • Use a Virtual Private Network (VPN): A VPN encrypts your internet connection and routes your traffic through a secure server, masking your IP address. This not only protects your identity but also adds an extra layer of security to your online activities. Choose a reputable VPN service with a no-logs policy for enhanced privacy.
  • Regularly Update Software and Security Patches: Ensure that your operating system, antivirus software, and other applications are up-to-date with the latest security patches. Regular updates help fix vulnerabilities that could be exploited by attackers to gain access to your IP address.
  • Use HTTPS: When browsing websites, make sure the connection is secure by checking for “https://” in the URL. This indicates that the data exchanged between your device and the website is encrypted, reducing the risk of eavesdropping and man-in-the-middle attacks.
  • Use Private Browsing Modes: Most web browsers offer private or incognito modes that limit the collection of browsing data and can help protect your privacy. While this won’t hide your IP address, it can prevent the storage of cookies and other tracking information.
  • Configure Router Security Settings: Ensure that your home router is configured with strong security settings. Change the default username and password, enable WPA3 encryption for Wi-Fi connections, and regularly update the router firmware to patch known vulnerabilities. 

Conclusion

IP addresses are the digital labels that make the internet tick, and knowing how they function is important for secure online experiences. By grasping their significance and implementing protective measures, we empower ourselves in the dynamic digital landscape. So, whether you’re a casual user or a tech enthusiast, staying informed about IP addresses contributes to a safer and more resilient online environment.

Course Schedule

Name Date Details
Cyber Security Course 14 Dec 2024(Sat-Sun) Weekend Batch View Details
21 Dec 2024(Sat-Sun) Weekend Batch
28 Dec 2024(Sat-Sun) Weekend Batch

About the Author

Lead Penetration Tester

Shivanshu is a distinguished cybersecurity expert and Penetration tester. He specialises in identifying vulnerabilities and securing critical systems against cyber threats. Shivanshu has a deep knowledge of tools like Metasploit, Burp Suite, and Wireshark.