Sie sind auf Seite 1von 67

1

TCP/IP Internetworking
Chapter 8

Copyright 2003 Prentice-Hall
Pankos Business Data Networks and Telecommunications, 4
th
edition
2
Objectives
Basic router operation
Routing decisions: Routing table,
net/subnet mask, best route selection
TCP/IP, DNS, ICMP, IPv6, TCP, UDP
IP routing Vs. layer 3 switching
Layer 3 switching Vs. layer 4 switching

3
Perspective
Chapters 4&5 covered single LANs
Chapter 7 covered single WANs
Most corporations have internets that combine
multiple LANs and WANs
Most internets today primarily use TCP/IP
standards and protocols
Chapter 8 deals with TCP/IP internetworking
4
Figure 8.1: Internetworking with Routers
Router W
Router Y
Router
X
Router
Z
Site C
Site A
Site B
Routers Connect Multiple Networks Into
an Internet
5
Figure 8.1: Internetworking with Routers
Subnet
Subnet
Subnet
Internal
Router W
Internal
Router Y
Edge
Router
X
Edge
Router
Z
Site C
Site A
Site B
Edge Routers and Internal Routers
6
Ethernet
LAN 3
Figure 8.1: Internetworking with Routers
Ethernet LAN 1
Ethernet
LAN 2
Token-Ring
Network
Router W
Router Y
Router
X
Router
Z
T1
Leased
Line
T1
Leased
Line
Frame Relay
Network
Site C
Site A
Site B
Routers Connect Different Types of Networks
7
Figure 8.2: Frame Arriving at a Router
IP
Packet
PPP
T
PPP
H
Internet Layer Program
(Router Forwarding Decision)
Data Link
Layer Program
Data Link
Layer Program
1.
2.
Serial Port
Modem
Telephone
Line
PPP
User PC
Interface 1
(Incoming)
Physical
Layer
Interface 2
(Outgoing)
Physical
Layer
First
Router
Second
Router
Unknown
Physical
and
Data
Link
Standards
8
Figure 8.2: Frame Arriving at a Router
IP
Packet
IP
Packet
PPP
T
PPP
H
Internet Layer Program
(Router Forwarding Decision)
Data Link
Layer Program
Data Link
Layer Program
1.
2.
3.
Serial Port
Modem
Telephone
Line
PPP
User PC
Interface 1
(Incoming)
Physical
Layer
Interface 2
(Outgoing)
Physical
Layer
First
Router
Second
Router
Unknown
Physical
and
Data
Link
Standards
9
Frame Relay Network
Figure 8.3: A Routing Decision
Routing
Table
Router E
Router G
Router H
Router F
Telephone
Connection
Incoming Packet
Token-Ring
LAN
Ethernet LAN
Router I
Destination Host
A Packet Arrives in a
Port
Which Port Should the
Router Send the Packet
Back Out?
10
Frame Relay Network
Figure 8.3: A Routing Decision
Routing
Table
Router E
Router G
Router H
Router F
Token-Ring
LAN
Ethernet LAN
Router I
Destination Host Destination Host May Be
on One of the Attached
Subnets. Router sends
Packet to It
Telephone
System
11
Figure 8.3: A Routing Decision
Routing
Table
Router E
Router G
Router H
Router F
Frame Relay Network
Token-Ring
LAN
Ethernet LAN
Router I
?
?
?
?
If destination host is
not on a subnet,
router must select
BEST next-hop
router (NHR)
Telephone
System
12
Frame Relay Network
Figure 8.3: A Routing Decision
Routing
Table
Router E
Router G
Router H
Router F
Telephone
System
Token-Ring
LAN
Ethernet LAN
Router I
Destination Host
Here, router selects NHR
G on the Frame Relay
network as the BEST NHR,
sends out the packet to
Router G.
13
Frame Relay Network
Figure 8.3: A Routing Decision
Routing
Table
Router E
Router G
Router H
Router F
Token-Ring
LAN
Ethernet LAN
Router I
A subnet may have
multiple NHRs
Not enough to specify
a subnet port; must
also specify NHR
Telephone
System
14
Figure 8.4: Sending a Frame Back Out
Internet Layer Program
(Router Forwarding Decision)
Data Link
Layer Program
Data Link
Layer Program
Serial
Port
Modem
Telephone
Line PPP
User PC
Port 1
(Incoming)
Physical
Layer
Port 2
(Outgoing)
Physical
Layer
First
Router
Next-Hop
Router
IP
Packet
IP
Packet
DL
T
DL
H
5.
4.
6.
15
Figure 8.5: Format Conversion
Data Link
Layer Program
Data Link
Layer Program
Serial
Port
Modem
Telephone
Line PPP
User PC
First
Router
Second
Router
Unknown
Physical
and
Data Link
Standards
IP
Packet
DL
T
DL
H
IP
Packet
PPP
T
PPP
H
Internet Layer Program
(Router Forwarding Decision)
16
Token-Ring
Network
Ethernet
LAN 2
Ethernet
LAN 1
Figure 8.6: Multiprotocol Routing
The Internet
UNIX
Server
Old
NetWare
Server
Internal
Router Y
Mainframe
Edge
Router
Z
Site A
Site B
Multiprotocol
Router X
IPX/
SPX
TCP/
IP
TCP/
IP
SNA
WWW
Server
17
Figure 8.7: Hierarchical IP Address
Network Part (not always 16 bits)

