Network Class

From HPCWIKI
Revision as of 10:45, 6 July 2023 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

IP v4 Address Classification

IP Address Classification

There are five classes: A, B, C, D and E in the IPv4 IP address space. Primarily, class A, B, and C are used by the majority of devices on the Internet. Class D and class E are for special uses. Each class has a specific range of IP addresses.[1]


The IP Address Classification figure shows different classes of IP addresses. These addresses differ in the number of bits assigned to the network and host ids.

Within each network class, there are designated IP address that is reserved specifically for private/internal use only. Private IP address cannot be used on Internet-facing devices as they are non-routable - not allowed to be routed outside of your internal network.

Class Public IP Range Private IP Range Special IP Range Subnet Mask Number of Networks Number of Hosts per Network
A 1.0.0.0 to 127.0.0.0 10.0.0.0 to 10.255.255.255

CIDR[2] example (10.0.0.0/8)

255.0.0.0 126 16,777,214
B 128.0.0.0 to 191.255.0.0 172.16.0.0 to 172.31.255.255

CIDR example, (172.16.0.0/16)

Automatic Private IP Addressing (APIPA) is a feature with Microsoft Windows-based computers to automatically assign itself an IP address within this range if a Dynamic Host Configuration Protocol (DHCP) server is not available on the network. 255.255.0.0 16,382 65,534
C 192.0.0.0 to 223.255.255.0 192.168.0.0 to 192.168.255.255

CIDR example, (192.168.0.0/24)

127.0.0.1 to 127.255.255.255

**network testing addresses (also referred to as loop-back addresses).

255.255.255.0 2,097,150 254
D 224.0.0.0 to 239.255.255.255 Multicasting
E 240.0.0.0 to 255.255.255.255 Research/Reserved/Experimental

Network prefix vs Host ID

The internet, as the name implied, is a network of networks. Thus to uniquely identify a host on the internet, one needs to know the network's id and the host's id in the network. Thus IP address consist of two components, the network id and the host id. The network id is the number assigned to a network in the internet. Host id represents the id assigned to a host in the network.


Network prefix describes the specific location on the network to find where that IP addresses are located on. Network prefix portion is being used by Router to send packets through an internetwork becuase Routers are not concerned about host addresses.

Two type of routing

  • Classless routing : the practice of assigning different size masks on your network—does not work unless you run a routing protocol that supports prefix routing. RIP version 2, OSPF, and EIGRP are examples of routing protocols that can support classless routing.
  • Classful routing : means that all hosts have the same size mask. RIP version 1 and IGRP are classful routing protocols, and neither will work in a classless environment.

Subnet

To create smaller networks (sub networks) out of a Class A network ID, you’d borrow bits from the host portion of the mask. The more bits you borrow, the more subnets you can have, but this means fewer hosts per subnet. following  lists all the available Class A subnet masks:[3]

Subnetting applies equally whether you working with either private or public addresses. It becomes even more important when you’re working with globally routed IP space.[4]

Subnet defines the specification of bits that should be used for routing is specified by associating a subnet mask with a routing entry.Once define a subnet mask for subclassing large network to small network by assign subnet mask and validate subnet address, to valid subnet address ipcalc would be simplest way to

Available Class A subnet masks
Mask Prefix Subnets Hosts
255.0.0.0 (/8) 1 network with 16,777,214 hosts
255.128.0.0 (/9) 2 subnets with 8,388,606 hosts each
255.192.0.0 (/10) 4 subnets with 4,194,302 hosts each
255.224.0.0 (/11) 8 subnets with 2,097,150 hosts each
255.240.0.0 (/12) 16 subnets with 1,048,574 hosts each
255.248.0.0 (/13) 32 subnets with 524,286 hosts each
255.252.0.0 (/14) 64 subnets with 262,142 hosts each
255.254.0.0 (/15) 128 subnets with 131,070 hosts each
255.255.0.0 (/16) 256 subnets with 65,534 hosts each
255.255.128.0 (/17) 512 subnets with 32,766 hosts each
255.255.192.0 (/18) 1,024 subnets with 16,384 hosts each
255.255.224.0 (/19) 2,048 subnets with 8,190 hosts each
255.255.240.0 (/20) 4,096 subnets with 4,094 hosts each
255.255.248.0 (/21) 8,192 subnets with 2,046 hosts each
255.255.252.0 (/22) 16,384 subnets with 1,022 hosts each
255.255.254.0 (/23) 32,768 subnets with 510 hosts each
255.255.255.0 (/24) 65,536 subnets with 254 hosts each
255.255.255.128 (/25) 131,072 subnets with 126 hosts each
255.255.255.192 (/26) 262,144 subnets with 62 hosts each
255.255.255.224 (/27) 524,288 subnets with 30 hosts each
255.255.255.240 (/28) 1,048,576 subnets with 14 hosts each
255.255.255.248 (/29) 2,097,152 subnets with 6 hosts each
255.255.255.252 (/30) 4,194,304 subnets with 2 hosts each

IP Routing

Networks in the internet are connected to each other via routers. Routers carry traffic from one network/subnet to another. Routers maintain a routing table to decide how to route the IP packets. Each routing entry consists of the destination address, subnet mask and "route to" field. When a message needs to be routed to an IP address[5]


Many IP routing protocols exist, in part due to the long history of IP; however, if you compare all the IP routing protocols, they all have some core features in common. Each routing protocol causes routers (and Layer 3 switches) to[6]

  1. Learn routing information about IP subnets from other neighboring routers
  2. Advertise routing information about IP subnets to other neighboring routers
  3. Choose the best route among multiple possible routes to reach one subnet, based on that routing protocol’s concept of a metric
  4. React and converge to use a new choice of best route for each destination subnet when the network topology changes—for example, when a link fails

This page provides more details about routing protocols.


Most common routing rule would be following steps,

  1. The destination IP address is masked with the subnet mask and then compared with the destination field for all entries in the routing table.
  2. This comparison may yield a match with more than one entry the entry with the longest subnet mask will be selected.
  3. Once an entry has been selected, the "route to" field is consulted and the action taken depends on the contents of this field:
    • If the "route to" field contains SELF the packet is meant for this node. The IP packet is passed to the OS for application processing
    • If the "route to" field contains a LAN interface id, the packet is destined for a LAN that is directly connected to the router/host. In this case, the packet is routed directly on the LAN.
    • If the "route to" field contains an IP address, the packet is forwarded to the IP address specified. Further routing of the packet will be carried out by the specified IP address.

References