Title: CS 2200 TCPIP
1CS 2200 TCP/IP
- (Lectures based on the work of Jay Brockman,
Sharon Hu, Randy Katz, Peter Kogge, Bill Leahy,
Ken MacKenzie, Richard Murphy, and Michael
Niemier)
2The Internet
- IP
- One protocol to rule them all
- Address assignment
- IP Routing (layer-3 switching)
- What exactly do we mean by this???
- Name Resolution
- ARP IP -gt ethernet MAC (media access control)
- DNS name -gt IP
- TCP
- Reliable in-order streams
- Built atop IP
- What exactly do we mean by this???
(i.e. how do we find the address of computer we
want to go to? 129.10.10.128 is more like a VA)
3Forming a WAN
Switch Site 1
Switch Site 4
Switch Site 2
Switch Site 3
4Physical 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
5Next Hop Forwarding
This table is for switch 2.
6Layer-2 Switches
- Each switch learns MAC addresses on its ports.
- Maintains a table of all MAC addresses seen
- For each packet, search the table(probably a
hash table)
48-bit MAC port 00423765fe01 1 0
0423765fe02 2 0197fbcd0137 2
7Scalability?
- Tables get large
- Must store all the MAC addresses in the universe
8WAN 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
9Internetworking
- Different networking solutions exist
- Why? No single networking technology is best for
all needs - Universal service
- System where any pair of computers can
communicate - Increases productivity
- Networks, by themselves, dont have universal
service - Solution Internetworking or an internet
Literally Communicating between networks of the
same and/or different types
10Step oneDefine universal packet format
11Step twoEncapsulate the universal packetsin
(any) local network frame format
Used to send msg. from 1 network to another (or
wi/the same)but we want a uniform standard.
Frame Header
Frame Data
Used to communicate within 1 network
12Physical Network Connection
Router
Router facilitates communication
between networks
Individual Networks
Each cloud represents arbitrary network
technology LAN, WAN, ethernet, token ring, ATM,
etc.
13Routers
- A router is
- A computer dedicated to the taskof
interconnecting networks. - A router can connect nets with different
technologies - different media, addressing schemes, or frame
formats
Router
14Router operation
- Unpack IP packet from frame format of source net
- Perform routing decision
- Pack IP packet into frame format of destination
net
15Virtual Network
16Virtual Network
17MTU and Fragmentation
- For any given network there is aMaximum
Transmission Unit (MTU) - If a datagram (packet) 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 - (Again, see the board 32 bytes?16 bytes?32
bytes)
18Reassembly
- Fragments are not re-assembled until final
destination - Why?
- Routers dont have to deal with
re-assembly.Packet arrives, router simply
forwards it - Allows routes to change dynamically.Cant
re-assemble if fragments take different paths.
19Example
Source Host
Net 1
header 1
Router 1
Net 2
header 2
Router 2
Net 3
header 3
Destination Host
20TCP/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)
21Layered Model
TCP/IP Model
Application
5
Transport
4
Internet
3
Network Interface
2
Physical
1
22Layer upon layer upon layer...
- Layer 1 Physical
- Basic network hardware (same as ISO model Layer
1) - Layer 2 Network Interface
- How to organize data into frames and how to
transmit over network (similar to ISO model Layer
2) - Layer 3 Internet
- Specify format of packets sent across the
internet as well as forwarding mechanisms used by
routers - Layer 4 Transport
- Like ISO Layer 4 specifies how to ensure reliable
transfer - Layer 5 Application
- Corresponds to ISO Layers 6 and 7. Each Layer 5
protocol specifies how one application uses an
internet
23IP Addresses
24IP 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 - (sound familiar???)
25IP 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.
26IP 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
2
Network 1
Network 2
3
3
5
27Guarantee
- 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
28How 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?
29More 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
30Five Classes of IP Address
31Five Classes of IP Address
Primary Classes
32Dotted 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
28
28
28
28
33Division 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
(on the board)
34Addressing 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
192.5.48.3
192.5.48.85
10.0.0.37
10.0.0.49
(on the board)
35Special IP Addresses
- Network Address
- Directed Broadcast Address
- Limited Broadcast Address
- This Computer Address
- Loopback Address
- Berkeley Broadcast Address Form
36Network 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
(quiz question)
37Directed Broadcast Address
- Often convenient to send a messageto all hosts
on a single network - Directed broadcast address formedby adding a
suffix containing all 1 bits - When direct broadcast message arrives to the
destination network, it is sent to all hosts
there via - Local networks hardware broadcast facility, or
- Individual messages sent to each host
(quiz question)
38Limited Broadcast Address
- Typically used on startup by a computerthat
doesn't yet know the network number - Message must contain all 1 bits
- Message remains on local net
(quiz question)
39This 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"
40Loopback 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
(goto print menu)
41Berkeley Broadcast Address Form
- UC Berkeley 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 Berkeley Implementation - Some can accept either, some both
42Special IP Address Summary
Prefix
Suffix
Type of Address
Purpose
All-0's
All-0's
This computer
Used during bootstarp
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
43Routers 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
44Example
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!
(on the board)
45Multi-homed Hosts
- Can a host have multiple network connections?
- Yes! Why?
- Increase reliability
- Increase performance
- Like router, need one address for each connection
46Address 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
47Resolving 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
48Address Resolution
A
C
E
R2
R1
B
D
F
49Address 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
50Address 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
address
51Address 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
52Address 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
53Address 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
54How 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
(more detail about items 1-3 on earlier slide)
55Table 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
56Table Lookup IIDirect Lookup
- Hardware Address
- 0A074B128236
- 0A9CBC71328D
- 0A119A680199
- 0A078290CC1F
- 0A7776EF0328
- 0A828F5ABEFA
Must also do array bounds checking
57Address 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
58Example
- 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
59Message 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
60Address 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 exchanged 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
61ARP Message Delivery
62ARP Message Delivery
63ARP Message Delivery
64ARP Message Delivery
65Caching 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).
66IP 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
(see board)
67Best-Effort Delivery
- IP does not handle the problems of
- Datagram duplication
- Delayed or out-of-order delivery
- Corruption of data
- Datagram loss
68IP Routing
69Physical 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
70Next Hop Forwarding
71Source 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
72Routing
- "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
73Table Size Reduction
Next Hop Information
Destination
Next Hop
1,anything
Int 2
2,anything
Local
3,anything
Int 4
4,anything
Int 3
74Testing Reachability
- Ping
- Sends an ICMP echo request message
- Starts a timer
- If no answer...retransmits, etc.
75Error 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
76Some 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
77Sample 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
78ICMP Message Transport
79ICMP 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!!!
80Using 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
81Tracing 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)
82TCP
83TCP 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
84Services Provided by TCP
- Connection Orientation
- Point-To-Point Communication
- Complete Reliability
- Full Duplex Communication
- Stream Interface
- Reliable Connection Startup
- Graceful Connection Shutdown
85End 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).
86Achieving 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
87Packet Loss and Retransmission
88Adaptive 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
89Buffers 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
90Aside Breaking TCP/IP
- Dont cooperate with congestion control
- ?