Ip Adressing
Ip Adressing
It helps identify
the device so it can send and receive information.
● Example: 192.168.1.10.
● Parts of an IP Address:
○ Network Part: Identifies the "street" (or network).
○ Host Part: Identifies the "house" (or device) on that street.
● Purpose:
Helps devices find each other in a network (like finding someone’s house on a map).
2. Subnet Mask
● What is it?
A subnet mask is a tool used to "divide" an IP address into two parts:
○ The Network Part: Tells which network the device belongs to.
○ The Host Part: Tells which specific device on that network you’re talking to.
● Example: 255.255.255.0.
○ 255 means "this part belongs to the network."
○ 0 means "this part belongs to the host."
● Purpose:
Helps the device figure out which part of an IP address is for the network and which part is
for the individual device. Without it, devices wouldn't know how to organize or
communicate in a network.
3. Default Gateway
● What is it?
The default gateway is like the "door" to leave your house and go to a different street
(network). It’s the IP address of a router that connects your local network to other
networks, including the internet.
● Example: 192.168.1.1.
● Purpose:
○ If your device needs to send data to another network (e.g., access a website), it
sends the data to the default gateway first.
○ The router (gateway) figures out where to send the data next.
IP Addressing Basics
● An IP address is made up of 32 bits (for IPv4), typically written as four decimal numbers
separated by dots (e.g., 192.168.1.1). Each of these numbers is called an octet, since each
represents 8 bits (1 byte).
For example, the IP address 192.168.1.1 in binary would look like this:
Copy code
11000000.10101000.00000001.00000001
2. Subnet Masks
A subnet mask helps determine which part of the IP address refers to the network and which part
refers to the host (the devices on the network).
● A common subnet mask for Class C networks is 255.255.255.0, or in CIDR notation, /24, which
means the first 24 bits of the IP address are for the network, and the remaining 8 bits are for
host addresses.
In /24, the first 24 bits (11111111.11111111.11111111) are fixed for the network, and the last 8 bits
(00000000) are available for devices or hosts.
3. Subnetting
Subnetting divides a larger network into smaller, more manageable sub-networks (subnets).
For example, you have a network 192.168.22.0/24, and you want to break it down into smaller
subnets. Subnetting allows you to do that by borrowing bits from the host part to create more
networks (subnets).
Example: 192.168.22.0/26
In this case, /26 means that the first 26 bits are used for the network, and the remaining 6 bits are for
hosts.
So the 192.168.22.0/26 network is divided into 4 subnets. Here's how we get that:
● There are 2 bits available for subnetting because we borrowed 2 bits from the host portion (8
host bits in a /24, but only 6 remain in a /26).
● Formula for number of subnets: 2^(number of borrowed bits)
So, 2^2 = 4 subnets.
4. Subnet Calculation
Subnet Ranges:
Each subnet created has its own network address, broadcast address, and usable host range. Let's
break this down using 192.168.22.0/26:
● Subnet 1:
○ Network address: 192.168.22.0
○ First usable address: 192.168.22.1
○ Last usable address: 192.168.22.62
○ Broadcast address: 192.168.22.63
● Subnet 2:
○ Network address: 192.168.22.64
○ First usable address: 192.168.22.65
○ Last usable address: 192.168.22.126
○ Broadcast address: 192.168.22.127
● Subnet 3:
○ Network address: 192.168.22.128
○ First usable address: 192.168.22.129
○ Last usable address: 192.168.22.190
○ Broadcast address: 192.168.22.191
● Subnet 4:
○ Network address: 192.168.22.192
○ First usable address: 192.168.22.193
○ Last usable address: 192.168.22.254
○ Broadcast address: 192.168.22.255
Each subnet, in this case, has 6 bits for hosts (because we borrowed 2 bits for the subnetting).
5. Key Terms:
● Network Address: The first IP in the range, identifying the subnet itself.
● Broadcast Address: The last IP in the range, used to communicate with all devices in that
subnet.
● Usable IPs: The IPs between the network and broadcast addresses that can be assigned to
devices (hosts).
The magic number is calculated as 256 - subnet mask (last octet). This helps determine the size of
the subnets.
For /26:
● The last octet of the subnet mask is 192 (255.255.255.192).
● Magic number: 256 - 192 = 64.
This magic number tells you the subnet increments. So, subnets increment by 64:
● 192.168.22.0
● 192.168.22.64
● 192.168.22.128
● 192.168.22.192
6. Why Subnet?
● Efficient IP management: Subnets allow you to divide large networks into smaller ones,
reducing wasted IP addresses.
● Improved performance: Smaller networks reduce broadcast traffic, improving network
performance.
● Better security: Subnetting can isolate different parts of a network for security reasons.