Title: CS2200 Presentation 26
1CS2200Presentation 26
- TCP/IP
- see
- Computer Networks and Internets
- Second Edition
- Douglas E. Comer
2Local Area Networks
- LAN Types
- Ethernet
- Token Ring
- LAN Components
- NIC
- Repeaters
- Bridges
- Switches
3Wide Area Networks
- Difference between LAN and WAN?
- Scalability
- Packet Switches
Connections to other packet switches
Connections to computers
4Forming a WAN
Switch Site 1
Switch Site 4
Switch Site 2
Switch Site 3
5Physical Addressing in a WAN
1,2
Switch Site 1
Switch Site 4
A
B
H
1,5
4,2
Switch Site 2
Switch Site 3
Hierarchical Addressing
C
F
E
D
G
2,2
2,6
3,1
3,4
3,7
6Next Hop Forwarding
7Source Independence
- Forwarding is only based on destination
- Example
- Passengers arriving in Atlanta from Boston, Los
Angeles and Midtown all look in one place to find
where to board flight to Miami - Allows compact tables and a single mechanism for
handling forwarding
8Routing
- "Next Hop Information" table is commonly called a
routing table. - Process of forwarding a packet to its next hop is
known as routing. - Hierarchical addressing (i.e. 1,2)
- Computation can be reduced
- Routing table can be made shorter
9Table Size Reduction
Next Hop Information
Destination
Next Hop
1,anything
Int 2
2,anything
Local
3,anything
Int 4
4,anything
Int 3
10Routing in a WAN
- As mentioned key element of WAN is scalability
- Capacity of a WAN may be increased by adding
packet switches (without attached computers) to
the interior of the network - Exterior switches have attched computers
- Interior switches do not
- Each switch must have routing table and be able
to forward packets - Each routing table must be able to handle all
possible addresses - Tables must point to shortest route (Optimal)
11Routing in a WAN
4
1
3
2
12Routing Tables
13Use of Default Routes
Node 1
Node 2
Node 3
Node 4
Dest
Next Hop
Dest
Next Hop
Dest
Next Hop
Dest
Next Hop
1
-
1
(2,1)
3
-
3
(4,3)
(1,2)
2
-
4
(3,4)
4
-
3
(2,3)
(3,2)
(4,2)
4
(2,4)
14Routing Table Computation
- Routing tables are computed automatically
- Two basic approached are used
- Static routing
- Program runs when packet switch boots
- Advantages Simple with low network overhead
- Disadvantage Inflexible
- Dynamic routing
- Program builds routing table on boot and then as
conditions change adjusts table - Advantage Allows network to handle problems
automatically
15WAN Technologies
- ARPANET
- One of the first packet switched networks
- X.25
- CCITT X.25
- Popular in Europe
- Originally for ASCII to Host connections
- Frame Relay
- Originally designed to bridge LAN segments
- SMDS (Switched Multi-megabit Data Service)
- ATM (Asynchronous Transfer Mode)
- Intended for voice, video and data over wide
areas - Uses fixed size cells
- Can specify quality of service required
16Internetworking
- Different networking solutions exist
- Why? No single networking technology is best for
all needs - Universal service
- System where arbitrary pairs of computers can
communicate - Increases productivity
- Networks, by themselves, are incompatible with
universal service - Solution Internetworking or an internet
17Physical Network Connection
Router
Individual Networks
Each cloud represents arbitrary network
technology LAN, WAN, ethernet, token ring, ATM,
etc.
18 Router
A router is a special-purpose computer dedicated
to the task of interconnecting networks. A router
can interconnect networks that use different
technologies, including different media, physical
addressing schemes or frame formats.
19Virtual Network
20Virtual Network
21TCP/IP
- A number of different protocols have been
developed to permit internetworking - TCP/IP (actually a suite of protocols) was the
first developed. - Work began in 1970 (same time as LAN's were
developed) - Most of the development of TCP/IP was funded by
the US Government (ARPA)
22Layered Model
Application
5
Transport
4
Network
3
Datalink
2
Physical
1
23Layer upon layer upon layer...
- Layer 5 Application
- Corresponds to ISO Layers 6 and 7. Each Layer 5
protocol specifies how one application uses an
internet - Layer 4 Transport
- Like ISO Layer 4 specifies how to ensure reliable
transfer - Layer 3 Network
- Specify format of packets sent across the
internet as well as forwarding mechanisms used by
routers - Layer 2 Datalink
- How to organize data into frames and how to
transmit over network (similar to ISO model Layer
2) - Layer 1 Physical
- Basic network hardware (same as ISO model Layer 1)
24Layer upon layer upon layer...
- Layer 5 Application
- Sends application specific messages
- Layer 4 Transport
- Sends segments
- Layer 3 Network
- Sends packets
- Layer 2 Datalink
- Sends frames
- Layer 1 Physical
- Sends bits
25Host Computers, Routers and Protocol Layers
- Host computer (or sometimes "Host")
- Any computer system that connects to an internet
and runs applications - Use all layers of TCP/IP model
- Router
- Connect networks to form internet
- Do not use protocols from all layers of TCP/IP
- In particular, does not use layer 5
26IP Internet Protocol Addresses
- Recall The various networking schemes (LAN's and
WAN's) we discussed used physical addresses - To achieve a seamless network with universal
connectivity we need addresses for the virtual
internet - The internet is an abstraction created in
software which can use addresses, packet format
and delivery techniques independent of the
physical hardware
27IP Addressing
- Each host in the internet must have a unique
address - Users, application programs and software
operating in the higher layers of the protocol
stack use these addresses - In the IP protocol each host is assigned a unique
32 bit address. Any packet destined for a host on
the internet will contain the destination IP
address.
28IP Address Hierarchy
- Addresses are broken into a prefix and a suffix
for routing efficiency - The Prefix is uniquely assigned to an individual
network. - The Suffix is uniquely assigned to a host within
a given network
1
1
Network 1
2
Network 2
3
3
5
29Guarantee
- Each computer has a unique address
- The full address contains both a prefix and a
suffix assigned to guarantee uniqueness. - Although network numbers must be assigned
globally, suffixes can be assigned locally
without global coordination
30How many bits?
- How should the 32 bit address be divided?
- In other words how many bits for prefix, how many
for suffix? - 8 for prefix, 24 for suffix
- 16 for each
- 24 for prefix, 8 for suffix
- None of the above
- All of the above, sort of.
31How many bits?
- How should the 32 bit address be divided?
- In other words how many bits for prefix, how many
for suffix? - Example 1
- 16 bits for each
- 65536 max networks, 65536 max hosts/network
- Example 2
- 24 bits for prefix, 8 bits for suffix
- 8,388,608 max networks, 256 max hosts/network
- Other possibilities?
32More Flexible System
- Create system with different classes of address.
Each class has different size for the prefix and
the suffix - (Up to) the first 4 bits determine the class
- Five classes are defined
33Five Classes of IP Address
34Five Classes of IP Address
Primary Classes
35Computingthe Class
36Dotted Decimal Notation
- Conventionally 32 bit IP addresses are expressed
in dotted decimal notation - Each byte is expressed as a decimal number
(0-255). The bytes are separated by decimal
points - Addresses range from 0.0.0.0 to 255.255.255.255
37Classes and Dotted Decimal
- Range of Values
- 0 through 127
- 128 through 191
- 192 through 223
- 224 through 239
- 240 through 255
38Division of the Address Space
Address Class
Bits in Prefix
Maximum Number of Networks
Bits in Suffix
Maximum Number of Hosts per Network
A B C
7 14 21
128 16384 2097152
24 16 8
16777216 65536 256
39Addressing Example
128.10
128.211
128.10.0.1
128.10.0.2
128.211.28.4
128.211.6.115
10
192.5.48
10.0.0.37
10.0.0.49
192.5.48.3
192.5.48.85
40Special IP Addresses
- Network Address
- Directed Broadcast Address
- Limited Broadcast Address
- This Computer Address
- Loopback Address
- Berkley Broadcast Address Form
41Network Address
- Useful to have an address which represents a
network - Formed by adding a 0 suffix
- Example
- 128.10 ? 128.10.0.0
- 10 ? 10.0.0.0
- 192.5.48 ? 192.5.48.0
- A network address should never appear as a
destination in a packet
42Directed Broadcast Address
- Often convenient to send a message to all hosts
on a single network - Directed broadcast address formed by adding a
suffix containing all 1 bits - Once the direct broadcast message arrives in the
destination network it is sent to all hosts on
the network via - The local networks hardware broadcast facility or
if none present - Individual messages sent to each host
43Limited Broadcast Address
- Typically used on startup by a computer that
doesn't yet know the network number - Message must contain all 1 bits
- Message remains on local net
44This Computer Address
- A computer needs to know its IP address to send
or receive internet packets - TCP/IP contains protocols which allow a computer
to obtain its IP address automatically when it
boots - These startup protocols use IP to communicate
- Sending an IP packet requires a source address
- Address 0.0.0.0 means "this computer"
45Loopback Address
- During testing it is often convenient to have two
applications which will eventually communicate,
run on the same computer. - A message can travel down the stack from one
application and back up the stack to the other
application - IP reserves class A network prefix 127 for this
purpose (the suffix doesn't matter) - By convention 127.0.0.1 is most often used
46Berkley Broadcast Address Form
- UC Berkley developed and distributed an early
version of TCP/IP as part of BSD UNIX - Instead of a directed broadcast address suffix of
all 1 bits they used a suffix of all 0 bits. This
is known as a Berkley Broadcast - Many early computer manufacturers derived their
software from the Berkley Implementation - Some can accept either, some both
47Special IP Address Summary
Prefix
Suffix
Type of Address
Purpose
All-0's
All-0's
This computer
Used during bootstrap
Network
All-0's
Network
Identifies a network
Network
all-1's
Directed broadcast
Broadcast on specified net
All-1's
All-1's
Limited broadcast
Broadcast on local net
127
Any
Loopback
Testing
Network
All-0's
Directed broadcast
Berkley broadcast
48Routers and IP Addressing
- Each host has an address
- Each router has two (or more) addresses!
- Why?
- A router has connections to multiple physical
networks - Each IP address contains a prefix that specifies
a physical network - An IP address does not really identify a specific
computer but rather a connection between a
computer and a network. - A computer with multiple network connections
(e.g. a router) must be assigned an IP address
for each connection
49Example
Ethernet 131.108.0.0
Token Ring 223.240.129.0
131.108.99.5
223.240.129.2
223.240.129.17
78.0.0.17
WAN 78.0.0.0
Note!
50Multi-homed Hosts
- Can a host have multiple network connections?
- Yes! Why?
- Increase reliability
- Increase performance
- Like router, need one address for each connection
51Address Resolution Protocol
- IP addresses are virtual
- LAN/WAN hardware doesn't understand IP addresses
- Frame transmitted across a network must have
hardware address of destination (in that network) - Three basic mechanisms for resolving addresses
52Resolving Addresses
- 1. Address translation table
- Used primarily in WAN's
- 2. Translation by mathematical function
- 3. Distributed computation across network
- Protocol addresses are abstractions
- Physical hardware does not know how to locate a
computer from its protocol addess - Protocol address of next hop must be must be
translated to hardware address
53Address Resolution
A
C
E
R2
R1
B
D
F
54Address Resolution
A
C
E
R2
R1
B
D
F
Application sends message from A to B using B's
IP address Protocol software on A resolves IP
address of B to physical hardware address and
sends frame directly using hardware address
55Address Resolution
A
C
E
R2
R1
B
D
F
Application sends message from A to F using F's
IP address Software on A does NOT resolve F's
MAC address
56Address Resolution
A
C
E
R2
R1
B
D
F
Application sends message from A to F using F's
IP address Software on A first determines that
message must pass through router R1. Address of
R1 is resolved and message is sent to R1
57Address Resolution
A
C
E
R2
R1
B
D
F
Application sends message from A to F using F's
IP address Software on R1 determines that
message must pass through router R2. Address of
R2 is resolved and message is sent to R2
58Address Resolution
A
C
E
R2
R1
B
D
F
Application sends message from A to F using F's
IP address Software on R2 determines that
message is intended for host on local net.
Address of F is resolved by R2 and message is
sent to F
59How to Resolve Addresses
- Table Lookup
- Store bindings/mapping in table which software
can search - Closed-form Computation
- Protocol addresses are chosen to allow
computation of hardware address from protocol
address using basic boolean and arithmetic
operations - Message Exchange
- Computers exchange messages across a network to
resolve addresses. One computer sends a message
requesting a translation and another computer
replies
60Table Lookup I
- IP Address
- 197.15.3.2
- 197.15.3.3
- 197.15.3.4
- 197.15.3.5
- 197.15.3.6
- 197.15.3.7
- Hardware Address
- 0A074B128236
- 0A9CBC71328D
- 0A119A680199
- 0A078290CC1F
- 0A7776EF0328
- 0A828F5ABEFA
For large tables may use hashing or direct lookup
61Table Lookup IIDirect Lookup
- Hardware Address
- 0A074B128236
- 0A9CBC71328D
- 0A119A680199
- 0A078290CC1F
- 0A7776EF0328
- 0A828F5ABEFA
Must also do array bounds checking
62Address Resolution with Closed-form Computation
- Some networks have configurable hardware
addresses - NIC can be assigned any physical address
- By judiciously selecting hardware and IP
addresses, efficient computation of a hardware
address can be made from an IP address
63Example
- IP Address
- network 220.123.5.0
- 220.123.5.1
- 220.123.5.2
- 220.123.5.3
- 220.123.5.4
- 220.123.5.5
- Assigned Hardware Address
- 1
- 2
- 3
- 4
- 5
hardwareAddress IPAddress 0xFF
64Message Exchange
- Computer needing address resolved sends message
across network - The message carries an address that needs to be
resolved - The reply contains the appropriate hardware
address - Two possible designs
- Special address resolution servers are
established known to computers on net - Request is broadcast to net and each computer is
responsible for replying when request is for its
address
65Address Resolution Protocol
- TCP/IP can use any of the three methods
- Table lookup usually used in a WAN
- Closed-form computation is used with configurable
networks - Message exchange used in LAN's with static
addressing - To insure that all computers agree TCP/IP
includes an Address Resolution Protocol - Two types of messages are supported
- Request a hardware address given a protocol
address - Reply containing IP Address and hardware request
66ARP Message Delivery
67ARP Message Delivery
68ARP Message Delivery
69ARP Message Delivery
70Caching ARP Responses
- When a ARP response is received the result is
cached (new responses replace old ones) - Cache size is limited
- Entries are removed after some amount of time if
unused (e.g. 20 minutes) - When an ARP response is sent, the sender puts the
address binding in its cache - Communication is typically two-way
- Space is limited (i.e. computers do not attempt
to listen to the net and store all addressing
information that passes).
71IP Datagrams and Datagram Forwarding
- At the IP layer the service provided is
connectionless - Messages are sent and forwarded across network
- Service is not reliable!
- The packet used by IP to send information is
called an IP Datagram - The IP Datagram will be placed into physical
frames
72IP Addresses and Routing Table Entries
73IP Addresses and Routing Table Entries
R1
R2
R3
Assume message with IP address
192.4.10.3 arrives at router R2
for each entry in table if(Mask Addr)
Dest forward to NextHop
74Best-Effort Delivery
- IP does not handle the problems of
- Datagram duplication
- Delayed or out-of-order delivery
- Corruption of data
- Datagram loss
75IP Encapsulation
Frame Header
Frame Data
76Transmission Across an Internet
Source Host
Net 1
header 1
Router 1
Net 2
header 2
Router 2
Net 3
header 3
Destination Host
77MTU and Fragmentation
- For any given network there is a Maximum
Transmission Unit or MTU - If a datagram arrives at a network an exceeds the
MTU the protocol software will break the Datagram
up into smaller pieces called fragments - The format of a fragment is the same except for
bits which are set to indicate a fragment
78Reassembly
- Fragments are never reassembled until the final
destination - Why?
- Reduce amount of state information in routers.
When packets arrive at a router they can simply
be forwarded - Allows routes to change dynamically. Intermediate
reassembly would be problematic if all fragments
didn't arrive.
79Error Reporting (ICMP)
- TCP/IP includes a protocol used by IP to send
messages when problems are detected Internet
Control Message Protocol - IP uses ICMP to signal problems
- ICMP uses IP to send messages
- When IP detects an error (e.g. corrupt packet) it
sends an ICMP packet - Exception Problems with ICMP messages are not
reported? Why?
80Some ICMP Messages
- Echo Reply
- Destination unreachable
- Source quench
- Redirect
- Alternate host address
- Echo
- Router advertisement
- Router selection
- Time exceeded
- Parameter problem
13 14 15 16 17 18 30 31 Note Max message 255
Timestamp Timestamp reply Info request Info
reply Addr mask req Addr mask reply Traceroute Dat
agram conv error
81Sample Messages
- Source Quench - Sent by router when out of buffer
space (and discards a datagram). Sent to the
originator of the datagram. Sender must reduce
transmission rate. - Time Exceeded - Sent by router when discarding a
datagram whose Time to Live field has reached 0.
Also, sent if reassembly timer expires before all
fragments have arrived. - Destination Unreachable - Router that determines
a message cannot be delivered to its final
destination sends to originator - An entire network is disconnected from internet
- A given host is offline
- Note Some ICMP messages are not error messages
82ICMP Message Transport
83ICMP Message Transport
- Where should ICMP message be sent?
- ICMP messages are always created in response to a
Datagram. - Router sends ICMP message to source of datagram
- What happens if Datagram containing ICMP message
encounters an error - Nothing!!!
84Testing Reachability
- Ping
- Sends an ICMP echo request message
- Starts a timer
- If no answer...retransmits, etc.
85Using ICMP to Trace a Route
- Datagram has "TIME TO LIVE" field.
- Upon reaching a router the "TIME TO LIVE" field
is decremented - If the field reaches 0, Datagram is discarded and
ICMP message is sent to originator - We can use this operation to trace a route
86Tracing a Route
- Send a Datagram to the destination with the "TIME
TO LIVE" field set to 1 - At the first router "TIME TO LIVE" will be set to
0 and an ICMP message will be returned - Send a Datagram to the destination with the "TIME
TO LIVE" field set to 2 - etc.
- (Some details omitted)
87TCP Reliable Transport Service
- TCP must use an inherently unreliable service,
IP, to provide reliable service - TCP must supply a service that guarantees
- Prompt, reliable communication
- Data delivery in the same order sent
- No loss
- No duplication
88Services Provided by TCP
- Connection Orientation
- Point-To-Point Communication
- Complete Reliability
- Full Duplex Communication
- Stream Interface
- Reliable Connection Startup
- Graceful Connection Shutdown
89End to End Services
- TCP provides a connection from one application on
a computer to an application on a remote computer - Connection is virtual - provided by software
passing messages - TCP messages are encapsulated in IP Datagrams
- Upon arrival IP passes the TCP message on to the
TCP layer. - TCP exists at both end of the connection but not
at intermediate points (routers).
90(No Transcript)
91Achieving Reliability
- Causes of problems
- Failure of the IP system to deliver information
reliably - Messages may be duplicated, lost, delayed or
delivered out of order - Reboot of a host computer
- Two programs make a connection
- One computer reboots
- New connection is formed
- Messages from first session now arrive
92Packet Loss and Retransmission
- Host 1
- Send message 1
- Start timer
- Receive ack 1
- Send message 2
- Start timer
- Timer expires
- Retransmit message 2
- Start timer
- Receive ack 2
- Host 2
- Receive message 1
- Send ack 1
- Receive message 2
- Send ack 2
Packet Loss
How long to set timer for?
93Adaptive Retransmission
- Whenever TCP sends a message it records the time
and then the time when a response is received - A statistical function is used to maintain a
current estimate of expected delay - Timer can be set to a value depending on
- Stable conditions
- Increasing delay
- Decreasing delay
94Buffers and Windows
- Receiving host can have a buffer
- Acknowledgements can contain amount of free
buffer space available (Window) - Sender will not send more data than buffer will
hold - As buffer space increases (i.e. application
consumes data from buffer) additional acks can be
sent updating buffer space available
95Congestion Control
- Upon sensing congestion (lost message)
- Send a single message
- If received okay
- Send twice as much data
- Keep increasing until amount of data is 50 of
receivers advertised window size
96Client-Server Interaction
- An internet system provides a basic communication
service - The protocol software cannot initiate contact
with or accept contact from another computer - Instead, applications programs must participate
in any communications - One application initiates communication
- Client
- One application accepts communication
- Server
97Sockets
- There must be an API between the application
software and the communication protocol software - A common (de facto standard) is the socket
interface - BSD
- Solaris
- Windows
- Open-Read-Write-Close Paradigm
98Procedures
- descriptor socket(protofamily, type, protocol)
- protofamily TCP/IP, DECNET
- type Connection oriented stream
- Connectionless oriented message
- protocol Particular transport model (e.g. TCP)
- close(socket)
- bind(socket, localaddr, addrlen)
- listen(socket, queuesize)
- newsock accept(socket, caddress, caddresslen)
- connect(socket, saddress, saddresslen)
- send(socket, data, length, flags)
- sendto(socket, data, length, flags, destaddress,
adresslen) - recv(socket, buffer, length, flags)
- recvfrom(socket, buffer, length, flags, sndraddr,
saddrlen)
99Proxy Server
- A server that sits between a client application,
such as a Web browser, and a real server. It
intercepts all requests to the real server to see
if it can fulfill the requests itself. If not, it
forwards the request to the real server.
100Purpose of Proxy Server
- Improve Performance
- A proxy server can dramatically improve
performance for groups of users. - It saves the results of all requests for a
certain amount of time. - Example
- Both user X and user Y access the World Wide Web
through a proxy server. - User X requests a certain Web page, which we'll
call Page 1. - Sometime later, user Y requests the same page.
- Instead of forwarding the request to the Web
server where Page 1 resides, which can be a
time-consuming operation, the proxy server simply
returns the Page 1 that it already fetched for
user X. - Since the proxy server is often on the same
network as the user, this is a much faster
operation. - Real proxy servers support hundreds or thousands
of users. - The major online services such as Compuserve and
America Online, for example, employ an array of
proxy servers.
101Purpose of Proxy Server
- Filter Requests
- Proxy servers can also be used to filter
requests. - Example A company might use a proxy server to
prevent its employees from accessing a specific
set of Web sites.
102Questions?
103(No Transcript)