Chapter Outline
4-1 INTRODUCTION
At the conceptual level, we can think of the global Internet as a black box network that connects millions (if not billions) of computers in the world together. At this level, we are only concerned that a message from the application layer in one computer reaches the application layer in another computer.
Message
Message
Internet
A B
4-2 SWITCHING
From the previous discussion, it is clear that the passage of a message from a source to a destination involves many decisions. When a message reaches a connecting device, a decision needs to be made to select one of the output ports through which the packet needs to be send out. In other words, the connecting device acts as a switch that connects one port to another port.
Note
In circuit switching, the whole message is sent from the source to the destination without being divided into packets.
Example 4.1
A good example of a circuit-switched network is the early telephone systems in which the path was established between a caller and a callee when the telephone number of the callee was dialed by the caller. When the callee responded to the call, the circuit was established. The voice message could now flow between the two parties, in both directions, while all of the connecting devices maintained the circuit. When the caller or callee hung up, the circuit was disconnected. The telephone network is not totally a circuit-switched network today.
Note
In packet switching, the message is first divided into manageable packets at the source before being transmitted. The packets are assembled at the destination.
10
11
12
Network
R2
Sender
4
1
2
3
Network R4
4
1 3
1
R5
2
Receiver
R3
Out of order
13
Legend
Routing table
Destination address
SA DA Data
1
2 3 4
SA DA
Data
14
Note
In a connectionless packet-switched network, the forwarding decision is based on the destination address of the packet.
15
Souce
Destination
Time
Time
Time
Time
Total delay
16
1
4
3 2 1
17
Note
In a connection-oriented packet switched network, the forwarding decision is based on the label of the packet.
18
A to B
Incoming Outgoing
Network
R1 1 3
A to B
A
2
2 4 R5
R2
Network
A to B
1 2 R3
3
3
2 1
A to B
R4
A to B
Incoming
Outgoing
Incoming
Outgoing
A to B
TCP/IP Protocol Suite
A to B
19
Source
Destination
Setup
2
3
4
Total delay
Transmission time
Teardown
6
7
Time
Time
Time
Time
20
Chapter 4
21
4.1 INTRODUCTION
The identifier used in the IP layer of the TCP/IP protocol suite to identify each device connected to the Internet is called the Internet address or IP address. An IP address is a 32-bit address that uniquely and universally defines the connection of a host or a router to the Internet. IP addresses are unique. They are unique in the sense that each address defines one, and only one, connection to the Internet. Two devices on the Internet can never have the same address.
22
23
24
25
Figure 4.1
Dotted-decimal notation
26
Example
Change the following IP addresses from dotted decimal notation to binary notation.
a. 114.34.2.8
b. 129.14.6.8 c. 208.34.54.12 d. 238.34.2.1 Solution a. 01110010 00100010 00000010 00001000
b. 10000001 00001110 00000110 00001000 c. 11010000 00100010 00110110 00001100 d. 11101110 00100010 00000010 00000001
27
Note:
The binary, decimal, and hexadecimal number systems are reviewed in Appendix B.
28
Example 1
Change the following IP 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 (see Appendix B) and add dots for separation:
a. 129.11.11.239 c. 231.219.139.111
TCP/IP Protocol Suite
b. 193.131.27.255 d. 249.155.251.15
29
Example 2
Change the following IP addresses from dotted-decimal notation to binary notation. a. 111.56.45.78 c. 241.8.56.12 b. 221.34.7.82 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
TCP/IP Protocol Suite
30
Example 3
Find the error, if any, in the following IP 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 are no leading zeroes in dotted-decimal notation (045). b. We may not have more than four numbers in an IP address. c. In dotted-decimal notation, each number is less than or equal to 255; 301 is outside this range. d. A mixture of binary notation and dotted-decimal notation is not allowed.
TCP/IP Protocol Suite
31
Example 4
Change the following IP addresses from binary notation to hexadecimal notation.
32
Recognizing Classes Netid and Hostid Classes and Blocks Network Addresses Sufficient Information Mask CIDR Notation Address Depletion
TCP/IP Protocol Suite
33
Figure 4.2
34
Figure 4.3
35
Example 5
How can we prove that we have 2,147,483,648 addresses in class A?
Solution In class A, only 1 bit defines the class. The remaining 31 bits are available for the address. With 31 bits, we can have 231 or 2,147,483,648 addresses.
36
Example 6
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 4.4. 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 0; the second bit is 1. This is a class B address. d. The first 4 bits are 1s. This is a class E address..
TCP/IP Protocol Suite
37
Figure 4.5
38
Example 7
Find the class of each address: a. 227.12.14.87 d. 252.5.15.111 b.193.14.56.22 e.134.11.78.56 c.14.23.120.8
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. e. The first byte is 134 (between 128 and 191); the class is B.
39
Figure 4.6
40
Figure 4.7
Blocks in class A
41
Figure 4.8
Blocks in class B
42
Figure 4.9
Blocks in class C
43
Example 9
Given the network address 17.0.0.0, find the class, the block, and the range of the addresses.
Solution The class is A because the first byte is between 0 and 127. The block has a netid of 17. The addresses range from 17.0.0.0 to 17.255.255.255.
44
Example 10
Given the network address 132.21.0.0, find the class, the block, and the range of the addresses.
Solution The class is B because the first byte is between 128 and 191. The block has a netid of 132.21. The addresses range from 132.21.0.0 to 132.21.255.255.
45
Example 11
Given the network address 220.34.76.0, find the class, the block, and the range of the addresses.
Solution The class is C because the first byte is between 192 and 223. The block has a netid of 220.34.76. The addresses range from 220.34.76.0 to 220.34.76.255.
46
If the network address is given, we can find the block and the range of addresses in the block. What about the reverse??? If the address is given, can we find the network address??? If there is no subnets. Then we can use the concept of MASK
47
Figure 4.10
Masking concept
48
49
50
Example 12
Given the address 23.56.7.91, find the beginning address (network address).
Solution The default mask is 255.0.0.0, which means that only the first byte is preserved and the other 3 bytes are set to 0s. The network address is 23.0.0.0.
51
Example 13
Given the address 132.6.17.85, find the beginning address (network address).
Solution The default mask is 255.255.0.0, which means that the first 2 bytes are preserved and the other 2 bytes are set to 0s. The network address is 132.6.0.0.
52
Example 14
Given the address 201.180.56.5, find the beginning address (network address).
Solution The default mask is 255.255.255.0, which means that the first 3 bytes are preserved and the last byte is set to 0. The network address is 201.180.56.0.
53
The topics discussed in this section include: Multihomed Devices Location, Not Names Special Addresses Private Addresses Unicast, Multicast, and Broadcast Addresses
54
55
Figure 4.13
Network address
56
Figure 4.14
57
Figure 4.18
Is used to test the IP software on the machine. When this address is used, packet will never leave the machine. It simply return to the protocol software
58
A number of blocks in each class are assigned for private use. These addresses are used either in isolation or in connection with network address translation techniques.
59
Example
A router has an IP address of 108.5.18.22. It sends a direct broadcast packet to all the host in the network. What are the source and destination IP addresses used in this packet
Solution
Source address: 108.5.18.22 Destination address: 108.255.255.255
60
Example
A router has an IP address of 185.67.89.34 needs loopback testing. What are the source and destination IP addresses
Solution
Source address: 185.67.89.34 Destination address: 127.X.Y.Z
61
The topics discussed in this section include: Subnetting Supernetting Supernet Mask Obsolescence
62
Note:
IP addresses are designed with two levels of hierarchy.
63
Figure 4.20
64
Figure 4.21
65
Figure 4.22
66
Figure 4.23
67
Introduction to Subnetting
To create a subnet address, a network administrator borrows bits from the host field and designates them as the subnet field.
68
Subnetting
To allocate a part of the host address space to network addresses and leave the remaining part to other physical networks It can get most out of the limited 32-bit IP address space and reduce the size of the routing table in a large internetwork A netmask to determine which bits in the IP address space represent the sub-network addresses
69
Introduction to Subnetting
Host bits must be reassigned (or borrowed) as network bits. The starting point is always the leftmost host bit.
Figure 4.24
71
Example 15
What is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0? Solution We apply the AND operation on the address and the subnet mask.
Address Subnet Mask
72
Figure 4.25
73
Figure 4.27
74
Example
Find the contiguous mask in each case a) 1024 subnets in Class A
75
Example
What is the maximum number of subnets in each area a) Class A: mask 255.255.192.0
76
Example
Given a Host IP address 192.168.45.32 and Subnet mask of 255.255.255.128. Calculate the following Number of Subnet bits Maximum number of Subnets Number of Host bits
Show subnets
(Subnetwork address, valid host, broadcast address)
TCP/IP Protocol Suite
77
Answer
Number of Subnet bits - 1 Maximum number of Subnets - 2 Number of Host bits - 7 Maximum number of hosts - 126
Broadcast 192.168.45.127
192.168.45.255
78
Example
Given a Host IP address 221.131.72.32 and Subnet mask of 255.255.255.224. Calculate the following
79
Answer
Number of Subnet bits -3
Maximum number of Subnets - 8 Number of Host bits -5
80
Chapter 5
81
The topics discussed in this section include: Restrictions Finding the Block Granted Block
82
Figure 5.2
In classless addressing the address must always be accompanied by the mask Written in CIDR (Classless InterDomain Routing) notation
83
The slash (/n) defines the number of bits (prefix length) that defines the network (~netid). n is the number of ones (1) in the mask The remaining bits (32 n) are the bits left for the suffix (~hostid)
84
Example
a. b. c. d.
Write the following mask in slash notation 255.255.255.0 255.0.0.0 255.255.224.0 255.255.240.0
Answer
85
Example
86
Example
87
88
Note:
Classful addressing is a special case of classless addressing.
89
First address in the block can be found by ANDing the mask with the address or by setting the suffix bits (32 n) all to 0s Number of addresses in the block can be found using 232-n Last address in the block is found by setting the suffix bits all to 1s
90
Example 4
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 Keep the left 27 bits: 10100111 11000111 10101010 Result in CIDR notation: 167.199.170.64/27
TCP/IP Protocol Suite
01010010
01000000
91
Example 5
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
92
Figure 5.3
Example 5
93
Example 6
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
94
Figure 5.4
Example 6
95
Example 7
Find the number of addresses in the block if one of the addresses is 140.120.84.24/20.
Solution The prefix length is 20. The number of addresses in the block is 23220 or 212 or 4096. Note that this is a large block with 4096 addresses.
96
Example 8
Using the first method, find the last address in the block if one of the addresses is 140.120.84.24/20. Solution We found in the previous examples that the first address is 140.120.80.0/20 and the number of addresses is 4096. To find the last address, we need to add 4095 (4096 1) to the first address. See Next Slide
TCP/IP Protocol Suite
97
Example 8 (Continued)
To keep the format in dotted-decimal notation, we need to represent 4095 in base 256 (see Appendix B) and do the calculation in base 256. We write 4095 as 15.255. We then add the first address to this number (in base 255) to obtain the last address as shown below:
140 . 120 . 80 . 0 15 . 255 ------------------------140 . 120 . 95 . 255
98
Example 9
Using the second method, find the last address in the block if one of the addresses is 140.120.84.24/20. Solution The mask has twenty 1s and twelve 0s. The complement of the mask has twenty 0s and twelve 1s. In other words, the mask complement is 00000000 00000000 00001111 11111111
or 0.0.15.255. We add the mask complement to the beginning address to find the last address.
See Next Slide
TCP/IP Protocol Suite
99
Example 9
(Continued)
We add the mask complement to the beginning address to find the last address. 140 . 120 . 80 . 0 0 . 0 . 15 . 255 ---------------------------140 . 120 . 95 . 255
100
Example 10
one
of
the
addresses
is
Solution We follow the procedure in the previous examples to find the first address, the number of addresses, and the last address. To find the first address, we notice that the mask (/29) has five 1s in the last byte. So we write the last byte as powers of 2 and retain only the leftmost five as shown below: See Next Slide
TCP/IP Protocol Suite
101
Example 10 (Continued)
202
128 + 64 + 0 + 0 + 8 + 0 + 2 + 0
The first address is 190.87.140.200/29 The number of addresses is 23229 or 8. To find the last address, we use the complement of the mask. The mask has twenty-nine 1s; the complement has three 1s. The complement is 0.0.0.7. If we add this to the first address, we get 190.87.140.207/29. In other words, the first address is 190.87.140.200/29, the last address is 190.87.140.207/29. There are only 8 addresses in this block.
TCP/IP Protocol Suite
102
Example 11
Show a network configuration for the block in the previous example. Solution The organization that is granted the block in the previous example can assign the addresses in the block to the hosts in its network. However, the first address needs to be used as the network address and the last address is kept as a special address (limited broadcast address). Figure 5.5 shows how the block can be used by an organization. Note that the last address ends with 207, which is different from the 255 seen in classful addressing.
103
Figure 5.5
Example 11
104
Note: In classless addressing, the last address in the block does not necessarily end in 255.
105
Note:
In CIDR notation, the block granted is defined by the first address and the prefix length.
106
5.2 SUBNETTING
When an organization is granted a block of addresses, it can create subnets to meet its needs. The prefix length increases to define the subnet prefix length.
The topics discussed in this section include: Finding the Subnet Mask Finding the Subnet Addresses Variable-Length Subnets
107
Note:
In fixed-length subnetting, the number of subnets is a power of 2.
108
Example 12
An organization is granted the block 130.34.12.64/26. The organization needs 4 subnets. What is the subnet prefix length? Solution We need 4 subnets, which means we need to add two more 1s (log2 4 = 2) to the site prefix. The subnet prefix is then /28.
109
Example 12-1
In Fixed length subnetting find the number of 1s that must be added to the mask if the number of desired subnets is a. 2 b. 62 c. 122 Solution d. 250
110
Example 12-2
What is the maximum number of subnets if the prefix length of a block is a. 18 b. 10 c. 27 Solution d. 31
111
Example 13
What are the subnet addresses and the range of addresses for each subnet in the previous example-12? Solution Figure 5.6 shows one configuration. See Next Slide
112
Example 13 (Continued)
The site has 23226 = 64 addresses. Each subnet has 23228 = 16 addresses. Now let us find the first and last address in each subnet.
1. The first address in the first subnet is 130.34.12.64/28, using the procedure we showed in the previous examples. Note that the first address of the first subnet is the first address of the block. The last address of the subnet can be found by adding 15 (16 1) to the first address. The last address is 130.34.12.79/28.
113
Example 13 (Continued)
2.The first address in the second subnet is 130.34.12.80/28; it is found by adding 1 to the last address of the previous subnet. Again adding 15 to the first address, we obtain the last address, 130.34.12.95/28. 3. Similarly, we find the first address of the third subnet to be 130.34.12.96/28 and the last to be 130.34.12.111/28. 4. Similarly, we find the first address of the fourth subnet to be 130.34.12.112/28 and the last to be 130.34.12.127/28.
TCP/IP Protocol Suite
114
Figure 5.6
Example 13
115
Example 14
An organization is granted a block of addresses with the beginning address 14.24.74.0/24. There are 23224= 256 addresses in this block. The organization needs to have 11 subnets as shown below: a. two subnets, each with 64 addresses.
116
Example 14 (Continuted)
1. We use the first 128 addresses for the first two subnets, each with 64 addresses. Note that the mask for each network is /26.
1st subnet 14.24.74.00 000000/26 2nd 14.24.74.01 000000/26 14.24.74.0/26 2nd 14.24.74.64/26
2. We use the next 64 addresses for the next two subnets, each with 32 addresses. Note that the mask for each network is /27.
1st subnet 14.24.74.100 00000/27 2nd 14.24.74.10100000/27 14.24.74.128/27
TCP/IP Protocol Suite
2nd 14.24.74.160/27
117
Example 14 (Continuted)
3. We use the next 48 addresses for the next three subnets, each with 16 addresses. Note that the mask for each network is /28.
1st subnet 14.24.74.1100 0000/28 2nd 1101 = 208 3rd 1110 14.24.74.192/27 14.24.74.208/27 14.24.74.224/27
118
Figure 5.7
Example 14
119
Example 15
As another example, assume a company has three offices: Central, East, and West. The Central office is connected to the East and West offices via private, point-to-point WAN lines. The company is granted a block of 64 addresses with the beginning address 70.12.100.128/26. The management has decided to allocate 32 addresses for the Central office and divides the rest of addresses between the two offices. Figure 5.8 shows the configuration designed by the management.
See Next Slide
TCP/IP Protocol Suite
120
Example 15 (Continued)
The company will have three subnets, one at Central, one at East, and one at West. The following lists the subblocks allocated for each network: a. The Central office uses the network address 70.12.100.128/27. This is the first address, and the mask /27 shows that there are 32 addresses in this network. Note that three of these addresses are used for the routers and the company has reserved the last address in the sub-block. The addresses in this subnet are 70.12.100.128/27 to 70.12.100.159/27. Note that the interface of the router that connects the Central subnet to the WAN needs no address because it is a point-topoint connection.
TCP/IP Protocol Suite
121
Example 15 (Continued)
b. The West office uses the network address 70.12.100.160/28. The mask /28 shows that there are only 16 addresses in this network. Note that one of these addresses is used for the router and the company has reserved the last address in the sub-block. The addresses in this subnet are 70.12.100.160/28 to 70.12.100.175/28. Note also that the interface of the router that connects the West subnet to the WAN needs no address because it is a point-to- point connection.
122
Example 15 (Continued)
c. The East office uses the network address 70.12.100.176/28. The mask /28 shows that there are only 16 addresses in this network. Note that one of these addresses is used for the router and the company has reserved the last address in the sub-block. The addresses in. this subnet are 70.12.100.176/28 to 70.12.100.191/28. Note also that the interface of the router that connects the East subnet to the WAN needs no address because it is a point-to-point connection.
123
Figure 5.8
Example 15
124
125
Example 16
An ISP is granted a block of addresses starting with 190.100.0.0/16 (65,536 addresses). The ISP needs to distribute these addresses to three groups of customers as follows:
a. The first group has 64 customers; each needs 256 addresses. b. The second group has 128 customers; each needs 128 addresses c. The third group has 128 customers; each needs 64 addresses.
126
Example 16 (Continued)
Design the subblocks and find out how many addresses are still available after these allocations. Solution Figure 5.9 shows the situation.
127
Figure 5.9
Example 16
128
Example 16 (Continued) Group 1 For this group, each customer needs 256 addresses. This means the suffix length is 8 (28 =256). The prefix length is then 32 8 = 24. The addresses are:
1st Customer 190.100.0.0/24 2nd Customer 190.100.1.0/24 ... 64th Customer 190.100.63.0/24 Total = 64 256 = 16,384 190.100.0.255/24 190.100.1.255/24
190.100.63.255/24
129
Example 16 (Continued)
Group 2 For this group, each customer needs 128 addresses. This means the suffix length is 7 (27 =128). The prefix length is then 32 7 = 25. The addresses are:
1st Customer 2nd Customer 128th Customer 190.100.64.0/25 190.100.64.128/25 190.100.64.127/25 190.100.64.255/25
190.100.127.128/25 190.100.127.255/25
130
131
Example 16 (continued)
Group 3 For this group, each customer needs 64 addresses. This means the suffix length is 6 (26 = 64). The prefix length is then 32 6 = 26. The addresses are:
1st Customer
2nd Customer 128th Customer
190.100.128.0/26
190.100.128.64/26
190.100.128.63/26
190.100.128.127/26
190.100.159.192/26 190.100.159.255/26
132
Example 16 (continued)
Number of granted addresses to the ISP: 65,536 Number of allocated addresses by the ISP: 40,960 Number of available addresses: 24,576
133
The topics discussed in this section include: Address Translation Translation Table NAT and ISP
134
Figure 26.6
NAT
135
Figure 26.7
Address translation
136
Figure 26.8
Translation
137
Chapter 6
138
6.1 DELIVERY
The network layer supervises delivery, the handling of the packets by the underlying physical networks. Two important concepts are the type of connection and direct versus indirect delivery.
The topics discussed in this section include: Connection Types Direct Versus Indirect Delivery
139
Delivery
The network layer supervises delivery, the handling of the packets by the underlying physical networks Two important concepts are the type of connection and direct versus indirect delivery
140
Delivery
Direct Delivery: where the destination is on the current network (always one at the end of a route) Indirect Delivery: where the destination is on a remote network so the packet must be passed to another router to be delivered (can be zero or more indirect deliveries)
141
Figure 6.1
Direct delivery
142
Figure 6.2
Indirect delivery
143
Example
A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 137.23.67.9/16. Is the delivery direct or indirect? Assume no subnetting.
Answer
Direct; both hosts are on the same network (same netid, 137.23).
144
Example
A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 137.23.67.9/16. Is the delivery direct or indirect? Assume no subnetting.
Answer
Direct; both hosts are on the same network (same netid, 137.23).
145
Example
A host with IP address 137.23.56.23/16 sends a packet to a host with IP address 142.3.6.9/24. Is the delivery direct or indirect? Assume no subnetting.
Answer
Indirect; the hosts are on different networks (different netid, 137.23 and 142.3.6).
146
6.2 FORWARDING
Forwarding means to place the packet in its route to its destination. Forwarding requires a host or a router to have a routing table. .
147
Forwarding Techniques
148
Figure 6.3
Next-hop method
Reduces the size of the routing table by only recording the next hop for forwarding the packet
149
Figure 6.4
Network-specific method
Only one entry that defines the address of the destination network
150
Figure 6.5
Host-specific routing
specific destination host address is recorded, usually used for control over routing
151
Figure 6.6
Default routing
152
Classful Routing
Minimum of 3 columns
Default masks are used (mainly) to route packets to final destination networks (Internet) Applying the default mask to a destination address gives you the nodes network address which can be compared to the entries in the table Order of the routing table is: direct-delivery, hostspecific, network-specific, default
153
Figure 6.7
154
Example 1
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R1.
155
Figure 6.8
156
Example 1 (Continued)
Solution
Figure 6.9 shows the three tables used by router R1. Note that some entries in the next-hop address column are empty because in these cases, the destination is in the same network to which the router is connected (direct delivery). In these cases, the nexthop address used by ARP is simply the destination address of the packet as we will see in Chapter 7.
See Next Slide
TCP/IP Protocol Suite
157
Figure 6.9
158
Example
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R2.
159
Example
Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R3.
160
Figure 6.10
161
Example 4
162
Example 4 (Continued)
Note several points. First, the site address is 145.14.0.0/16 (a class B address). Every packet with destination address in the range 145.14.0.0 to 145.14.255.255 is delivered to the interface m4 and distributed to the final destination subnet by the router. Second, we have used the address x.y.z.t/n for the interface m4 because we do not know to which network this router is connected. Third, the table has a default entry for packets that are to be sent out of the site. The router is configured to apply the mask /18 to any destination address.
TCP/IP Protocol Suite
163
164
Example 5
The router in Figure 6.11 receives a packet with destination address 145.14.32.78. Show how the packet is forwarded.
Solution The mask is /18. After applying the mask, the subnet address is 145.14.0.0. The packet is delivered to ARP with the next-hop address 145.14.32.78 and the outgoing interface m0.
165
Example 6
A host in network 145.14.0.0 in Figure 6.11 has a packet to send to the host with address 7.22.67.91. Show how the packet is routed. Solution The router receives the packet and applies the mask (/18). The network address is 7.22.64.0. The table is searched and the address is not found. The router uses the address of the default router (not shown in figure) and sends the packet to that router.
TCP/IP Protocol Suite
166
Note: In classful addressing we can have a routing table with three columns; in classless addressing, we need at least four columns.
167
Classless Routing
Minimum of 4 columns
Mask in each line of the routing table is applied to the destination address Routing table sorted in longest mask to shortest mask order
168
Figure 6.12
169
Example 7
Make a routing table for router R1 using the configuration in Figure 6.13. See Next Slide
Solution Table 6.1 shows the corresponding table. See the table after the figure.
170
Figure 6.13
171
172
Example 8
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 180.70.65.140. Solution The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The result is 180.70.65.128, which does not match the corresponding network address.
173
Example 8 (Continued)
2. The second mask (/25) is applied to the destination address. The result is 180.70.65.128, which matches the corresponding network address. The next-hop address (the destination address of the packet in this case) and the interface number m0 are passed to ARP for further processing.
174
Example 9
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.22.35.
Solution The router performs the following steps: See Next Slide
TCP/IP Protocol Suite
175
Example 9 (Continued)
1. The first mask (/26) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 1). 2. The second mask (/25) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 2). 3. The third mask (/24) is applied to the destination address. The result is 201.4.22.0, which matches the corresponding network address. The destination address of the package and the interface number m3 are passed to ARP.
176
Example 10
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 18.24.32.78. Solution This time all masks are applied to the destination address, but no matching network address is found. When it reaches the end of the table, the module gives the next-hop address 180.70.65.200 and interface number m2 to ARP. This is probably an outgoing package that needs to be sent, via the default router, to some place else in the Internet.
TCP/IP Protocol Suite
177
Example 11
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.16.70. Solution
178
Example 12
Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 202.70.20.30. Solution
179
Example
Find the topology of the network if the following routing table is for R1.
Mask /27 /18 Default Network Address 202.14.17.224 145.23.192.0 default Next- Hop Address 130.56.12.4 Interface M1 M0 m2
Answer
180
Example 11
Now let us give a different type of example. Can we find the configuration of a router, if we know only its routing table? The routing table for router R1 is given in Table 6.2. Can we draw its topology? See Next Slide
181
182
Example 11
(Continued)
Solution We know some facts but we dont have all for a definite topology. We know that router R1 has three interfaces: m0, m1, and m2. We know that there are three networks directly connected to router R1. We know that there are two networks indirectly connected to R1. There must be at least three other routers involved (see next-hop column). We know to which networks these routers are connected by looking at their IP addresses. So we can put them at their appropriate place.
TCP/IP Protocol Suite
183
Example 11
(Continued)
We know that one router, the default router, is connected to the rest of the Internet. But there is some missing information. We do not know if network 130.4.8.0 is directly connected to router R2 or through a point-to-point network (WAN) and another router. We do not know if network140.6.12.64 is connected to router R3 directly or through a point-to-point network (WAN) and another router. Point-to-point networks normally do not have an entry in the routing table because no hosts are connected to them. Figure 6.14 shows our guessed topology. See Next Slide
TCP/IP Protocol Suite
184
Figure 6.14
185
Example
Answer A host that is totally isolated needs no routing table. The routing table has no entries.
186
Example
Show a routing table for a host that is connected to a LAN without being connected to the Internet Answer A routing table for a LAN not connected to the Internet and with no subnets can have a routing table with host-specific addresses. There is no next-hop address since all packets remain within the network.
187
Homework
Go To the following website http://highered.mcgraw-hill.com/sites/0072967722/ Complete the Chapter 4-6 quizzes.
188