The Wayback Machine - https://web.archive.org/web/20261113215418/https://www.geeksforgeeks.org/computer-science-fundamentals/what-is-an-ip-address/

IP Address

Last Updated : 4 Nov, 2026

An IP address (Internet Protocol address) is a unique numerical label assigned to each device connected to a network that uses the Internet Protocol.

  • Identifies a device on the network.
  • Locates the device so it can communicate with other devices over networks like the internet.
ip_addresses
IP Address

Components of an IP Address

  • Network Portion: Identifies the network to which the device belongs.
  • Host Portion: Identifies the individual device on that network.
  • Subnet Mask: Defines which part of an IPv4 address is the network and which is the host.

Example: for 192.168.1.10 with the subnet mask 255.255.255.0, the Network ID is 192.168.1.0 and the Host ID is 10.

Subnetting: Divides a large network into smaller subnets at the Network Layer of the OSI model. It borrows bits from the host portion and adds them to the network portion, with the boundary defined by a subnet mask or CIDR notation such as /24.

Classes of IPv4 Address

IPv4 addresses are divided into five classes under classful addressing:

  • Class A (1-126): Supports 126 networks.
  • Class B (128-191): Supports 16,384 networks.
  • Class C (192-223): Supports 2,097,152 networks.
  • Class D (224-239): Reserved for multicasting.
  • Class E (240-255): Reserved for research and development.

How IP Addresses Work

  • Every device on a network gets an IP address, and without it the device cannot send or receive data.
  • Data is divided into packets, and each packet carries the source and destination IP addresses.
  • Routers read the destination IP and forward each packet along the best route.
  • A LAN links devices over a short distance, while a WAN connects different networks through multiple routers.
  • Network Address Translation (NAT) allows multiple devices on a private network to share a single public IP address.

Example: Sending an Email from New York to Tokyo

  • Alice’s laptop and Bob’s computer have private IPs assigned by their routers, and both routers have public IPs from their ISPs.
  • Alice’s email client converts the email into packets with her public IP as the source and Bob’s mail server IP as the destination.
  • The packets pass through her ISP and several intermediate routers to reach Tokyo.
  • Bob’s mail server reassembles the packets into the original email, and Bob’s computer retrieves it.

How to Look Up IP Addresses

  • Windows: Open the Command Prompt, type ipconfig, and press Enter.
  • Mac: Go to System Preferences > Network and select your active connection.
  • iPhone: Go to Settings > Wi-Fi and tap the (i) icon next to your network.

IP Address Security Threats

  • IP Spoofing: Attackers fake a trusted IP address to gain unauthorized access.
  • DDoS Attack: Many infected systems flood a target with traffic, causing slowdowns or crashes.
  • Man-in-the-Middle Attack: Hackers intercept or alter data between two parties.
  • Port Scanning: Attackers look for open ports to exploit vulnerabilities.

How to Protect and Hide Your IP Address

  • VPN: Routes your traffic through a secure server, which hides your IP and encrypts your data.
  • Proxy Server: Replaces your IP address with its own when you send requests.
  • Tor Browser: Routes data through multiple volunteer nodes with layered encryption.
  • Firewall: Filters incoming and outgoing traffic and blocks suspicious connections.
Comment