Cornerstone Content,  Learning,  Networking,  Tech

IP Addresses, Subnet Masks, Subnetting, and Calculating Hosts

IPv4 IP addresses are a 32-bit (binary digit) value.

IP addresses are just strings of 32 binary digits (bits!).

ex: 11000000101010000000010000000010

Broken down into 4 groups of 8, separated by dots (periods/decimals).

ex: 11000000.10101000.000001.00000010

Now each 8-bit value, octet, is converted to a decimal number between 0 and 255 (for a total a 256 options).

So the above would translate to:

ex: 192.168.4.2

This is “dotted decimal notation” aka “the dotted octet numbering system”.

Tip: You should memorize that 0=00000000 and 255=11111111. You’ll find knowing this very helpful.

Note: By definition, all computers on the same network have the same subnet mask and network ID.

/24 is limited to IP addresses between 11111111.11111111.11111111.00000000 and 11111111.11111111.11111111.11111111. Or we could read as between 255.255.255.0 and 255.255.255.254. (‘.255’ is a “broadcast address” used to talk to every computer on the LAN and ‘.0’ is used for the network ID.

So a /24 network provides 254 IP address options

/16 gives a total of 65,534 hosts.

/8 gives around 16.7 million hosts.

Network IDs

A WAN is two or more interconnected LANs.

To differentiate one LAN from another LAN, “each computer on a single LAN must share a very similar, but not identical, IP address. Some parts of the IP address will match all the others on the LAN.”

Think telephones, telephone numbers, area codes and country codes.

Calculating Hosts

Being able to determine the number of hosts for a given subnet is critical!

There’s a simple formula!

2x – 2 = # of hosts available

So for a /24 network:

11111111.11111111.11111111.00000000

28 – 2 = 254 total hosts

or on a /26 network:

11111111.11111111.11111111.11000000

26 – 2 = 62 total hosts

or on a /16 network:

11111111.11111111.00000000.00000000

216 – 2 = 65,534 total hosts

A subnet mask is a string of 1’s followed by a string of 0’s. Subnet masks are always 32 binary digits long!

The subnet mask is a way to segment a network logically. So that different computers and devices CANNOT talk to other computers and devices on the same physical network. Even though 2 computers may be connected on a physical level, subnetting can prevent them from talking to each other. (This is done via a physical ‘switch’, NOT a ‘router’.)

  • Every computer or device on a network needs:
    • an IP address
    • a subnet mask
    • a default gateway (the default gateway is the router for the subnetwork that your are on at the moment.) Your computer (or host device) will look first within the local network for its destination computer/server before using the default gateway to access the greater, wider internet
    • needs to know what DNS servers to talk to

Leave a Reply

Your email address will not be published. Required fields are marked *