1 cmpt 471 networking ii some important internetworking concepts © janice regan, 2013
TRANSCRIPT
1
CMPT 471Networking II
Some important Internetworking
concepts
© Janice Regan, 2013
© Janice Regan, 2013 2
© Janice Regan, 2013 3
Internetworking Requirements
Provides linkage between networks Minimum physical and link layer
Provides routing and delivery of data between processes on different networks
Provides accounting services and maintains status information
Supports services for users and the network Provides these services independent of
individual network architectures, and must accommodate differences between networks
© Janice Regan, 2013 4
Architectural Approaches: 1 Connection oriented (reliable) delivery service
Delivered using a sustained connection across the network between two machines
The connection is initiated or built before it can be used The connection, once established delivers data streams
between the endpoints of the connection (a full duplex connection will have 1 data stream in each direction)
The connection is terminated when the application is finished using it
Resources for the circuit are allocated to connection. If circuit is idle then resources are unused and unavailable to other circuits
© Janice Regan, 2013 5
Architectural Approaches: 2 Connectionless
Stream of data is divided into pieces Each piece is encapsulated in a packet by adding a
header containing all information needed to get the packet to its destination
Each packet is sent independently and is individually routed through the network
Different packets from the same data stream may take different paths through the internet
Packets may arrive in an order different from the order in which they were sent (different paths = different travel times)
© Janice Regan, 2013 6
Architectural Approaches: 1 Connection oriented (reliable) delivery services
Support for quality of service simple Failure of any router in the circuit will cause failure of
the connection Path setup overhead but reduced routing overhead
(routing done once not for each packet) Router table space needed for every connection
passing through the router (may need less table space for address for a connection, but will need an entry for each connection not each network)
All networks involved must be circuit switched networks (pass through switching)
© Janice Regan, 2013 7
Architectural Approaches: 2 Connectionless
Support for quality of service is difficult Delivery will not fail if a single
intermediate router fails Extra overhead in routing, must
separately route each packet No congestion control available Best effort (not reliable) transmission of
packets
© Janice Regan, 2013 8
Connectionless Internetworking Advantages
Flexible and Robust Minimal overhead (no connection overhead)
Disadvantages Delivery not guaranteed Order of delivery not guaranteed Reliability is responsibility of next layer up
(e.g. TCP, transport layer builds a virtual circuit)
© Janice Regan, 2013 9
Internetworking Protocols
© Janice Regan, 2013 10
© Janice Regan, 2013 11
Encapsulation Data is transferred in blocks called Protocol
Data Units (PDU) Each PDU contains control information and
sometimes data Control Information includes
Address Error Detection code Protocol Control
The addition of control information to data is referred to as Encapsulation
© Janice Regan, 2013 12Figure 2.14 Stallings (2003)
Transport layer
Network layer
Data link layer (e.g. ethernet)
port
ip address
MAC address
Encapsulation: Protocol Data Units in the TCP/IP Architecture
© Janice Regan, 2013 13
Protocol functions: IP (network) layer
Routing Determining a path through the Internet through a series of
hosts/routers to the destination Addressing/ Forwarding
Sending packets along the determined path Datagram lifetime
Removing packets that are ‘lost’ or ‘damaged’ Fragmentation and re-assembly
Dealing with networks having different maximum datagram sizes
Error control, Flow control Connection management (if needed) Transmission services
© Janice Regan, 2013 14
Addressing: Each Internet Protocol address (IP address)
must be globally applicable and globally unique Must have global nonambiguity, must uniquely
identify the host and interface globally Must have global applicablity, must be accessible
via address from any other node on the Internet IP addresses are used to route PDU from the
destination through ISs to the destination. Routes the PDU through the internet or Internet.
© Janice Regan, 2013 15
Internet addresses IPv4 32 bit global internet (IPv4) address is used to uniquely
identify a particular network interface connected to a particular host as a destination for communication
Each IPv4 address is split into two parts (netid, hostid) to identify the host and the network to which the host is connected
The netid (network address or prefix) identifies the network to which the host belongs.
The hostid identifies the particular host (network interface for a multi homed host)
© Janice Regan, 2013 16
Internet addresses IPv6 128 bit global (IPv6) address is used to uniquely identify
a particular network interface connected to a particular host as a destination for communication
Each IPv6 address is split into three parts (global routing prefix, subnet ID, interface identifier)
The global routing prefix (48 bits) identifies the network to which the host belongs (like an IPv4 netid).
The subnet ID (16 bits) is used to create a subnet structure within the network
The interface identifier (64 bits) indicates the particular host (like IPv4 host ID)
© Janice Regan, 2013 17
Addressing: connection identifiers For a connection oriented network, a
connection identifier may be used rather than a global address
The connection identifier is smaller (fewer bits) and creates less overhead
Connection identifier indicates route to Intermediate stations
End systems maintain flow and state information for the connection identified
© Janice Regan, 2013 18
Deciding where to go Need to determine a path for a packet (or message) to
take through a network
Two major components are required to determine such a path
Routing Building a routing table for each host and router.
Forwarding: Using the routing tables at each IS to determine the most
efficient path to the destination.
© Janice Regan, 2013 19
Where to go? Routing Routing: Building a routing table for each host
and router. A routing table indicates which of the router’s ( host’s)
network interfaces provides the most direct path to each possible IP destination address
The entries in a routing table are determined statically (input by administrator) or dynamically using time varying routing data sent between routers and a routing algorithm
© Janice Regan, 2013 20
Where to go? Forwarding Forwarding:
Using the routing tables at each intermediate router to determine the most efficient path to the destination.
At each intermediate router find the ‘best’ interface to send the packet through.
Simple algorithm for forwarding
Each row of routing table represents one network (or host).
For each row determine if the destination address is part of the network
If it is add that row to the list of possible candidates for forwarding
Choose the ‘best’ (longest match) of the candidates for forwarding
Use the information in the row for the ‘best’ network to forward the packet
© Janice Regan, 2013 21
A sample routing table IPv4Destination Gateway Genmask Metric Iface
172.17.1.253 * 255.255.255.255 0 Eth1
172.16.1.253 * 255.255.255.255 0 Eth0
172.16.0.0 * 255.255.0.0 0 Eth0
172.17.0.0 * 255.255.0.0 0 Eth1
172.18.0.0 172.16.1.254 255.255.0.0 1 Eth0
172.19.0.0 172.17.1.2 255.255.0.0 1 Eth0
127.0.0.0 * 255.0.0.0 0 Lo
224.0.0.0 * 240.0.0.0 0 Eth0
0.0.0.0 172.16.1.1 0.0.0.0 0 Eth0
A sample routing table IPv6
© Janice Regan, 2013 22
Destination Next Hop Flag Met Ref Use If::1/128 :: Un 0 1 41 lofdd0:8184:d967:25::a19:106/128 fdd0:8184:d967:29::a1d:109 UG 1024 0 203 eth1fdd0:8184:d967:26::/64 fdd0:8184:d967:30::a1e:108 UG 1024 0 122 eth2fdd0:8184:d967:29::/128 :: Un 0 2 0 lofdd0:8184:d967:29::a1d:10a/128 :: Un 0 1 350 lofdd0:8184:d967:29::/64 :: U 256 0 1 eth1fdd0:8184:d967:30::/128 :: Un 0 2 0 lofdd0:8184:d967:30::a1e:10a/128 :: Un 0 1 392 lofdd0:8184:d967:30::/64 :: U 256 0 1 eth2 fe80::250:56ff:fea4:1795/128 :: Un 0 1 74 lofe80::250:56ff:fea4:59c9/128 :: Un 0 1 63 lofe80::250:56ff:fea4:764f/128 :: Un 0 1 0 lofe80::/64 :: U 256 0 0 eth1fe80::/64 :: U 256 0 0 eth2fe80::/64 :: U 256 0 0 eth0::/0
© Janice Regan, 2013 23
Datagram Lifetime Datagrams could loop indefinitely
Problems with routing or addressing can cause datagrams to travel in circles or on circuitous paths rather than reach their destination promptly
Consumes resources Internet protocol may need upper bound on datagram life
Datagram marked with lifetime Time To Live field in IP Once lifetime expires, datagram discarded (not forwarded) Hop count: Decrement time to live on passing through a each
router Time count: Need to know how long since last router
© Janice Regan, 2013 24
Fragmentation / Reassembly Each protocol has a maximum size for it’s own
PDUs. This maximum is different for different protocols
The data in the PDU must be broken into smaller pieces or fragmented if the PDU is too large for a network it passes through
The data in the fragmented PDU is reassembled, usually at the receiver
© Janice Regan, 2013 25
Why fragment? A PDU from another network exceeds the maximum
allowed size for the next network through which it will travel
To improve efficiency or error control. Fewer bits need to be retransmitted (reduce PDU size)
More equitable sharing of facilities Reduced buffers needed at stations But remember the costs
Increased overhead of control information More interrupts, may increase processing time
26
CMPT 471Networking II
Review of TCP/UDP
The transport layer
© Janice Regan, 2013
© Janice Regan, 2013 27
The transport layer Processes use a transport protocol communicate end to
end. (reliably using TCP or best effort using UDP) Data-link and network layer protocols communicate hop
by hop, forming a communications channel for the transport layer
The transport layer shields the application processes from the details of the underlying communications channel
The transport layer specifies a particular application process as the source or destination. Lower layers specify at most the protocol in the next layer up
© Janice Regan, 2013 28
© Janice Regan, 2013 29
Transport protocols May provide best effort delivery of packets (UDP)
Application accepts responsibility for reliability May provide a connection oriented reliable
communication channel (TCP) either On top of a best effort packet switched network (IP with
unacknowledged connectionless LLC layer) On top of a reliable network service (IP with acknowledged
connectionless services) May support multiplexing (particularly useful for circuit
switch or virtual circuit networks using flows) Combine multiple low rate flows through 1 port Spread high rate flow between multiple ports
UDP: best effort transmission Addressing Multiplexing
Using one UDP port for all UDP traffic
Error control What happens when an error occurs Usually the packet is lost
Ordering Reordering received packets to be in same order they were
sent
© Janice Regan, 2013 30
© Janice Regan, 2013 31
Multiplexing of flows
© Janice Regan, 2013 32
TCP: reliable transmission Addressing Multiplexing Flow control Logical connection establishment Logical connection maintenance Logical connection termination error control reorder packets received the application
© Janice Regan, 2013 33
Addressing User specified by:
User identification Specify Host and Port (may be socket in TCP or UDP) Port represents particular process or protocol Host is specified by an IP address Several processes on a given machine may be multiplexed
together and use a single protocol port Protocol port identification specified by an integer
usually one protocol port for of each protocol type (TCP, UDP)
General port identification specified by an integer
© Janice Regan, 2013 34
Finding Port Addresses: 1 Static configuration:
Know address ahead of time Universal assignment:
Central authority (IANA) assigns port numbers to common protocols. The list is published
All software uses this list of protocols/ports Any host receiving a particular protocol will have a
server process for that protocol which can be accessed through the assigned protocol port number
Ports 0-1023 are reserved for this IANA list Ports 1024-49151 are registered (use list exists) not
reserved
© Janice Regan, 2013 35
Finding Port Addresses: 2 Name server: Server on a well known port
can be queried to determine the port for the particular application
Instance server: server on a well know port will create an instance of the application and return the appropriate port to attach to that instance
© Janice Regan, 2013 36
Well Know port numbers
© Janice Regan, 2013 37
Structure of a TCP segment
Comer 2000: fig 13.7
SOURCE PORT DESTINATION PORT
CHECKSUM
© Janice Regan, 2013 38
Code Bits (1) The code bits field contains a set of 6 flags
The ACK SYN and FIN flags produce packets used in the three way handshake to establish a TCP connection.
© Janice Regan, 2013 39
Code Bits (2) ACK must be set if the frame contains a
valid acknowledgement PSH requests that data be sent immediately
rather than waiting for enough data to fill a packet
When the urgent flag is set the value of the urgent pointer field added to the sequence number indicates the end (last octet) of a block of data that needs immediate delivery. Flag stays set until urgent data is delivered. The start of the urgent data is not marked.
© Janice Regan, 2013 40
Structure of a TCP segment
Comer 2000: fig 13.7
SEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBER
WINDOW
© Janice Regan, 2013 41
Sequence number (1) A TCP connection is a full duplex (capable of sending
data in both direction simultaneously) connection with data flowing in both directions
A TCP segment contains both a TCP header and a variable number of data octets
Consider two data streams, the data going from host1 to host2 and the data going from host2 to host1
Separately consider each of these data streams. In each data stream each octet of data has an octet number. The octet number of the next octet in the stream is one larger than the octet number of the present octet
© Janice Regan, 2013 42
Sequence number (2)
Stream of octets of data from host 1 to host 2
Stream divided to show which data octets are placed in each successive segment
1520 1420 1381 1281 1181 1100 1000 First data octet number to be placed in segment
Stream of octets of data from host 2 to host 1
Stream divided to show which data octets are placed in each successive segment
6000 5800 5600 5400 5300 5150 5000
First data octet number to be placed in segment
Two Different Streams of DATA
© Janice Regan, 2013 43
Sequence number (3) The octet count in each stream is independent.
Separate counters!
TCP sequence numbers do not count packets they count octets of data. This is because TCP segments can contain variable numbers of octets of data.
A TCP segment whose first data octet is octet m, has a sequence number m when it is sent
© Janice Regan, 2013 44
Acknowledgement numbers Consider the data stream from host1 to host2 When host1 sends a segment the sequence number of that
segment refers to octet number of the first octet in that segment. This octet is part of the stream of data from host1 to host2 and the sequence number refers to that stream.
When host1 receives a segment with the ACK flag set the segment carries a valid acknowledgement The acknowledgement number of a valid
acknowledgement being received by host1 indicates the octet number, m, of the next data octet that host2 expects to receive from host1 (ACKs receipt of all data octets up to octet m-1)
© Janice Regan, 2013 45
Piggybacking A valid acknowledgment can be sent in its own
packet (no data being sent from host2 to host1 in the segment)
A valid acknowledgement can be piggybacked. the acknowledgement is added to a segment
carrying data from host2 to host1 The acknowledgement is added by
setting the ACK flag of that segment placing the correct value in the acknowledgement number
field. The correct value is the octet number of the next octet of data expected. If the last octet received in the packet being acknowledged is M the correct value is M+1
© Janice Regan, 2013 46
Flow control + Error control Flow Control
Control flow of data from source to receiver Source sends at a particular rate (frames/sec) Receiver must be able to receive and process
data at that rate (rate must be controlled) Error control
How to recover when a frame is damaged or lost in transmission
© Janice Regan, 2013 47
Stop and Wait: Error free
Packets arrive at destination in the same order they are sent
Error free transmission
Send F2
Send F3
Send F1
Send F0
Send ACK1
Send ACK2
Send ACK3RTT
TI
ME
© Janice Regan, 2013 48
Stop and Wait Flow Control Source entity (sender) transmits frame and
starts a timer Destination entity (receiver) receives frame Destination entity sends ACK Source entity receives ACK and stops timer Source entity is now ready to start the cycle
again for a new frame If timer expires first four steps above are
repeated for the same frame
Error control How does the protocol recover when a
packet or an ACK is lost or damaged?
How can a packet or ACK be lost or damaged?
Will discuss specific cases later
© Janice Regan, 2013 49