Subnet Part (not always 8 bits)

Host Part (not always 8 bits)

Total always is 32 bits.
128.171.17.13
Host 13
126.171.17.13
CBA Subnet (17)
UH Network (128.171)
The Internet
18
Figure 8.8: Routing Table
Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
1 128.171.0.0 255.255.0.0 (/16) 47 G 2
2 172.30.33.0 255.255.255.0 (/24) 0 Local 1
3 192.168.6.0 255.255.255.0 (/24) 12 G 2
Each Row Represents a Route to a Network or Subnet
For Each Arriving Packet,
The Packets Destination IP Address
Is Matched Against the Network/Subnet Field in Each Row
19
Figure 8.9: Masking
1. Basic Process
Information bit 1 1 0 0
Mask bit 1 0 1 0
Result 1 0 0 0


3. Example 1
IP Address 172. 30. 22. 7
Mask 255. 0. 0. 0
Result 172. 0. 0. 0
2. Common Patterns
Binary Decimal
00000000 0
11111111 255


4. Example 2
IP Address 172. 30. 22. 7
Mask 255. 255. 0. 0
Result 172. 30. 0. 0
20
Figure 8.8: Routing Table
Destination IP Address = 172.30.33.6

Row 1
Destination IP Address = 172.30.33.6
Mask = 255.255.0.0
Result = 172.30.0.0
No match to 128.171.0.0 Network/Subnet Field Value in Row
Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
1 128.171.0.0 255.255.0.0 (/16) 47 G 2
2 172.30.33.0 255.255.255.0 (/24) 0 Local 1
3 192.168.6.0 255.255.255.0 (/24) 12 G 2
21
Figure 8.8: Routing Table
Destination IP Address = 172.30.33.6

Row 2
Destination IP Address = 172.30.33.6
Mask = 255.255.255.0
Result = 172.30.33.0
Matches 172.30.33.0 Network/Subnet Field Value in Row
Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
1 128.171.0.0 255.255.0.0 (/16) 47 G 2
2 172.30.33.0 255.255.255.0 (/24) 0 Local 1
3 192.168.6.0 255.255.255.0 (/24) 12 G 2
22
Routing
For Each Incoming IP Packet
Destination IP address is matched against every row
in the routing table
If the routing table has 10,000 rows, 10,000
comparisons will be made for each packet
There can be multiple matching rows for a
destination IP address, corresponding to multiple
alternative routes
After all matches are found, the best match must be
selected

