3. 3
Introduction
What is a Packet Switch?
• Basic Architectural Components
• Some Example Packet Switches
• The Evolution of IP Routers
4. 4
Router Components
• Hardware components of a router:
– Network interfaces
– Interconnection network
– Processor with a memory and
CPU
• PC router:
– interconnection network is the
(PCI) bus and interface cards
are NICs
– All forwarding and routing is
done on central processor
• Commercial routers:
– Interconnection network and
interface cards are
sophisticated
– Processor is only responsible
for control functions (route
processor)
– Almost all forwarding is done
on interface cards
Interface Card
Interconnection Network
Interface Card Interface Card
Processor
CPU
Memory
6. 6
Routing and Forwarding
Routing functions include:
– route calculation
– maintenance of the routing table
– execution of routing protocols
• On commercial routers handled by a single general
purpose processor, called route processor
IP forwarding is per-packet processing
• On high-end commercial routers, IP forwarding is
distributed
• Most work is done on the interface cards
8. 8
Router Components
• On a PC router:
– interconnection network is
the (PCI) bus
– Interface cards are NICs
(e.g., Ethernet cards)
– All forwarding and routing is
done on central processor
• On Commercial routers:
– Interconnection network
and interface cards can be
sophisticated
– Central processor is the
route processor (only
responsible for control
functions)
Interface Card
Interconnection Network
Interface Card Interface Card
Processor
CPU
Memory
9. 9
Slotted Chassis
• Large routers are built as a slotted chassis
– Interface cards are inserted in the slots
– Route processor is also inserted as a slot
• This simplifies repairs and upgrades of components
Route
Processor
(CPU)
Interface cards
10. 10
Evolution of Router Architectures
• Early routers were essentially general purpose
computers
• Today, high-performance routers resemble
supercomputers
• Exploit parallelism
• Special hardware components
• Until 1980s (1st generation): standard computer
• Early 1990s (2nd generation):delegate to interfaces
• Late 1990s (3rd generation):Distributed architecture
• Today: Distributed over multiple racks
11. 11
1st Generation Routers
• This architecture is still used in
low end routers
• Arriving packets are copied to main
memory via direct memory access
(DMA)
• Interconnection network is a
backplane (shared bus)
• All IP forwarding functions are
performed in the central processor.
• Routing cache at processor can
accelerate the routing table lookup.
• Drawbacks:
– Forwarding Performance is
limited by CPU
– Capacity of shared bus limits
the number of interface
cards that can be connected
Memory
Shared Bus
DMA
MAC
DMA
MAC
Interface
Card
DMA
MAC
Route Processor
Interface
Card
Interface
Card
Cache
CPU
12. 12
Shared
Bus
Interface
Cards
DMA
MAC
DMA
MAC
DMA
MAC
Route Cache
Memory
Route Cache
Memory
Route Cache
Memory
Route Processor
Memory
Cache
CPU
2nd Generation Routers
• Keeps shared bus arch.,
but offloads most IP
forwarding to interface cards
• Interface cards have local route
cache and processing elements
Fast path: If routing entry is found in
local cache, forward packet
directly to outgoing interface
Slow path: If routing table entry is
not in cache, packet must be
handled by central CPU
• Drawbacks: Shared bus is still bottleneck
slow path
fast path
13. 13
CPU
Cache
Memory
MAC MAC
Memory
Forwarding Bus
(IP headers only)
Interface
Cards
Data Bus
Control Bus
Memory
MAC
Memory
Forwarding
Engine
CPU
Cache
Memory
Forwarding
Engine
Route Processor
CPU
Memory
Another 2nd Generation Architecture
• IP forwarding is done by
separate components
(Forwarding Engines)
Forwarding operations:
1. Packet received on interface:
Store the packet in local
memory. Extracts IP header
and sent to one forwarding
engine
2. Forwarding engine does
lookup, updates IP header,
and sends it back to
incoming interface
3. Packet is reconstructed and
sent to outgoing interface.
IP header
IP datagram
14. 14
3rd Generation Architecture
• Interconnection network is a
switch fabric (e.g., a crossbar
switch)
• Distributed architecture:
– Interface cards operate
independent of each other
– No centralized processing
for IP forwarding
• These routers can be scaled to
many hundred interface cards
and to aggregate capacity of >
1 Terabit per second
CPU
Memory
Route
Processor
Memory
Route
Processing
MAC
Switch
Fabric
Interface
Switch
Fabric
Memory
Route
Processing
MAC
Switch
Fabric
Interface
16. 19-1 IPv4ADDRESSES
An IPv4 address is a 32-bit address that uniquely
and universally defines the connection of a
device (for example, a computer or a router) to
the Internet.
Topics discussed in this section:
Address Space Notations
Classful Addressing Classless Addressing
Network Address Translation (NAT)
19.2
17. The IPv4 addresses are unique and
universal.
Note
19.4
An IPv4 address is 32 bits long.
or 4,294,967,296.
The address space of IPv4 is
232
19. Change the following IPv4 addresses from
binary notation to dotted-decimal notation.
Example 19.1
Solution
We replace each group of 8 bits with its
equivalent decimal number (see Appendix B) and
add dots for separation.
19.8
20. Change the following IPv4 addresses from dotted-
decimal notation to binary notation.
Example 19.2
Solution
We replace each decimal number with
its binary equivalent (see Appendix B).
19.9
21. Find the error, if any, in the following IPv4
addresses.
Example 19.3
Solution
a.There must be no leading zero (045).
b.There can be no more than four numbers.
c.Each number needs to be less than or equal to 255.
d.A mixture of binary notation and dotted-decimal notation is
not allowed.
19.10
In classful addressing, the address space
is divided into five classes: A, B, C, D, & E.
Note
23. Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
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 byte is 14; the class is A.
d.The first byte is 252; the class is E.
19.13
Example 19.4
24. Table 19.1 Number of blocks and
block size in classful IPv4 addressing
19.14
In classful addressing, a large part of
the available addresses were wasted.
Note
25. Table 19.2Default masks for classful
addressing
19.16
Classful addressing, which is almost
obsolete, is replaced with classless
addressing.
Note
26. Figure 19.3 shows a block of addresses, in both
binary and dotted-decimal notation, granted to a
small business that needs 16 addresses.
We can see that the restrictions are applied to this
block. The addresses are contiguous. The
number of addresses is a power of 2 (16 = 24), and
the first address is divisible by 16. The first
address, when converted to a decimal number, is
3,440,387,360, which when divided by 16 results
in 215,024,210.
19.18
Example 19.5
27. Figure 19.3 A block of 16 addresses granted to a small organization
19.19
In IPv4 addressing, a block of addresses can be
defined as x.y.z.t /n in which x.y.z.t defines one
of the addresses and the /n defines the mask.
Note
28. A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What is
the first address in the block?
Solution
The binary representation of the given address is 11001101
00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or 205.16.37.32.
This is actually the block shown in Figure 19.3.
19.22
Example 19.6
The first address in the block can be found
by setting the rightmost 32 − n bits to 0s.
Note
29. Find the last address for the block in Example 19.6.
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or 205.16.37.47
This is actually the block shown in Figure 19.3.
19.24
Example 19.7
The number of addresses in the block
can be found by using the formula 232−n.
Note
30. Find the number of addresses in Example 19.6.
19.26
Example 19.8
Solution
The value of n is 28, which means than number of
addresses is 2 32−28 or 16.
31. Another way to find the first address, the last address, and
the number of addresses is to represent the mask as a 32-
bit binary (or 8-digit hexadecimal) number. This is
particularly useful when we are writing a program to find
these pieces of information. In Example 19.5 the /28 can
be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a.The first address
b.The last address
c.The number of addresses.
19.27
Example 19.9
32. Solution
a. The first address can be found by ANDing the
given addresses with the mask. ANDing here is
done bit by bit. The result of ANDing 2 bits is 1 if
both bits are 1s; the result is 0 otherwise.
Example 19.9 (continued)
19.28
33. b. The last address can be found by O Ring the given
addresses with the complement of the mask. O Ring
here is done bit by bit. The result of O Ring 2 bits is 0 if
both bits are 0s; the result is 1 otherwise. The
complement of a number is found by changing each 1 to 0
and each 0 to 1.
Example 19.9 (continued)
19.29
34. c. The number of addresses can be found by
complementing the mask, interpreting it as a
decimal number, and adding 1 to it.
Example 19.9 (continued)
19.30
35. Figure 19.4 A network configuration for the block 205.16.37.32/28
19.31
The first address in a block is normally not assigned
to any device; it is used as the network address that
represents the organization to the rest of the world.
Note
36. Figure 19.5Two levels of hierarchy in an IPv4 address
19.33
Figure 19.6 A
frame in a
character-oriented
protocol
37. Figure 19.7 Configuration & addresses in a subnetted network
19.36
Note
Each address in the block can
be considered as a two-level
hierarchical structure: the
leftmost n bits (prefix) define
the network; the rightmost
32 − n bits define the host.
39. 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 grouphas 64 customers; each needs 256
addresses.
b.The second group has 128 customers; each needs 128
addresses.
c.The third grouphas 128 customers; each needs 64
addresses.
Design the sub blocks and findout how many addresses
are still available after these allocations.
19.38
Example 19.10
40. Solution
Figure 19.9 shows the situation.
Group 1
For this group, each customer needs 256 addresses.
This means that 8 (log2 256) bits are needed to
define each host. The prefix length is then 32 − 8 =
24. The addresses are
Example 19.10 (continued)
19.39
41. Example 19.10 (continued)
Group 2
For this group, each customer needs 128
addresses. This means that 7 (log2 128) bits are
needed to define each host. The prefix length is
then 32 − 7 = 25. The addresses are
19.40
42. Example 19.10 (continued)
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The
prefix length is then 32 − 6 = 26. The addresses are
Number of granted addresses to the ISP: 65,536
Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
19.41
43. Figure 19.9 An example of address allocation and
distribution by an ISP
19.42
Table 19.3 Addresses
for private networks
44. Figure 19.10 A NAT implementation
19.44
Figure 19.11Addresses in a NAT
47. 19-2 IPv6ADDRESSES
Despite all short-term solutions, address
depletion is still a long-term problem for the
Internet. This and other problems in the IP
protocol itself have been the motivation for
IPv6.
Topics discussed in this section:
Structure Address Space
19.49
48. Figure 19.14 IPv6 address in binary and hexadecimal
colon notation
19.51
An IPv6 address is 128 bits long.
Note
Fig 19.15
Abbreviated IPv6
addresses
49. Example 19.11
Expand the address 0:15::1:12:1213 to its original.
Solution
We first need to align the left side of the double
colon to the left of the original pattern and the
right side of the double colon to the right of the
original pattern to find how many 0s we need to
replace the double colon.
This means that the original address is.
19.53
54. 20-1 INTERNETWORKING
In this section, we discuss internetworking,
connecting networks together to make an
internetwork or an internet.
Topics discussed in this section:
Need for Network Layer Internet as a Datagram
Network
Internet as a Connectionless Network
20.2
58. Figure 20.3 Network layer at the source, router, and destination
(continued)
20.6
Note
• Switching at the network layer in
the Internet uses the datagram
approach to packet switching.
• Communication at the network
layer in the Internet is
connectionless.
59. 20-2 IPv4
The Internet Protocol version 4 (IPv4) is the
delivery mechanism used by the TCP/IP
protocols.
Topics discussed in this
section:
Datagram Fragmentation
Checksum Options
20.9
62. Figure 20.6 Service type or differentiated services
20.12
Table 20.1 Types of service
The precedence subfield was part of version 4, but never used.
Note
Table 20.3Values for code points
64. Figure 20.7 Encapsulation of a small datagram in an Ethernet frame
20.18
Figure 20.8 Protocol field and encapsulated data
The total length field defines the total length of the
datagram including the header.
Note
65. Figure 20.9 Maximum transfer unit (MTU)
20.25
Table 20.5MTUs for
some networks
Figure 20.10 Flags
used in fragmentation
68. A packet has arrived with an M bit value of 0. Is this
the first fragment, the last fragment, or a middle
fragment? Do we know if the packet was
fragmented?
Solution
IftheM bitis0,itmeansthatthereareno more
fragments; the fragment is the last one. However,
we cannot say if the original packet was
fragmented or not. A non-fragmented packet is
considered the last fragment.
20.30
Example 20.5
71. 20-3 IPv6
The network layer protocol in the TCP/IP
protocol suite is currently IPv4. Although IPv4
is well designed, data communication has
evolved since the inception of IPv4 in the
1970s. IPv4 has some deficiencies that make it
unsuitable for the fast-growing Internet.
Topics discussed in this section:
Advantages Packet Format Extension Headers
20.38
79. 20-4 TRANSITION FROM IPv4 TO IPv6
Because of the huge number of systems on the
Internet, the transition from IPv4 to IPv6 cannot
happen suddenly. It takes a considerable amount of
time before every system in the Internet can move
from IPv4 to IPv6. The transition must be smooth to
prevent any problems between IPv4 and IPv6
systems.
Topics discussed in this section:
Dual Stack Tunneling
Header Translation
20.47
83. 21-3 IGMP
The IP protocol can be involved in two types of
communication: unicasting and multicasting.
The Internet Group Management Protocol
(IGMP) is one of the necessary, but not
sufficient, protocols that is involved in
multicasting. IGMP is a companion to the IP
protocol.
Topics discussed in this section:
Group Management
IGMP Messages and IGMP Operation Encapsulation
Netstat Utility
21.31
84. Figure 21.16 IGMP message types
21.32
Figure 21.17 IGMP message format Table 21.1 IGMP type field
85. Figure 21.18 IGMP operation
21.35
The general query message does not define a particular group.
In IGMP, a membership report is sent twice, one after the other.
Note
86. Imagine there are three hosts in a network, as shown in
Figure 21.19. A query message was received at time 0; the
random delay time (in tenths of seconds) for each group is
shown next to the group address. Show the sequence of
report messages.
Solution
The events occur in this sequence:
a. Time 12: The timer for 228.42.0.0 in host A expires, and
a membership report is sent, which is received by the router
and every host including host B which
cancels its timer for 228.42.0.0.
21.38
Example 21.6
87. Example 21.6 (continued)
21.39
b. Time 30: The timer for 225.14.0.0 in host A expires, and
a membership report is sent which is received by the
router and every host including host C which cancels its
timer for 225.14.0.0.
c. Time 50: The timer for 238.71.0.0 in host B expires,
and a membership report is sent, which is received by
the router and every host.
d. Time 70: The timer for 230.43.0.0 in host C expires,
and a membership report is sent, which is received by
the routerand every host including host A which
cancels its timer for 230.43.0.0.
89. Figure 21.21 Mapping class D to Ethernet physical address
21.44
The IP packet that carries an IGMP packet has a value of 1
in its TTL field. An Ethernet multicast physical address is in the
range 01:00:5E:00:00:00 to 01:00:5E:7F:FF:FF.
Note
90. Change the multicast IP address230.43.14.7 to an
Ethernet multicast physical address.
Solution
We can do this in two steps:
a. We write the rightmost 23 bits of the IP address in
hexadecimal. This can be done by changing the
rightmost 3 bytes to hexadecimal and then subtracting 8
from the leftmost digit if it is greater than or equal to
8. In our example, the result is 2B:0E:07.
b. We add the result of part a to the starting Ethernet
multicast address, which is 01:00:5E:00:00:00. The
result is
21.46
Example 21.7
91. Change the multicast IP address 238.212.24.9 to an
Ethernet multicast address.
Solution
a.The rightmost 3 bytes in hexadecimal is D4:18:09. We
need to subtract 8 from the leftmost digit, resulting in
54:18:09.
b.We add the result of part a to the Ethernet multicast
starting address. The result is
Example 21.8
21.48
93. We use netstat with three options: -n, -r, and -a. The -n option gives
the numeric versions of IP addresses, the -r option gives the
routing table, and the -a option gives all addresses (unicast and
multicast). Note that we show only the fields relative to our
discussion. “Gateway” defines the router, “Iface” defines the
interface.
Note that the multicast address is shown in color. Any packet with
a multicast address from 224.0.0.0 to 239.255.255.255 is masked
and delivered to the Ethernet interface.
21.50
Example 21.9
94. 22-3 UNICAST ROUTING PROTOCOLS
A routing table can be either static or dynamic. A
static table is one with manual entries. A dynamic
table is one that is updated automatically when
there is a change somewhere in the Internet. A
routing protocol is a combination of rules and
procedures that lets routers in the Internet inform
each other of changes.
Topics discussed in this section:
Optimization
Intra- and Interdomain Routing Distance Vector Routing and
RIP Link State Routing and OSPF Path Vector Routing and
BGP
22.27
98. Figure 22.15 Initialization of tables in distance vector routing
22.31
Note
In distance vector routing, each node shares its routing table with
its immediate neighbors periodically and when there is a change.