Advanced Computer Networks Chapter 3
Advanced Computer Networks Chapter 3
com
To introduce the concept of an address space in general and the address space of IPv4 in particular To discuss the classful architecture To discuss the idea of hierarchical addressing
The identifier used in the IP layer of the TCP/IP protocol package to identify each device connected to the Internet address or IP address An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a host or a router to the Internet
A protocol like IPv4 that defines addresses has an address space An address space is the total number of addresses used by the protocol
Binary notation
10001111 10011001 10101000 11100011
Dotted-Decimal Notation
128 . 11 . 3 . 31
We often need to deal with a range of addresses instead of one single address We sometimes need to find the number of addresses in a range if the first and last address is given Example: Find the number of addresses in a range if the first address is 146.102.32.0 and the last address is 146.102.32.255
IP addresses used the concept of classes This architecture is called classful addressing In the mid-1990, a new architecture called classless addressing was introduced We start with classful addressing
In classful addressing, the IP address space is divided into five classes: A, B, C, D, and E Each class occupies some part of the whole address space
A: 231, forms 50% B: 230, forms 25% C: 229, forms 12.5% D: 228, forms 6.25% E: 228, forms 6.25%
Class A:
Octet 1 0.. Binary notation Octet 2 Octet 3 Octet 4
Byte 1 0-127
Byte 2
Byte 3
Byte 4
Dotted-decimal notation
10
Class B:
Octet 1 10.. Binary notation Octet 2 Octet 3 Octet 4
Byte 1 128-191
Byte 2
Byte 3
Byte 4
Dotted-decimal notation
11
Class C:
Octet 1 110.. Binary notation Octet 2 Octet 3 Octet 4
Byte 1 192-223
Byte 2
Byte 3
Byte 4
Dotted-decimal notation
12
Class D:
Octet 1 1110.. Binary notation Octet 2 Octet 3 Octet 4
Byte 1 224-239
Byte 2
Byte 3
Byte 4
Dotted-decimal notation
13
Class E:
Octet 1 1111.. Binary notation Octet 2 Octet 3 Octet 4
Byte 1 240-255
Byte 2
Byte 3
Byte 4
Dotted-decimal notation
14
a. b. c. d.
15
In classful addressing, an IP address in classes A, B, and C is divided into netid and hostid These parts are of varying lengths, depending on the class of the address
16
Byte 1
Byte 2
Byte 3
Byte 4
Class A
Netid
Hostid
Class B
Netid
Hostid
Class C
Netid
Hostid
Class D
Multicast address
Class E
17
A block is a range of addresses. Given any address in the block, we normally like to know three pieces of information about the block: 1. The number of addresses 2. The first address 3. The last address
18
In order to extract these pieces of information, we need to do the following: 1. The number of addresses in block N, can be found using N = 232-n 2. To find the first address, we keep the n leftmost bit and set the (32-n) rightmost bits all to 0s 3. To find the last address, we keep n leftmost bits and set the (32-n) rightmost bits all to 1s
19
n bits
netid
(32-n) bits
hostid
Class A: n = 8 Class B: n =16 Class C: n=24
netid
First address
0000
netid
Last address
1111
20
Example 1: 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. Example 2: 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.
21
The network address is particularly important because it is used in routing a packet to its destination network The network address is actually the identifier of the network Each network is identified by its network address
22
The routers in the Internet usually use an algorithm to extract the network address from the destination address of a packet, to do this, we need a network mask A network mask or a default mask in classful addressing is a 32-bit number with n leftmost bits all set to 1s and (32-n) rightmost bits all set to 0s Since n is different for each class in classful address, we have three default masks in classful addressing
23
24 bits
00000000 00000000 00000000
16 bits
16 bits
00000000 00000000
11111111 11111111
8 bits
00000000
24
To extract the network address from the destination address of a packet, a router uses the AND operation When the destination address is ANDed with the default mask, the result is the network address The default mask can be used to find the number of addresses in the block and the last address in the block
25
Destination address
10010101101
10010101101
Default Mask
AND
100101010000
Network address
26
Example: A router receives a packet with the destination address 201.24.67.32. Show how the router find the network address of the packet.
27
The IP addresses were originally designed with two levels of addressing To reach a host on the Internet, we must first reach the network and then the host There is a great demand to have more than two addresses The idea of splitting a block to smaller blocks is referred to as subnetting In subnetting, a network is divided into several smaller subnetworks (subnets) with each subnetwork having its own subnetwork address
28
Consider the following example shown below which shows a network using class B addresses before subnetting
141.14.0.2 141.14.0.27 141.14.255.253 141.14.255.254
141.14.0.1
Switch
Network: 141.14.0.0/16
Internet router
29
141.14.0.1
141.14.31.29
141.14.63.254
141.14.64.1
141.14.90.27
141.14.127.254
Subnet 1 141.14.0.0/18
141.14.128.1 141.14.142.37 141.14.191.254
Subnet 2
141.14.64.0/18
141.14.192.1 141.14.223.47 141.14.255.254
Subnet 3
Subnet 4 141.14.192.0/18
141.14.128.0/18
Site router
141.14.0.0/16
Internet router
30
The network mask discussed before is used when a network is not subnetted When we divide the network into several subnetworks, we need to create a subnetwork mask (or subnet mask) for each subnetwork A subnetwork has subnetid and hostid Subnetting increases the length of the netid and decreases the length of hostid We can divide the network into s number of subnetworks
31
in which n is the length of netid, nsub is the length of each subnetid, and s is the number of subnets which must be a power of 2
32
n bits
32 - n bits
hostid
Change
Network mask
netid
subnetwork mask
subnetid
hostid
33
Example: consider a network is divided into four subnetworks in class B. Show the format of the subnetwork mask.
34
When a network is subnetted, the first address in the subnet is the identifier of the subnet and is used by the router to route the packets destined for that subnetwork Given any address in the subnet, the router can find the subnet mask using the same procedure discussed in the network mask
35
Example: Assume a network is divided into four subnets. Since the address in subnet 2 is 141.14.120.77. Find the subnet address.
36
In supernetting, an organization can combine several class C blocks to create a larger range of addresses In other words, several networks are combined to create a supernetwork An organization can apply for several class C blocks instead of just one
37
A supernet mask is the reverse of a subnet mask A subnet mask for class C has more 1s than the default mask for this class A supernet mask for class C has less 1s than the default mask for this class In supernetting, the number of class C addresses that can be combined to make a supernet needs to be a power of 2
38
Subnet mask
Default mask
00000000
n= 24
Supernet mask
000 00000000
nsuper= 24 3 = 21
39
Supernetting provides two main problems: 1. The number of blocks to combine needs to be a power of 2, which means an organization that needed seven blocks should be granted at least eight blocks (address wasting) 2. Supernetting and Subnetting really complicated the routing of packets in the Internet
40
Subnetting and supernetting in classful addressing did not really solve the address depletion problem and made the distribution of addresses and the routing process more difficult With the growth of the Internet, it was clear that a larger address space was needed as a longterm solution The larger address space requires that the length of the IP addresses to be increased That means, the format of the IP packets needs to be changed
41
The class privilege was removed from the distribution to compensate for the address depletion In 1996, the Internet authorities announced a new architecture called classless addressing In classless addressing, variable-length blocks are used that belong to no classes We can have a block of 1 address, 2 addresses, 4 addresses,128 addresses, and so on
42
In classfull addressing the whole address space was divided into five classes Classes D & E were reserved for special purpose In classless addressing, the whole address space is divided into variable length blocks Theoretically, we can have a block of 20, 21, 22, 232 addresses The only restriction is that the number of addresses in a block needs to be a power of 2
43
In classless addressing the block is actually divided into two parts: the prefix and suffix The prefix plays the same role as the netid The suffix plays the same role as the hostid All addresses in the block have the same prefix, while each address has a different suffix
44
In classful addressing, the length of the netid n depends on the class of the address, it can be only 8, 16, 24 In classless addressing, the length of the prefix n depends on the size of the block, it can be 0, 1, 2, 3, .. 32
Network
Prefix
Host
Suffix
n bits
(32-n) bits
45
Example: What is the prefix length and suffix length if the whole Internet is considered as one single block with 4,294,967,296 addresses?
46
In classful addressing, the netid length is inherent in the address. Given an address, we know the class of the address In classless addressing, the prefix length can not be found if we are given only an address in the block. The given address can belong to a block with any prefix length
byte . byte . byte . byte / n
Prefix length
47
The slash notation is formally referred to as classless interdomain routing or CIDR In classless addressing, we need to know the one of the addresses in the block and the prefix length to define the block
48
The idea of network mask in classless addressing is the same as the one in classful addressing A network mask is a 32-bit number with the n leftmost bits all set to 1s and the rest of the bits all set to 0s
49
Example: Give the network mask for the following addresses: a. 12.23.24.78/8 b. 130.11.232.156/16 c. 167.199.170.82/27
50
An address in slash notation (CIDR) contains all information we need about the block: the first address(network address), the number of addresses, and the last address 1. The number of addresses in the block can be found as:
N = 232-n
where n is the prefix, and N is the number of addresses in the block
51
2. The first address (Network address) in the block can be found by ANDing the address with the network mask:
First Address = (any address) AND (network mask)
52
3. The last address in the block can be found by either adding the first address with the number of addresses, or directly, by Oring the address with the complement (NOTing) of the network mask
Last address = (any address) OR [NOT(network mask)]
53
Example 1: One of the addresses in a block is 167.199.170.82/27. Find the number of addresses in the network, the first address, and the last address Example 2: One of the addresses is 17.63.110.114/24. Find the number of addresses, the first address, and the last address in the block
54
The responsibility of block allocation is given to a global authority called the Internet Corporation for Assigned Names and Addresses (ICANN) However, ICANN does not normally allocate addresses to individual Internet users. It assigns a large block of addresses to an ISP
55
For the proper operation of the CIDR, three restrictions need to be applied to the allocated block. 1. The number of requested addresses, N, needs to be a power of 2 2. The value of the prefix length can be found from the number of addresses in the block 3. The requested block needs to be allocated where there are a contiguous number of unallocated addresses in the address space. The beginning address must be divisible by the number of addresses
56
Example: Which of the following can be the beginning address of a block that contains 16 addresses? A. 205.16.37.36 B. 190.16.42.44 C. 17.17.33.80 D. 123.45.24.52
57
Example: Which of the following can be the beginning address of a block that contains 256 addresses? A. 205.16.37.36 B. 190.16.42.0 C. 17.17.33.0 D. 123.45.24.52
58
59
All issues discussed for classless addressing can be applied to classful addressing The classful addressing is a special case of the classless addressing in which the blocks in class A, B, and C have the prefix length nA=8, nB=16, nC=24 A block in classful addressing can be easily changed to a block in class addressing
60
Three levels of hierarchy can be created using subnetting An organization that is granted a range of addresses may divide the range into several subranges and assign each subrange to a subnetwork (or subnet) A subnetwork can be divided into several sub-subnetworks. A sub-subnetwork can be divided into several sub-sub-subnetworks. And so on
61
The subnetwork in a network should be carefully designed to enable the routing of packets We assume the total number of addresses granted to the organization is N, the prefix length is n, the assigned number of addresses to each subnetwork is Nsub, the prefix length for each subnetwork is nsub, and the total number of subnetworks is s
62
The following steps need to be carefully followed to guarantee the proper operation of the subnetworks: 1. The number of addresses in each subnetwork should be a power of 2 2. The prefix length for each subnetwork should be found using the following formula: nsub= n + log2(N/Nsub) 3. The starting address in each subnetwork should be divisible by the number of addresses in that subnetwork.
63
Example: An organization is granted the block 130.34.12.64/26. The organization needs four subnetworks, each with an equal number of hosts. Design the subnetworks and find the information about each network.
64
Example: An organization is granted a block of addresses with the beginning address 14.24.74.0/24. the organization needs to have 3 subblocks of addresses to use in its three subnets as shown below: One subblock of 120 addresses One subblock of 60 addresses One subblock of 10 addresses
65
One of the advantages of CIDR architecture is address aggregation ICANN assigns a large block of addresses to an ISP Each ISP in turn divides its assigned block into smaller subblocks and grants the subblocks to its customers Many blocks of addresses are aggregated in one block and granted to one ISP.
66
All-Zeros address
0.0.0.0/32, which contains only one single address, is reserved for communication when a host needs to send an IPv4 packet but it does not know its own address
67
68
Loopback Addresses
The block 127.0.0.0/8 is used for the loopback address, which is an address used to test the software on a machine When this address is used, a packet never leaves the machine, it simply returns to the protocol software It can be used to test the IPv4 software For example: an application such as ping can send a packet with a loopback address as the destination address to see if the IPv4 is capable of receiving and processing a packet.
69
Private Addresses
A number of blocks are assigned for private use They are not recognized globally
70
Some addresses in a block are used for special addresses These addresses are not assigned to any host However, if a block (or subblock) is so small, we cannot afford to use part of the addresses as special addresses
71
A. Network Address The first address (with the suffix set all to 0s) in a block defines the network address It actually defines the network itself and not any host in the network
72
B. Direct Broadcast Address The last address in a block or subblock (with the suffix set all to 1s) can be used as a direct broadcast address This address is usually used by a router to send a packet to all hosts in a specific network All hosts will accept a packet having this type of destination address Note that this address can be used only as a destination address in an IPv4 packet
73
In most situations, only a portion of computers in a small network need access to the Internet simultaneously. This means that the number of allocated addresses does not have to match the number of computers in the network For example, assume a small business with 20 computers in which the maximum number of computers that access the Internet simultaneously is only 5. Most of the computers are either doing some task that does not need Internet access. This small business can use the TCP/IP protocol for both internal and universal communication.
74
A technology that can provide that mapping between the private and universal addresses, and at the same time, support virtual private networks is network address translation (NAT) The technology allows a site to use a set of private addresses for internal communication and a set of global Internet addresses (at least one) for communication with the rest of the world
75
All of the outgoing packets go through the NAT router, which replaces the sources address in the packet with the global NAT address All incoming packets also pass through the NAT router, which replaces the destination address in the packet with the appropriate private address
76