CSE331 L2 - IP Addressing - Network - Layer
CSE331 L2 - IP Addressing - Network - Layer
Imran Hossen
Adj. Lecturer, Dept. of CSE
Sonargaon University
E-mail: [email protected]
Contact: 01521234690/01729154878
IP Addresses
32 bits
version header Type of Service/TOS Total Length (in bytes)
(4 bits) length (8 bits) (16 bits)
flags
Identification (16 bits) Fragment Offset (13 bits)
(3 bits)
TTL Time-to-Live Protocol
Header Checksum (16 bits)
(8 bits) (8 bits)
Ethernet frame
2
What is an IP Address?
• An IP address:
- is a 32 bit long identifier
- encodes a network number (network prefix)
and a host number
3
The address space of IPv4 is
232 or 4,294,967,296.
4
Number System
• You can probably work with decimal numbers much easier than with
the binary numbers needed by the computer.
5
Octets
6
Thinking in Binary
7
Thinking in Binary (Cont.)
8
Converting to Decimal
9
Converting to Decimal (Cont.)
• What then do you suppose is the largest decimal number that can be
expressed in an octet?
10
Converting to Decimal (Cont.)
27 26 25 24 23 22 21 20
1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1
11
Dotted Decimal Notation
• IP addresses are written in a so-called dotted decimal notation
• Each byte is identified by a decimal number in the range [0..255]:
Example:
10000000 10001111 10001001 10010000
1st Byte 2nd Byte 3rd Byte 4th Byte
= 128 = 143 = 137 = 144
128.143.137.144
12
Network prefix and Host number
13
Example
• Example: ellington.cs.virginia.edu
128.143 137.144
14
Classful and Classless IP Addressing
17
Network mask
18
Classify and Define IPv4 Addresses
• Identify the historic method for assigning
addresses and the issues associated with the
method
19
Example
Find the class of each address:
a. 227.12.14.87
b. 193.14.56.22
c. 14.23.120.8
d. 252.5.15.111
20
Example
Find the class of each address:
a. 227.12.14.87
b. 193.14.56.22
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 193 (between 192 and 223); the class is C.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
21
Finding a network address using the default mask
22
Example
A router receives a packet with the destination address
201.24.67.32. Show how the router finds the network address of
the packet.
Solution
Since the class of the address is C, we assume that the router
applies the default mask for class C, 255.255.255.0 to find the
network address.
23
Problem
25
Subnetting: Advantages
26
Subnetting
27
Network mask and subnetwork mask
28
Challenge with IPv4 address
30
Subnetting
• 192.168.1.0 /24
-24 bit is NW portion
-8 bits is Host portion
-I can borrow from the Host portion
• How many bits?
-2n ≥ # of subnets required
-n = # of bits to borrow
• So for our example we need to borrow:
-2n ≥ 2
-Therefore n=1 (we need to borrow 1 bit)
31
Subnetting
32
Subnetting
33
Another Subnetting exercise
• You have 192.168.1.0 /24 and want 6 subnets
• Calculate
-6 subnets with prefix
-Broadcast address for each subnet
-Host range for each subnet
34
Acknowledgement
1. Data Communication and Networking, B. A. Forouzan et. al., Tata McGraw-Hill, 2nd
Edition, 2000.
2. Data and Computer Communication, W. Stallings, Prentice Hall of India, 5th Edition,
1997.
3. Prof. Dr. Md. Al Mehedi Hasan, Dept. of CSE, RUET
4. Abu Said Md. Rezoun, Lecturer, CSE, SU
35