IP Addressing

Yaser Rahmati | یاسر رحمتی

IP addressing is a fundamental aspect of networking that allows devices to communicate on a network, whether it's a local network (like a home or office) or the broader internet. IP addresses are used to uniquely identify devices on these networks.

Types of IP Addresses

1. IPv4 (Internet Protocol version 4)

  • Format: IPv4 addresses are written in a dotted decimal format, consisting of four octets (8-bit numbers), separated by dots. Each octet can be a number from 0 to 255, making the format: xxx.xxx.xxx.xxx.

    • Example: 192.168.1.1

  • Address Space: IPv4 offers a total of 2^32 addresses (~4.3 billion addresses), which are nearly exhausted due to the exponential growth of devices.

  • Classes:

    • Class A: 0.0.0.0 to 127.255.255.255 (Used for large networks, supports millions of hosts)

    • Class B: 128.0.0.0 to 191.255.255.255 (Used for medium-sized networks)

    • Class C: 192.0.0.0 to 223.255.255.255 (Used for small networks, supports up to 254 hosts)

    • Class D: 224.0.0.0 to 239.255.255.255 (Reserved for multicasting)

    • Class E: 240.0.0.0 to 255.255.255.255 (Reserved for future use, research)

2. IPv6 (Internet Protocol version 6)

  • Format: IPv6 addresses are written in hexadecimal format, separated by colons. An IPv6 address has 128 bits, providing a vastly larger address space (2^128 addresses).

    • Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

  • Address Space: IPv6 offers an enormous number of addresses, which solves the exhaustion problem of IPv4.

  • Shortening IPv6: IPv6 addresses can be shortened by eliminating leading zeros and replacing consecutive groups of zero values with ::. For example:

    • Full: 2001:0db8:0000:0000:0000:0000:0000:1

    • Shortened: 2001:db8::1

Structure of an IP Address

IP addresses are composed of two parts:

  1. Network ID: Identifies the network to which the device belongs.

  2. Host ID: Identifies the specific device (host) on the network.

The size of the Network ID and Host ID depends on the subnet mask, which divides the IP address into these parts.

Subnet Mask

A subnet mask defines which portion of the IP address is the network and which part is the host. It's a 32-bit number in IPv4, expressed in the same dotted decimal format:

  • Example: 255.255.255.0 (This means the first 24 bits are the network part, and the remaining 8 bits are the host part).

A subnet mask allows you to divide a larger network into smaller sub-networks (subnets).

CIDR Notation

Classless Inter-Domain Routing (CIDR) is a more flexible method for defining IP addresses and their associated routing. CIDR notation is written as:

  • Example: 192.168.1.0/24

  • /24 refers to the first 24 bits as the network portion of the address, leaving 8 bits for the host.

Types of IP Addresses by Use

  1. Public IP Address: These are globally unique and assigned by ISPs. Devices using public IPs can be accessed directly over the internet.

    • Example: 203.0.113.5

  2. Private IP Address: These are reserved for use within private networks (home, office, etc.) and cannot be routed over the internet. They are defined in:

    • Class A: 10.0.0.0 to 10.255.255.255

    • Class B: 172.16.0.0 to 172.31.255.255

    • Class C: 192.168.0.0 to 192.168.255.255

    • Example: 192.168.1.1

  3. Static IP Address: A fixed IP address manually assigned to a device. It remains constant over time.

    • Example: 203.0.113.10 (Public), 192.168.1.10 (Private)

  4. Dynamic IP Address: An IP address automatically assigned by a DHCP server. These addresses can change over time, as the device may get a different IP when reconnecting to the network.

    • Example: Most home routers provide dynamic IPs to connected devices.

  5. Loopback IP Address: Used by a device to refer to itself. In IPv4, this is always 127.0.0.1. For IPv6, it is ::1.

  6. Multicast IP Address: These are used to send packets to multiple destinations. Class D addresses in IPv4 are reserved for multicast.

    • Example: 224.0.0.0 to 239.255.255.255

Special IP Addresses

  1. Broadcast Address: Used to send data to all devices on a network. The broadcast address for a network is the last address in its range.

    • Example: In the network 192.168.1.0/24, the broadcast address is 192.168.1.255.

  2. Default Gateway: This is the IP address of a router or gateway that a device uses to communicate with devices outside its local network.

    • Example: 192.168.1.1

IP Address Assignment

  1. DHCP (Dynamic Host Configuration Protocol): Automatically assigns IP addresses to devices on a network. Devices request an IP from the DHCP server when they connect.

  2. Manual Assignment: Administrators can assign static IP addresses to devices manually.

Key Concepts

  • IP Conflict: Occurs when two devices on the same network are assigned the same IP address. This results in communication issues for both devices.

  • Routing: Routers use IP addresses to direct packets to their destination. They look at the destination IP and use routing tables to forward the data.

  • IP Address Exhaustion: The rapid growth of internet-connected devices led to IPv4 address exhaustion, which is why IPv6 was introduced with a much larger address space.

Transitioning from IPv4 to IPv6

Due to the exhaustion of IPv4 addresses, IPv6 was developed to provide a vastly larger address space. Transition techniques such as dual-stack (running both IPv4 and IPv6 simultaneously) and tunneling are used to ensure compatibility between the two versions.

Understanding IP addressing is crucial for networking, as it ensures proper device identification and communication across both private and public networks.

Keywords

MikroTik, RouterOS, RouterBOARD, wireless networking, ISP, WISP, networking equipment, routers, switches, Cloud Core Router, CCR, SXT, LTE integration, 5G, cybersecurity, network security, networking software, networking hardware, Latvia, John Trully, Arnis Riekstiņš, MikroTik Academy, MUM events, network management, hotspot, VLAN, firewall, VPN, QoS, bandwidth management, traffic shaping, wireless access point, CAPsMAN, WinBox, PoE, mesh networking, routing protocols, MPLS, OSPF, BGP, MikroTik training

میکروتیک, روتر او اس, روتر برد, شبکه بی‌سیم, آی اس پی, وایرلس آی اس پی, تجهیزات شبکه, روترها, سوییچ‌ها, کلود کور روتر, سی سی آر, اس ایکس تی, ادغام ال تی ای, 5G, امنیت سایبری, امنیت شبکه, نرم‌افزار شبکه, سخت‌افزار شبکه, لتونی, جان ترولی, آرنیس ریکسینش, آکادمی میکروتیک, رویدادهای مام, مدیریت شبکه, هات اسپات, وی‌لَن, فایروال, وی‌پی‌ان, کیو‌اُ‌اس, مدیریت پهنای باند, شکل‌دهی ترافیک, نقطه دسترسی بی‌سیم, کپزمن, وین‌باکس, پی او ای, شبکه مش, پروتکل‌های مسیریابی, ام پی ال اس, اُ اس پی اف, بی جی پی, آموزش میکروتیک

🌐 Personal Website 📄 Resume 🎥 Video Archive 💼 Finance Blog 🔐 Network & Security Notebook 🎬 Aparat Channel

Last updated