You are on page 1of 28

Computer Network

IP ADDRESSING & SUBNETTING


Task

Basics of IP Addressing
Exercise on IP Address
Addressing
What is Addressing ?

 Addressing means identification. In order to identify a house we use the address of the
house. Similarly to identify a computer an address is used.
 In TCP/IP there are three different levels of addresses.

 The physical address and logical address are used to identify a computer. The port
address is used to identify a process or program that runs in the computer. (Not the
Input/Output Ports).
Physical Address

 The physical address is in the Network Interface Card (NIC). It is a hardware setting and
normally we cannot change that setting and it was set by the manufacturer of NIC. This is also
called the MAC address.

 For Ethernet, the MAC address is a 48 bit or 12 Hex number (one Hex number is 4 bits).

 Example of a physical address is, 


5AB387F1937C
 
 The MAC address operates in the Data Link Layer (Layer 2).
Logical Address

 The widely used protocol is TCP/IP and the logical address is called IP Address.
(The logical address operates in the Network Layer-Layer 3).
IP Address

 There are two versions of IP Addresses. IP version 4 (IPv4) and IP version 6


(IPv6).
 IPv4 is a 32-bit scheme and IPv6 is a 128-bit scheme.
 32 bits of IPv4 is divided into 4 octal
 Its in decimal format
 Ex: 192.168.1.1
Octal range is 0-255 , 256 numbers
IP Version 4 (IPv4)

 The 32 bits are represented in following manner. Byte 1. Byte 2. Byte 3. Byte 4
 
 one byte is 8 bits

 The minimum value of a byte is 00000000=0

 The maximum value of a byte is 11111111=255

 Therefore, the minimum and maximum IP Addresses are,

 and 255.255.255.255
 (This is called the dotted decimal representation)
Network ID and Host ID

 The network address is same as the telephone number system. We have the
flexibility to have a telephone number system in a logical way. For instance all
numbers in Kandy area starts with 081 Area Code. Therefore, if we get a call from
Colombo to Kandy the Colombo Exchange analyzes the first three digits only.
Then it can decide the correct route. Similarly all the exchanges up to Kandy
analyze only the first 2 digits only. Therefore, the processing and routine becomes
simpler.

Telephone number - Area Code + Telephone Number

IP Addresses - Network ID + Host ID


Continue..

 IP means Identification

 Part of the IP Address is allocated to Network ID and the remaining part is


allocated to Host ID (Computer ID).
 If there are fewer networks, less number of bits can be allocated to Network ID.
Category of Classes in IPv4

 Classful addressing
 Concept of classes . A, B, C, D & E.
 Class A - First byte [ 0-127] , Bin 0….
 Class B – First byte [128- 191], Bin, 10….
 Class C - First byte [192-223], Bin, 110……
 Class D - First byte [224-239], Bin, 1110…..
 Class E - First byte[240-255], Bin, 1111….
 252.5.15.111 – Class E
 14.23.120.8 - Class A
 Not: in classful addressing, a large part of the available addresses were wasted.
 Classless addressing
Classful
Three type classes of IP Address
 Example:

 Suppose a particular address scheme has only 8 bits. If 3 bits allocated for
Network ID (Net ID) and remaining 5 bits is allocated to Host ID.

The maximum number of Network - 23 = 8

The maximum number of Host per each network - 25 = 32

 Both in Network ID and Host ID all 0s and all 1s are reserved for special
purposes.
Therefore, the actual maximum no. Networks = 23 - 2 = 6

The actual maximum no. of Hosts per Network =25 - 2 = 30


Continue..
Network Address

 For the Network Address, the Host ID part of the IP Address will be considered as
0

Eg: 103.58.35.1      

  This is a Class A address    

  Therefore, Net ID is = 103


  Host ID is = 58.35.1

  Network Address is = 103.0.0.0

  153.105.25.10      
  This is a Class B Address    

  Therefore, Net ID is = 153.105


  Host ID is = 25.10

  Network Address is = 153.105.0.0


Network Address of IP Addresses
Classless Addressing

 Why
 Wastage in the Classful IP Addresses
 Efficiently using the IP addresses
Mask (Default Mask)

 The mask can help us to find the netid and the host id
 The mask is in the form /n where n can be 8, 16 or 24 in classful addressing
 /n this notation is also called slash notation or Classless Inderdomain Routing
(CIDR)

 Class A - 255.0.0.0
 Class B -255.255.0.0
 Class C – 255.255.255.0
Classless addressing

 However, In classless addressing the mask for a block (range) can take any value
from 0 to 32
 The address and the /n notation completely define the whole block(first address ,
last address and the number of addresses)
 First address in the block can be found by setting the rightmost 32-n bits to 0s.
 The last address in the block can be found by setting the rightmost 32-n bits to 1s.
 The number of addresses in the block can be found by using the formula 2^(32-n)
Subnetting

 Break a large network into many smaller network is called subnetting


 Need a router to connect these subnetwork
 Now the IP address is divided into three parts.
Net ID Subnet ID Host ID

 The original Net ID number of bits is not changed.


 Part of “Host ID” is allocated as the “Subnet ID”.
Class c Subnetting
 Net.net.net.host
 Default mask 255.255.255.0
 Default mask have 8 bits are 0’s . That’s why no of host per network is 2^8 -2= 254
 If we reduce the number of 0’s automatically number of 1’s will increase and number of host
is reduce
 255.255.255.0
0= 0000 0000
128= 1000 0000
192= 1100 0000
224= 1110 0000
240=1111 0000
248=1111 1000
252=1111 1100
254=1111 1110
Now default mask became subnet mask
Continue..

 Class C network 200.100.10.0 with subnet mask 255.255.255.192 . Calculate


1. Number of subnetwork
2. Number of host per subnet
3. Valid IP Range
Exercise 2

 Class B network 172.16.0.0 with 255.255.254.0. calculate


1. Number of subnetwork
2. Number of host per subnet
3. Valid IP Range
Exercise 3

 Find the subnet for the given IP Address


1. 172.16.2.80/27
2. 10.5.26.50/16
3. 200.100.10.135/26
Type of IP Address

 Public IP
 Public IP id defined over Internet

 Private IP
If we have a network which is not connected to Internet (not a part of
Internet) any IP address range can be used without obtaining any permission
IPv6 Addresses

 Why .
 Despite all short term solutions such as classless addressing, DHCP, Network Address
Translation (NAT), address depletion is still a long term problem for the internet
IPv6 Structure

 An IPv6 address consists of 16 bytes ; it is 128 bits long


 IPv6 specifies hexadecimal colon notation
 128 bits = 16 bytes = 32 hex digits
 FDEC:0074:0000:0000:B0FF:0000:FFFF
 FDEF – 1111 1101 1110 1100
 FFFF – 1111 1111 1111 1111

 Abbreviated IPv6 address


 Original - FDEC:0074:0000:0000:B0FF:0000:FFFF
 Abbreviated - FDEC:74:0:0:B0FF:0:FFFF
 More abbreviated - FDEC:74::B0FF:0:FFFF

You might also like