Data Communication and Networks: Department of Computer Science Najran University

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 70

Data Communication and Networks

Department of Computer Science


Najran University
Network Addresses

2
IPv6 Addresses
• Motivation for a new version of IP: scaling problems caused by
the Internet’s massive growth.
• IETF began looking into an expansion of the IP address space
in 1991.
• Larger address space.
• Support for real-time services.
• Security support.
• Autoconfiguration (i.e., ability of hosts to automatically
configure themselves with information such as IP address and
domain name).
• IPv6 uses 128-bit addresses.
• Even based on pessimistic estimates of address assignment
efficiency, IPv6 addresses provide over 1500 addresses per
square foot of the earth’s surface.
3
IPv4 Addresses

4
Note

An IPv4 address is 32 bits long.

Note

The IPv4 addresses are unique


and universal.

5
Note

The address space of IPv4 is


232 or 4,294,967,296.

6
Figure 5.1 Dotted-decimal notation

7
Example 5.1

Change the following IPv4 addresses from binary notation to dotted-decimal


notation.
a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 11100111 11011011 10001011 01101111
d. 11111001 10011011 11111011 00001111

Solution
We replace each group of 8 bits with its equivalent decimal number and
add dots for separation:
a. 129.11.11.239
b. 193.131.27.255
c. 231.219.139.111
d. 249.155.251.15

8
Example 5.2

Change the following IPv4 addresses from dotted-decimal notation to


binary notation.
a. 111.56.45.78
b. 221.34.7.82
c. 241.8.56.12
d. 75.45.34.78

Solution
We replace each decimal number with its binary equivalent:
a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010
c. 11110001 00001000 00111000 00001100
d. 01001011 00101101 00100010 01001110

9
Example 5.3

Find the error, if any, in the following IPv4 addresses:


a. 111.56.045.78
b. 221.34.7.8.20
c. 75.45.301.14
d. 11100010.23.14.67

Solution
a. There should be no leading zeroes (045).
b. We may not have more than 4 bytes in an IPv4 address.
c. Each byte should be less than or equal to 255.
d.A mixture of binary notation and dotted-decimal notation.

10
Example 5.5

Find the number of addresses in a range if the first address is


146.102.29.0 and the last address is 146.102.32.255.

Solution
We can subtract the first address from the last address in base 256 .
The result is 0.0.3.255 in this base. To find the number of addresses in
the range (in decimal), we convert this number to base 10 and add 1 to
the result..

11
Example 5.6

The first address in a range of addresses is 14.11.45.96. If the number


of addresses in the range is 32, what is the last address?

Solution
We convert the number of addresses minus 1 to base 256, which is
0.0.0.31. We then add it to the first address to get the last address.
Addition is in base 256.

12
Figure 5.6 Finding the class of address

13
Example 5.10

Find the class of each address:


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 10100111 11011011 10001011 01101111
d. 11110011 10011011 11111011 00001111

Solution
See the procedure in Figure 5.7.
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first bit is 1; the second bit is 0. This is a class B
address.
d. The first 4 bits are 1s. This is a class E address.
14
Example 5.11

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.

15
Figure 5.8 Netid and hostid

16
Figure 5.9 Blocks in Class A

17
Note

Millions of class A addresses


are wasted.

18
Figure 5.10 Blocks in Class B

19
Note

Many class B addresses are wasted.

20
Figure 5.11 Blocks in Class C

21
Note

Not so many organizations are so small to have


a class C block.

22
Figure 5.12 The single block in Class D

23
Note

Class D addresses are made of one block, used


for multicasting.

24
Figure 5.13 The single block in Class E

25
Note

The only block of class E addresses was


reserved for future purposes.

26
Note

The range of addresses allocated to an


organization in classful addressing
was a block of addresses in
Class A, B, or C.

27
Figure 5.14 Two-level addressing in classful addressing

28
Example 5.12

29
Figure 5.15 Information extraction in classful addressing

netid 000 ... 0


First address

30
Example 5.13

An address in a block is given as 73.22.17.25. Find the number of


addresses in the block, the first address, and the last address.

