0% found this document useful (0 votes)
36 views38 pages

Computer Network 2

Uploaded by

R Durjoy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views38 pages

Computer Network 2

Uploaded by

R Durjoy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

IP Addresses

32
version header bits
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)

Source IP address (32 bits)

Destination IP address (32 bits)

Ethernet Header IP Header TCP Header Application data Ethernet Trailer

Ethernet
frame 1
What is an IP Address?

• An IP address is a unique global address for a network interface

• An IP address:
- is a 32 bit long identifier
- encodes a network number (network prefix)
and a host number

2
The address space of IPv4 is
232 or 4,294,967,296.

3
Number System

• You can probably work with decimal numbers much easier than with
the binary numbers needed by the computer.

• Working with binary numbers is time-consuming & error-prone.

4
Octets

• The 32-bit IP address is broken up into 4 octets, which are arranged


into a dotted-decimal notation scheme.

• An octet is a set of 8 bits & not a musical instrument.


• Example of an IP version 4:
172.64.126.52

5
Thinking in
Binary
•The binary system uses only 2 values “0
& 1” to represent numbers in
positions representing increasing
powers of 2.

• We all are accustomed to thinking &


working in the decimal system, which is
based on the number 10.
6
Thinking in Binary
(Cont.)
•To most humans, number 124
the represents 100 + 20
+ 4.
•To the computer, this number
is 1111100, which is 64 (26) + 32
(25) + 16
(24) + 8 (23) + 4 (22) + 0 + 0

7
Converting to Decimal

• You’ll need to convert binary to decimal & vice versa to compute


subnets & hosts.
• So, it’s time for a quick review lesson in binary-to-
decimalconversion.
• There are 8 bits in an octet & each bit can only be a 1 or a 0.

8
Converting to Decimal (Cont.)

• What then do you suppose is the largest decimal number that can be
expressed in an octet?

Eight 1’s (1111 1111)

9
Converting to Decimal (Cont.)

• Now, for double the money, what is its equivalent decimal


value?

27 26 25 24 23 22 21 20

1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1

The binary number 1111 1111 converts into the decimal


number:
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

10
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]:

Exam ple:
10000000 10001111 10001001 10010000
1st Byte 2nd Byte 3rd Byte 4th Byte
= 128 = 143 = 137 = 144

128.143.137.144
11
Network prefix and Host number

• The network prefix identifies a network and the host number


identifies a specific host (actually, interface on the network).

network prefix host number

• How do we know how long the network prefix is?


• The network prefix is implicitly defined (see class-based addressing)
• The network prefix is indicated by a netmask.

12
Example

• Example: ellington.cs.virginia.edu
128.143 137.144

• Network id is: 128.143.0.0


• Host number is: 137.144
• Network mask is: 255.255.0.0 or
ffff0000

• Prefix notation:
128.143.137.144/16
• Network prefix is 16 bits long

13
Classful and Classless IP Addressing

• The High Order Bits


– These are the leftmost bits in a 32 bit address

18
Classful and Classless IP Addressing

19
Classify and Define IPv4 Addresses
• Identify the historic method for assigning
addresses and the issues associated with the
method

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

21
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
e. The first byte is 227 (between 224 and 239); the class is
D.
f. The first byte is 193 (between 192 and 223); the class is
C.
g. The first byte is 14 (between 0 and 127); the class is A.
h. The first byte is 252 (between 240 and 255); the class is E.

22
Bitwise AND operation

23
Masking

24
Finding a network address using the default mask

25
Network mask

26
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 B, we assume that the router
applies the default mask for class B, 255.255.0.0 to find the
network address.

27
Subnetting

• With subnetting, IP addresses use a 3-layer hierarchy:


• Network
• Subnet
• Host

• Improves efficiency of IP addresses by not consuming an entire


address space for each physical network.
• Reduces router complexity. Since external routers do not know about
subnetting, the complexity of routing tables at external routers is
reduced.
• Note: Length of the subnet mask need not be identical at all
subnetworks.

28
Network mask and subnetwork mask

29
Challenge with IPv4 address

• I have 2 departments in my organization


-Each has about 125 hosts
-I would like to keep them in separate NWs
-I have been assigned an IP network address space of 192.168.1.0 /24
-This is one NW, and I need 2
-I cannot change the IP address NW portion
- But I can change the host portion

• Solution = Subnetting (dividing network into separate networks)


- Borrowing bits from the Host portion

31
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)

32
Subnetting

• The borrowed bits become part of my subnet mask/prefix (we borrowed


1 bit)
• Before subnetting /24 (255.255.255.0)
• After subnetting /25 (255.255.255.128)
-25 bit is NW portion & 7 bits is Host portion
• How many hosts can I have per subnet?
-2n – 2
-n = # of bits in the Host portion
• So for our example:
-2n – 2
-n=7
-Therefore we can have 126 hosts (128 – 2)
-(We needed 125)

33
Subnetting

• Our previous network was 192.168.1.0 /24


• How does our new networks look like?(two types
can be possible)
-192.168.1.00000000 /25 or 192.168.1.0 /25
-192.168.1.10000000 /25 or 192.168.1.128 /25
• And there special addresses?
- Network/subnet 192.168.1.0 /25
-Broadcast 192.168.1.01111111 or 192.168.1.127
-Host range 192.168.1.00000001 – 01111110 or .1 - .126
• So how about the other subnet – you calculate:
-Network/subnet 192.168.1.128 /25
-Broadcast 192.168.1.11111111 or 192.168.1.255
-Host range 192.168.1.10000001 – 11111110 or .129 - .254

34
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

35
Example

A company is granted the site address


201.70.64.0 (class C). The company needs
six subnets. Design the subnets.
Solution

The number of 1s in the default


mask is 24 (class C).

36
Solution (Continued)

The company needs six subnets. This number


6 is not a power of 2. The next number that is
a power of 2 is 8 (23). We need 3 more 1s in
the subnet mask. The total number of 1s in
the subnet mask is 27 (24  3).
The total number of 0s is 5 (32  27). The
mask is

37
Solution (Continued)

11111111 11111111 11111111 11100000


or
255.255.255.224
The number of subnets is 8.
The number of addresses in each subnet
is 25 (5 is the number of 0s) or 32.

38
Figure 5-8
Example 3

39
Example 4

A company is granted the site address


181.56.0.0 (class B). The company needs
1000 subnets. Design the subnets.
Solution

The number of 1s in the default mask is 16


(class B).

40
The company needs 1000 subnets. This
number is not a power of 2. The next number
that is a power of 2 is 1024 (210). We need 10
more 1s in the subnet mask.
The total number of 1s in the subnet mask is
26 (16  10).
The total number of 0s is 6 (32  26).

41
Solution (Continued)

The mask is
11111111 11111111 11111111 11000000
or
255.255.255.192.
The number of
subnets is 1024.
The number of addresses in each
subnet is 26 (6 is the number of 0s) or 64.
See Figure 5.9 42
Figure 5-9
Example 4

43

You might also like