7/5/2015
IP Adressing 2
Engr. Albertson D. Amante
Recall, IP Addresses
TCP/IP networks use IP for the network layer protocol
IP defines 4 octet addresses
4 billion possible addresses
Usually written in the form A.B.C.D
A, B, C, and D are each 1 octet (0-255), normally written in
decimal notation
Thus, IP addresses fall in the range:
0.0.0.0 – 255.255.255.255
IP Address Classes
Class A:
bit index: 0 1-7 8-31
0 network host (machine)
Class B:
bit index: 0 1 2-15 16-31
1 0 network host
Class C:
bit index: 0 1 2 3-23 24-31
1 1 0 network host
1
7/5/2015
IP Address Classes
• Class A:
– Range: 1.0.0.0 – 126.0.0.0
– Networks: 128 max, Machines: 65537-1.6 million
– e.g. huge networks, such as large military/government organizations
(e.g. FBI), the @Home network, etc…
• Class B:
– Range: 128.1.0.0 – 191.255.0.0
– Networks: 16384 max, Machines: 257-65536
– e.g. Internet service providers (ISPs) (dial-up)
• Class C:
– Range: 192.1.0.0 – 223.255.255.0
– Networks: 2 million max, Machines: 1-256
– e.g. Small businesses
Using Subnet Masks
Example:
Address: 137.207.32.2
Subnet Mask: 255.255.0.0
Address: 10001001110011110010000000000010
Mask: 11111111111111110000000000000000
Net Address: 10001001110011110000000000000000
Network address: 137.207.0.0
IP Address Structure and Class
CLASS A – very large network / enterprise
CLASS B – mediumsize
CLASS C – small size
CLASS D – mulicast
CLASS E - experimental
2
7/5/2015
Reserved IP Address
• Directed Broadcast Address
– Used to send data to all devices on a network
– Ex. The network address 172.16.0.0
• Local Broadcast Address
• If an IP device wants to communicate with all devices on the local network
• Local Loopback Address
– 127.0.0.1
Private IP Addresses
Depending on the address class needed by an
organization, a range of internal addresses is available:
Class A: 10.0.0.0 – 10.255.255.255
Class B: 172.16.0.0 – 172.31.255.255
Class C: 192.168.0.0 – 192.168.255.255
IP routers outside a private (connection-shared)
network, will not forward datagrams designated for
addresses in these ranges
Private IP Addresses
RFC 1918 (Request for comments)
Used in local organization
3
7/5/2015
Exercise 1: Assigning IP Addressing
Instruction:
Identify the network address, host range and the broadcast address
for the given IP Address below.
IP Address Class Network Address Host Range Broadcast Range
12.0.0.0
68.12.0.0
150.25.0.0
180.25.79.0
193.25.168.0
200.150.25.71
Example: 12.0.0.0
These are actually fairly straightforward calculations. The
easiest way to do it is to depict both the ip address and the
subnet mask in binary. Take 12.0.0.0 with subnet mask
255.0.0.0 listed in binary:
ip address: 00001100.00000000.00000000.00000000
subnet mask: 11111111.00000000.00000000.00000000
If you do a binary AND between these two numbers, you get
the network address:
ip address: 00001100.00000000.00000000.00000000
subnet mask: 11111111.00000000.00000000.00000000
-----------------------------------AND
network address: 00001100.00000000.00000000.00000000
which translated back to dotted decimal notation is 12.0.0.0
To get the host portion, invert the subnet mask and again
perform a binary AND with the ip address: ip address:
00001100.00000000.00000000.00000000
inverted subnet mask:
00000000.11111111.11111111.11111111
-----------------------------------AND
host portion: 00000000.00000000.00000000.00000000
which translated back to dotted decimal notation is 0.0.0.0
4
7/5/2015
To obtain the broadcast address, again it is simplest to look at
it in binary. Take the inverted subnet mask and perform a
binary XOR with the network address: network address:
00001100.00000000.00000000.00000000
inverted subnet mask:
00000000.11111111.11111111.11111111
-----------------------------------XOR
broadcast address:
00001100.11111111.11111111.11111111
which translated back to dotted decimal notation is
12.255.255.255
Example: 68.12.0.0
To create the subnet mask, first remember that the purpose
of the subnet mask is to separate the (32 bit) ip address into
the network prefix and the host number. If a bit in the subnet
mask is 1, the corresponding bit in the IP address is part of
the network address; if the bit in the subnet mask is 0, the
corresponding bit in the IP address is part of the host
address.
First depict the ip address in binary. Take 68.12.0.0 and
convert to binary:
ip address: 01000100.00001100.00000000.00000000
First we determine what class of address it is:
If the first bit is 0 it is a Class A address
If the first two bits are 10 it is a Class B address
If the first three bits are 110 it is a Class C address
If the first four bits are 1110 it is a Class D multicast address
If the first four bits are 1111 it is a Class E experimental
address
5
7/5/2015
Your example is a Class A address. The default subnet mask
for a Class A address is:
subnet mask: 11111111.00000000.00000000.00000000The
formula for figuring out the number of 'network' bits in a
subnet mask is 2^n=number of subnets (2^n means '2' to the
power of 'n')Since you know the number of subnets, you
need to find 'n'.
Because you want 1 subnet(s), you want to add 0 - '1' bits to
the default subnet mask since 1 = 2 ^ 0.
This will give you the following subnet mask:
subnet mask: 11111111.00000000.00000000.00000000
Which is referred to as /8 or in dotted decimal notation as
255.0.0.0
Subnetworks
Smaller networks are easier to manage
Overall traffic is reduced
You can more easily apply network security policies
6
7/5/2015
Number of Subnets Available
To identify subnets you will borrow bits from the host ID
portion of the IP address
Number of subnets available depends on the number of bits
borrowed
One address is still reserved for the network address
Available number of subnets = 2s where s is the number of bits
borrowed
Number of Subnets Available
Number of Bits Borrowed Number of Subnets (2s)
2 bits 4
3 bits 8
4 bits 16
5 bits 32
Note: for usable subnets: subtract by 2
Exercis2 Subnetting Exercises
• Given the network 210.25.120.0 Identify the network address, host range
and broadcast address for the following subnet: Consider 4 bits borrowed.
IP Address Network Address Host Range Broadcast Address
Subnet 0
Subnet 1
Subnet 4
Subnet 6
7
7/5/2015
Possible Subnet Hosts for
a Class C Network
Network. Network.Network.Host
Number of Bits Number of Number of bits No. of Hosts
Borrowed (s) Subnets Remaining in a Possible
Possible Host (8-s)=h (2h -2)
(2s)
1
2
3
4
5
6
7
Exercise 3
• Complete the table for an IP 192.168.10.0 where 6 subnets are
required.
IP Address Network Address Host Range Broadcast Address