Solution
Figure 5.16 shows a possible configuration of the network that uses this block.
1. The number of addresses in this block is N = 232−n = 16,777,216.
2. To find the first address, we keep the leftmost 8 bits and set the rightmost 24 bits
all to 0s. The first address is 73.0.0.0/8, in which 8 is the value of n.
3. To find the last address, we keep the leftmost 8 bits and set the rightmost 24 bits
all to 1s. The last address is 73.255.255.255.

31
Figure 5.16 Solution to Example 5.13

32
Example 5.14

An address in a block is given as 180.8.17.9. Find the number of


addresses in the block, the first address, and the last address.

Solution
Figure 5.17 shows a possible configuration of the network that uses this block.
1. The number of addresses in this block is N = 232−n = 65,536.
2. To find the first address, we keep the leftmost 16 bits and set the rightmost 16
bits all to 0s. The first address is 18.8.0.0/16, in which 16 is the value of n.
3. To find the last address, we keep the leftmost 16 bits and set the rightmost 16
bits all to 1s. The last address is
18.8.255.255.

33
Figure 5.17 Solution to Example 5.14

34
Example 5.15

An address in a block is given as 200.11.8.45. Find the number of


addresses in the block, the first address, and the last address.

Solution
Figure 5.17 shows a possible configuration of the network that uses this block.
1. The number of addresses in this block is N = 232−n = 256.
2. To find the first address, we keep the leftmost 24 bits and set the rightmost 8
bits all to 0s. The first address is
200.11.8.0/24, in which 24 is the value of n.
3. To find the last address, we keep the leftmost 24 bits and set the rightmost 8
bits all to 1s. The last address is
200.11.8.255/24.

TCP/IP Protocol Suite 35


Figure 5.18 Solution to Example 5.15

36
Note

The network address is the identifier of a


network.

37
Figure 5.20 Network addresses

38
Figure 5.21 Network mask

39
Figure 5.22 Finding a network address using the default mask

40
Example 5.16

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.

41
Example 5.17

Three-level addressing can be found in the telephone system if we


think about the local part of a telephone number as an exchange and a
subscriber connection:

in which 626 is the area code, 358 is the exchange, and 1301 is the
subscriber connection.

42
Example 5.18

Figure 5.23 shows a network using class B addresses before


subnetting. We have just one network with almost 65534 hosts.
The whole network is connected, through one single connection,
to one of the routers in the Internet. Note that we have shown /16
to show the length of the netid (class B).

TCP/IP Protocol Suite 43


Figure 5.23 Example 5.18

44
Example 5.19

Figure 5.24 shows the same network in Figure 5.23 after


subnetting. The whole network is still connected to the Internet
through the same router. However, the network has used a
private router to divide the network into four subnetworks. The
rest of the Internet still sees only one network; internally the
network is made of four subnetworks. Each subnetwork can
now have almost 214 hosts. The network can belong to a
university campus with four different schools (buildings). After
subnetting, each school has its own subnetworks, but still the
whole campus is one network for the rest of the Internet. Note
that /16 and /18 show the length of the netid and subnetids.

45
Figure 5.24 Example 5.19

46
Figure 5.25 Network mask and subnetwork mask

47
Similar to Figure 5.24 subnetting (Three –level addressing)

Host ID Usable addresses: 141.14.2.1 to


Subnet ID
141.14.2. 254

Subnet address
Addresses in a network with and without subnetting

2 21

2 21

Subnet ID
Figure 4.24 Default Mask vs Subnet Mask

A Mask is like a template indicating which part of the IP address is


the host ID.
Host id part = all 0’s

The rest = all 1’s

The host part of


the address
becomes all 0’s
A simple example

Logical
AND

Logical
AND
Figure 5.25 Network mask and subnetwork mask

Number of subnets possible? 2c = 2ni-n

