Computer Network 2
Computer Network 2
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)
Ethernet
frame 1
What is an IP Address?
• 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.
4
Octets
5
Thinking in
Binary
•The binary system uses only 2 values “0
& 1” to represent numbers in
positions representing increasing
powers of 2.
7
Converting to Decimal
8
Converting to Decimal (Cont.)
• What then do you suppose is the largest decimal number that can be
expressed in an octet?
9
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
10
Dotted Decimal Notation
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
12
Example
• Example: ellington.cs.virginia.edu
128.143 137.144
• Prefix notation:
128.143.137.144/16
• Network prefix is 16 bits long
13
Classful and Classless IP Addressing
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
28
Network mask and subnetwork mask
29
Challenge with IPv4 address
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
33
Subnetting
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
36
Solution (Continued)
37
Solution (Continued)
38
Figure 5-8
Example 3
39
Example 4
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