23
Figure 8.8: Routing Table
If only one row matches, it will be selected as
the best row match
Destination IP address = 192.168.6.7
Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
3 192.168.0.0 255.255.0.0 (/16) 12 G 2
24
Figure 8.8: Routing Table
The default row always matches
Mask 0.0.0.0 applied to anything results in 0.0.0.0
This always matches the Network/Subnet value
0.0.0.0
The router specified for this row (H) is the default
router

Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
15 0.0.0.0 0.0.0.0 (/0) 5 H 3
25
Figure 8.8: Routing Table
If there are multiple matches, the row with the
longest length of match is selected
This is Row 7 for 128.171.17.56 (24 bit match)
Longer matches often are routes to a particular subnet
within a network

Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
1 128.171.0.0 255.255.0.0 (/16) 47 G 2
7 127.171.17.0 255.255.255.0 (/24) 55 H 3
26
Figure 8.8: Routing Table
If there are multiple rows with the same lengths of
match, the metric column compares alternative
routes
If the metric is cost, the smallest metric wins (20)
If the metric is speed, the largest metric wins (34)

Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
5 172.29.8.0 255.255.255.0 (/24) 34 F 1
8 172.29.8.0 255.255.255.0 (/24) 20 H 3
27
The Situation
The router first evaluated the IP destination
address of the arriving packet against all rows
and noted the matching rows
The router then selected the best matching row
Now, the router examines the interface and
next-hop router fields in the best matching row
to determine what to do with the packet
28
Figure 8.8: Routing Table
The Interface is a port on the router
A subnet is attached to this interface
The subnet may have multiple hosts and next-hop
routers
NHR column specifies a specific NHR on that subnet
For Row 5, send packet to subnet on interface 1, to
NHR F

Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
5 172.29.8.0 255.255.255.0 (/24) 34 F 1
29
Figure 8.8: Routing Table
If Next-Hop Router Field says Local,
Then the destination host in on the subnet attached to
the interface (1)
Instead of sending the packet to a next-hop router on
the subnet, the router will send the packet to its
destination address

Row
Network/
Subnet
Mask (/Prefix)*
Metric
(Cost)
Next-
Hop
Router
Interface
2 172.30.33.0 255.255.255.0 (/24) 0 Local 1
30
Routing Recap
The router looks at the destination IP address in the
packet
First, the router compares this destination IP address
against all rows in the routing table to find matches
Second, the router selects the best row match among
matching rows
Third, the router sends the packet out the interface
indicated in the best-match row, to a next-hop router
(NHR) or destination host on the subnet attached to that
interface
31
Quiz
An IP address matches rows 112 and 456.
What row in the routing table will the router look
at first when it searches for matching rows?
(Trick question but one that illustrates a crucial
point)
32
Quiz
1,000 consecutive packets arrive, all going to
the same destination IP address
The routing table has 100,000 rows
This destination IP address matches two rows in
the routing table
In total, how many rows will the router have to
examine?
33
Figure 8.11: Routing Algorithm
For Each Packet:
First, for each row in the routing table, find
matches
Take destination IP address in packet
Mask it with the Mask in that row
Take the result
34
Figure 8.11: Routing Algorithm
For each row in the routing table find matches
Compare the result with the Network/Subnet value in
that row
If the result matches
Add the row to the list of matching rows for that
packet
Otherwise, ignore the row
35
Figure 8.11: Routing Algorithm
Second, find best match
If only one match, list row as best match
If longest match, list row as the best match
If tied longest length of match, select row with best
metric
May be the smallest value (say if metric is cost)
May be the longest value (say if metric is speed)
36
Figure 8.11: Routing Algorithm
Third, send the packet out a port
Send it out interface in best matching row to a host or
router on the network or subnet out that port
On that network or subnet, send packet to the
Next-hop-router value in the best row or to the
Destination host if next-hop router value in best
row says local
37
Routing Recap
The routing decision requires evaluating every row in
the routing table for each arriving IP packet, then
selecting the best match. This is time-consuming and
expensive.
Handling each packet separately and evaluating every
row for every arriving packet make routers very
expensive compared to switches for a comparable traffic
volume.
The root problem is that routers deal with multiple
alternative routes whereas switches only have a single
possible path
38
Figure 8.10: Routing Protocol
How do routers get the information in their
routing tables?
They exchange information with one another
They transmit Network/Subnet values with
associated masks and metrics for known routes
These exchanges are standardized by routing
protocols
39
Figure 8.10: Routing Protocol
Routing protocols
standardize how
routers share
routing table information
Network/Subnet values
and associated masks
Routing
Table
Information
Routing
Table
Information
Router Router
Router
Router
Router
40
Figure 8.12: Domain Name System (DNS)
Hierarchy
(root)
COM CA UK NET
Microsoft.com
CNN.com
Second-Level
Domain
Names
Top-Level
Domain Names
EDU
hawaii.edu
Subnet
voyager.cba.hawaii.edu
cba.hawaii.edu
NTL.cba.hawaii.edu
Host
Names
Domains are collections
of resources under the
control of a single
organization
41
Figure 8.13: Internet Control Message Protocol
(ICMP) for Supervisory Messages
Host Unreachable
Error Message
Router
Echo
Echo
Reply
ICMP Message IP Header
42
Figure 8.14: IPv4 and IPv6 Packets
Total Length
(16 bits)
Identification (16 bits)
Header Checksum (16 bits)
Time to Live
(8 bits)
Flags
Protocol (8 bits)
1=ICMP, 6=TCP,
17=TCP
Bit 0 Bit 31
IP Version 4 Packet
Source IP Address (32 bits)
Fragment Offset (13 bits)
Diff-Serv
(8 bits)
Header
Length
(4 bits)
Version
(4 bits)
Destination IP Address (32 bits)
Options (if any) Padding
Data Field
0100
43
Figure 8.14: IPv4 Packets
Version
Has value of four (0100)
Time to Live (TTL)
Prevents the endless circulation of mis-addressed
packets
Value is set by sender
Decremented by one by each router along the way
If reaches zero, router throws packet away
44
Figure 8.14: IPv4 Packets
Protocol
Identifies contents of data field
1 = ICMP
6 = TCP
17 =UDP
IP
Header
Data Field
ICMP, TCP, or UDP Message
45
Figure 8.14: IPv4 Packets
Header checksum to check for errors in the
header only
Faster than checking the whole packet
Stops bad headers from causing problems
IP Version 6 drops eve this checking
Address Fields
32 bits long, of course
Options field(s) give optional parameters
Data field contains the payload of the packet.
46
Figure 8.14: IPv4 and IPv6 Packets
Flow Label (20 bits)
Marks a packet as part of a specific flow
Payload Length (16 bits)
Next Header
(8 bits)
Name of next
header
Bit 0 Bit 31
IP Version 6 Packet
Source IP Address (128 bits)
Diff-Serv
(8 bits)
Version
(4 bits)
Hop Limit
(8 bits)
Destination IP Address (128 bits)
Next Header or Payload (Data Field)
0110
47
Figure 8.14: IPv6 Packets
Version: Has value of six (0110)
Hop Limit: Like TTL field in IPv4
Next Header
Like Protocol in v4 but also identifies option headers
Address Fields
128 bits each
Allows an almost infinite number of IP addresses
The big reason for IPv6
48
IP Packet
PC
Internet Process
Webserver
Internet Process
IP Packet
Close
(4)
Connectionless
Packets Sent in Isolation