Number of addresses per subnet (including 2 special


adresses? 2h = 232-ni

Number of hosts supported per subnet? 2h - 2 = 232-ni - 2

If I want s subnets, what is c? Find c so that 2c ≥ s (Or c ≥ log2s)


A more complex example: An organization with a class B address
141.14.0.0 needs 4 subnets. What’s the mask?

How many hosts can there be in each subnet?

What are the subnet addresses of each of the 4 subnets?


Figure 5.24 Example 5.19 (three-level addressing: subnetting)
141.14. 01111111 11111110
141.14. 00111111 11111110
141.14. 00000000 00000001 141.14. 01000000 00000001

141.14. 10000000 00000001 141.14. 11111111 11111110

141.14. 10111111 11111110 141.14. 11000000 00000001


Masks

• In classful addressing, the mask for


each block is implicit
– 255.0.0.0/8
– 255.255.0.0/16
– 255.255.255.0/24
• In classless addressing, we need the
address and the mask to find the block
the address belongs to

55
Figure 5.2 Format of classless addressing address

An address in classless addressing usually has this format:

The n after the slash defines the number of bits that are the
same in every address in the block. So if n is 20, it means
the twenty leftmost bits are identical in each address.

56
Prefix and Prefix Length

• Two terms often used in classless


addressing
– Prefix – another name for the common part of
the address range (netid)
– Prefix length – the length of the prefix

57
Table 5.1 Prefix lengths

The addresses in color are the default masks for classes A, B, and C.
Thus, classful addressing is a special case of classless addressing.

58
Example 4 - Find first address

What is the first address in the block if one of the


addresses is 167.199.170.82/27?

TCP/IP Protocol Suite 59


Example 4 - Find first address

What is the first address in the block if one of the


addresses is 167.199.170.82/27?

Solution
The prefix length is 27, which means that we must keep
the first 27 bits as is and change the remaining bits (5)
to 0s. The following shows the process:
Address in binary: 10100111 11000111 10101010 01010010
Keep the left 27 bits: 10100111 11000111 10101010 01000000
Result in CIDR notation: 167.199.170.64/27
60
Example 5 – Find first address Using
binary

What is the first address in the block if one of the


addresses is 140.120.84.24/20?

TCP/IP Protocol Suite 61


Example 5 – Find first address Using
binary

What is the first address in the block if one of the


addresses is 140.120.84.24/20?

Solution
Figure 5.3 shows the solution. The first, second, and
fourth bytes are easy; for the third byte we keep the bits
corresponding to the number of 0s in that group. The
first address is 140.120.80.0/20.

See Next Slide

TCP/IP Protocol Suite 62


Example 6 – Find first address Another solution
method
Find the first address in the block if one of the
addresses is 140.120.84.24/20.

TCP/IP Protocol Suite 63


Example 6 – Find first address Another solution
method
Find the first address in the block if one of the
addresses is 140.120.84.24/20.
Solution
The first, second, and fourth bytes are as defined in the
previous example. To find the third byte, we write 84 as
the sum of powers of 2 and select only the leftmost 4 (m
is 4) as shown in Figure 5.4. The first address is
140.120.80.0/20.

See Next Slide

TCP/IP Protocol Suite 64


Figure 5.4 Example 6

65
Example 5 – Find first address Using
binary

What is the first address in the block if one of the


addresses is 140.120.84.24/20?

Solution
Figure 5.3 shows the solution. The first, second, and
fourth bytes are easy; for the third byte we keep the bits
corresponding to the number of 1s in that group. The
first address is 140.120.80.0/20.

See Next Slide

TCP/IP Protocol Suite 66


Figure 5.3 Example 5

TCP/IP Protocol Suite 67


Example 6 – Find first address Another solution
method
Find the first address in the block if one of the
addresses is 140.120.84.24/20.

TCP/IP Protocol Suite 68


Example 6 – Find first address Another solution
method
Find the first address in the block if one of the
addresses is 140.120.84.24/20.
Solution
The first, second, and fourth bytes are as defined in the
previous example. To find the third byte, we write 84 as
the sum of powers of 2 and select only the leftmost 4 (m
is 4) as shown in Figure 5.4. The first address is
140.120.80.0/20.

See Next Slide

TCP/IP Protocol Suite 69


Figure 5.4 Example 6

70

You might also like