IP Addresses
IP Addresses
WHAT IS IP ADDRESS?
TCP/IP protocol was designed to allow computers to communicate over networks,
especially the Internet. According to TCP/IP model, each computer on a network is
identified by a unique “Logical Address” that we call “IP Address or Internet Protocol
Address”.
Internet Assigned Numbers Authority (IANA) is the master holder of the IP addresses.
It issues all IP addresses in two versions:
IP V4 32 bit or 4 Bytes (octets).
IP V6 128 bit
Now to determine your IP Address,
open the CMD using RUN at your start
menu and type: ipconfig. A window
with your IP Address configuration will
appear as follow:
An IP4.0 Address is composed of two parts: Network Part and Host Part. The Subnet
Mask helps to determine each of the network part and the host part in an IP Address.
Technically, it is a 32 bit address that indicates the number of bits reserved for the
Network Addresses and the number of bits reserved for the Host Address.
Ex:
192 . 168 . 1 . 17
11110000- Experimental
E 240-255 11111111 Not in use
IP Class Ranges
Can be used only for computers on local Can be used for computers on local
networks. Cannot be used for computers networks and on the internet.
on the internet.
10.x.x.x to 10.x.x.x All other IP Addresses.
172.16.x.x to 172.31.x.x
192.168.x.x to 192.168.x.x
Free for all people. Paid.
Unicast, Multicast and Broadcast Addresses:
Lowest address
11000000.00000000.00000010.10000000 = 192.0.2.128
Highest address
11000000.00000000.00000010.10011111 = 192.0.2.159
27 bits
Number of usable addresses: 2^host bits -2 = 2^5-2 = 32-2 = 30. (host bits =32-27 =5)
Subnetting
• Since each L2 network needs its own prefix, then if you route more than one
network you need to divide your allocation.
• Ensure each prefix has enough IPs for the number of hosts on that network.
Subnetting Example
You have been given 192.0.2.128/27
However you want to build two Layer 2 networks and route between them.
The Golden Rules demand a different prefix for each network Let's split this address space into two
equal-sized pieces. host
192.0.2.128 Binary 11000000.00000000.00000010.10000000
Move one bit from host part to prefix 11000000.00000000.00000010.10000000
host
We now have two /28 prefixes
11000000.00000000.00000010.10000000 : 192.0.2.128/28
11000000.00000000.00000010.10010000 : 192.0.2.144/28
Subnetting
A subnet is a logical subdivision of an IP network. The process of dividing a network into two
or more networks is called Subnetting.
The main purpose of subnetting is to help relieve network congestion, and improve network
performance. Security is another benefit of subnetting.
Submetting Example
One day your supervisor walks to you, saying: Here the network ID 192.168.4.0/24. Please
create three separate networks or subnets for a coffee shop, One subnet is for the office. One
is for the front desk and storage room. One is for public use.
Your task is to list each network ID, subnet mask, Host ID Range, number of usable host IDs, and
broadcast ID.
Solution
First is first, let as build a table. This table is the most critical, because once we
build it, we can easily solve most subnetting questions.
This table has three rows. The first row is subnet with 9 numbers, we start with 1, 2,
4, 8, 16, 32, 64, 128, and 256. the pattern is each number is double of its previous
number. The second row is host, this row tells the number of total host IDs for each
new subnet. Start with 256, then 128, 64, 32, 16, 8, 4, 2, and 1. the pattern is each
number is half of its previous number. The second row is the reverse order of the
first row. The third row is subnet mask: we use shorthand format:
/24, /25, /26, /27, /28, /29, /30, /31, /32.
Subnet /24 /25 /26 /27 /28 /29 /30 /31 /32
Mask
You are given a network ID: 192.168.4.0/24.
You are required to get three subnets. Three is the keyword, now look at the table
and try to find the 3 subnets in the first row, But there is no number three in the first
row, but the 4 subnets is suitable because we can get 4 subnets and choose any 3
subnets for the coffee. Let me circle this whole column with the subnet 4, and
ignoring all other columns because we can get our answers just from this column, or
these three numbers. 4 means a subnets, 64 means each subnet will have 64 total
host IDs including network ID and broadcast ID, and /26 is the new subnet mask for
these 4 subnets.
Subnet 1 2 4 8 16 32 64 128 256
Subnet /24 /25 /26 /27 /28 /29 /30 /31 /32
Mask
The first network ID is always the original network ID: 192.168.4.0.
We get next network ID by simply adding 64 to its previous one, therefore, the
second network ID would be 0+64, which is 64. The third network ID would be
64+64, which is 128. The fourth network ID is 128+64, which is 192.
Now subnets Mask for each subnet is /26.
Number of Usable host: each subnet have 64 host id , but 64 is the total number of
host IDs for each network, but the first host ID is reserved for network ID, and last
host ID is reserved for broadcast ID. Thus, the number of usable host ID is 64 – 2,
which is 62
192.168.00000100.00000000
255.255.11111100.00000000
192.168.4.0
192.168.7.255
8 new subnet
Network ID Subnet Mask Host ID Rnage Nb of usable Host Broadcast ID
192.168.4.0 /27 30 192.168.
192.168.4.32 30
192.168.4.64 30
192.168.4.96 30
192.168.4.128 30
192.168.4.160 30
192.168.4.192 30
192.168.4.224
192.168.5.0 30
CLASSFUL VS CIDR
ANA, or the Internet Assigned Numbers Authority, is responsible for allocating
the entire IP address space to any entity that needs a presence on the Internet
(0.0.0.0 – 255.255.255.255).
IANA has delegated this responsibility to five Regional Internet Registries
(RIRs): ARIN, RIPE, LACNIC, AFRINIC, APNIC, which in turn allocate address
space to the various corporations in their regions.
There are two strategies the RIRs use to allocate IP address space: the legacy
strategy called Classful addressing, and the current strategy of Classless
addressing (known as Classless Inter-Domain Routing, or CIDR).
Classful
Classful addressing is how the early Internet was formed. IP assignments were given on the Octet boundaries:
The idea behind Classful address assignments was, if you were a company that …
… needed 200 IP addresses, a /24 IP address block from the Class C range would be assigned.
… needed 50,000 IP addresses, a /16 IP address block from the Class B range would be assigned.
… needed over 65,000~ IP addresses, a /8 IP address block from the Class A range would be assigned.
However, this led to a lot of wasted IP addresses. If, for instance, you only needed 300 IP addresses, a Class C would not suffice, so
you would end up with a Class B and nearly 60,000 IP addresses would be wasted.
You could argue, why not simply assign two /24 blocks from the Class C range (providing 512 IP addresses)? Good point, and this
frequently was done. But what if you needed 25,000 IP addresses? That would require 98 different /24 blocks from the Class C
range. Instead, a single Class B was assigned — which still meant about 40,000 IP addresses were wasted.
Classful addressing evolved into what we know of as Classless Inter-Domain Routing, or CIDR.
CIDR
With Classless Inter-Domain Routing (CIDR), IP assignments are not limited to the three classes. The whole unicast range (any IP address
with a first octet of 0 – 223) can be allocated in any size block. In effect, the whole concept of IP address classes is done away with
entirely.
Instead of requiring the IP assignment from the RIRs to be either a 255.0.0.0 or 255.255.0.0 or 255.255.255.0 block, they could be
any size — and for simplicity, slash notation was adopted.
If you need 300 IP addresses … You get a /23.
If you need 500 IP addresses … You also get a /23.
If you need 1000 IP addresses … You get a /22.
If you need 25,000 IP addresses … You get a /17.
If you need 70,000 IP addresses … You get a /15.
If you need 250,000 IP addresses … You get a /14 (instead of the ~16 million IP addresses from the /8 block that would have been
assigned in the Classful world).
This creates a system in which IP address ranges are assigned with a much, much smaller rate of wasted IP addresses.
CIDR address assignment was ratified in RFC 1518, back in September of 1993. Making it the ubiquitous standard for the last 26
years (if you’re reading this in 2019).
The concept of Classful address assignment is useful to know from a historical perspective. But in reality, nowhere in the world is Classful
addressing still employed.
The rare exception, however, is certain archaic protocols or devices which operate “classfully”. This means they assume a mask based
upon the IP address, according to the IP address’s class. For example, if a classful protocol or device is given the IP address
199.22.33.4 — the first octet is 199, which means this is a Class C address, and the Subnet Mask is assumed to be 255.255.255.0.