Unreliable
No Error Correction
Discarded by Receiver if Error is Detected
(IPv6 Does Not Even Check for Errors)
Leaves Error Correction to Transport Layer
Reduces the Cost of Routers
49
Figure 8.15: TCP Segment
Source Port Number (16 bits) Destination Port Number (16 bits)
Sequence Number (32 bits)
First octet in data field
Acknowledgment Number (32 bits)
Last octet plus one in data field of TCP segment being acknowledged
Window Size
(16 bits)
Header Length
(4 bits)
Reserved
(6 bits)
Flag Fields
(6 bits)
Options (if any)
TCP Checksum (16 bits) Urgent Pointer (16 bits)
Padding
Data Field
Bit 0 Bit 31
Flag fields are one-bit fields. They include SYN, ACK, FIN and RST.
50
Figure 8.16: Transmission Control
Protocol (TCP) Time Diagram
PC
Transport Process
Webserver
Transport Process
1. SYN (Open)
2. SYN, ACK (1) (Acknowledgement of 1)
3. ACK (2)
Open
3-Way Open
TCP is a Connection-Oriented Protocol
51
Figure 8.16: Transmission Control
Protocol (TCP) Time Diagram
Acknowledgements
Each correct TCP segment is acknowledged, except
for pure acknowledgements and resets (later)
Sender listens to be sure that each TCP segment is
acknowledged
If a segment is not acknowledged in a reasonable
period of time, the sender resends it
TCP is a reliable protocol
52
TCP is Reliable
It is better to do error correction, just once, on
the source and destination host, than on every
router hop along the way.
X X
53
Figure 8.16: Transmission Control Protocol
(TCP) Time Diagram
PC
Transport Process
Webserver
Transport Process
1. SYN (Open)
2. SYN, ACK (1) (Acknowledgement of 1)
3. ACK (2)
4. Data = HTTP Request
5. ACK (4)
6. Data = HTTP Response
7. ACK (6)
Open
(3)
Carry
HTTP
Req &
Resp
(4)
After Opening, Data are Transferred
54
Figure 8.16: Transmission Control Protocol
(TCP) Time Diagram
PC
Transport Process
Webserver
Transport Process
12. FIN (Close)
13. ACK (12)
14. FIN
15. ACK (14)
Close
(4)
4-Way Close is Normal
55
Figure 8.16: Transmission Control Protocol
(TCP) Time Diagram
PC
Transport Process
Webserver
Transport Process
12. RST (Close)
Close
(4)
Reset
Abrupt Close
No Acknowledgement
Usually When There is an Error Condition
56
Servers
Use well-known port numbers for services
TCP Port 80 for HTTP
TCP Ports 20 and 21 for FTP
TCP Port 25 for SMTP (E-Mail)
<1024
Clients
Generate a random ephemeral port number >1024
for each connection
Figure 8.18: Use of TCP (and UDP) Port Numbers
Error
57
Figure 8.18: Use of TCP (and UDP) Port Numbers
Correction: The Book is Wrong
Well-known port numbers are 0 to 1023. These
are used by popular applications.
In UNIX, these are owned by root and are specially
protected
Registered port numbers (1024 to 49152) are
used for less central applications.
Ephemeral port numbers, then are 49153 to
65535)
58
Figure 8.18: Use of TCP (and UDP) Port Numbers
From 172.171.18.22:50247
To: 172.168.17.13:80
Client PC
172.171.18.22
Webserver
172.168.17.13
Port 80
SMTP Server
172.30.17.13
Port 25
From Ephemeral
Port 20247
To Well-Known
Port 80
Socket =
IP Address:Port Number
59
Figure 8.18: Use of TCP (and UDP) Port Numbers
From 172.168.17.13:80
To: 128.171.18.22:50247
Client PC
172.171.18.22
Webserver
172.168.17.13
Port 80
SMTP Server
172.30.17.13
Port 25
60
Figure 8.18: Use of TCP (and UDP) Port Numbers
From 172.171.18.22:50247
To: 172.168.17.13:80
From: 172.171.18.22.49345
To: 172.30.17.13:25
Client PC
172.171.18.22
Webserver
172.168.17.13
Port 80
SMTP Server
172.30.17.13
Port 25
From Ephemeral
Port 50247
To Well-Known
Port 80
From Ephemeral
Port 49345
Different ephemeral port
numbers for different
TCP connections
61
Figure 8.15: TCP Segments and UDP Datagrams
Sequence Port Number (16 bits) Destination Port Number (16 bits)
UDP Length (16 bits) UDP Checksum (16 bits)
Data Field
Bit 0 Bit 31
UDP Datagram
62
UDP Datagram
PC
Transport Process
Webserver
Transport Process
UDP Datagram
Close
(4)
Connectionless and Unreliable
Places a Lighter Load on the Network than TCP

Useful Where the Loss of an Occasional
Application Message is Not a Serious Problem
As in Regular Network Status Messages

Or Where There is No Time for Retransmission,
As in Voice Transmission
63
Figure 8.17: TCP Versus UDP
TCP UDP
Layer
Message name
Processing power
required
Reliability
Connections?
Transport Transport
TCP segment UDP datagram
Reliable Unreliable
Connection-oriented Connectionless
Heavyweight Lightweight
64
Figure 8.19: Layer 3 Switches and Routers
in Site Internets
Layer 3 switches
switch IP packets
rather than
Ethernet
frames.

Based on IP
addresses instead
of MAC addresses
Router
To
Other
Sites
Layer 3
Switch
Ethernet
Switch
Ethernet
Switch
65
Figure 8.19: Layer 3 Switches and Routers
in Site Internets
However, they are
usually limited to
IP and perhaps
IPX routing.

Also, they rarely
have WAN
interfaces or
non-Ethernet LAN
ports.
Router
To
Other
Sites
Layer 3
Switch
Ethernet
Switch
Ethernet
Switch
66
Figure 8.19: Layer 3 Switches and Routers
in Site Internets
Useful if all site
traffic is TCP/IP or at
most TCP/IP and
IPX/SPX

Usually still need a
full router at the site
edge to reach other
networks
Router
To
Other
Sites
Layer 3
Switch
Ethernet
Switch
Ethernet
Switch
67
Figure 8.19: Layer 3 Switches and Routers
in Site Internets
Layer 4 switches
also look at port
numbers in TCP
segments and
UDP datagrams.

This allows them to
prioritize traffic by
application type.
Router
To
Other
Sites
Layer 4
Switch
Ethernet
Switch
Ethernet
Switch

Das könnte Ihnen auch gefallen