480 likes | 611 Views
CMPT 471 Networking II. Some important Internetworking concepts. Internetworking Requirements. Provides linkage between networks Minimum physical and link layer Provides routing and delivery of data between processes on different networks
E N D
CMPT 471Networking II Some important Internetworking concepts
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
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
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)
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)
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
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)
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
Encapsulation: Protocol Data Units in the TCP/IP Architecture port Transport layer ip address Network layer Data link layer (e.g. ethernet) MAC address Figure 2.14 Stallings (2003)
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
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.
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)
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)
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
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.
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
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
A sample routing table IPv6 Destination Next Hop Flag Met Ref Use If ::1/128 :: Un 0 1 41 lo fdd0:8184:d967:25::a19:106/128 fdd0:8184:d967:29::a1d:109 UG 1024 0 203 eth1 fdd0:8184:d967:26::/64 fdd0:8184:d967:30::a1e:108 UG 1024 0 122 eth2 fdd0:8184:d967:29::/128 :: Un 0 2 0 lo fdd0:8184:d967:29::a1d:10a/128 :: Un 0 1 350 lo fdd0:8184:d967:29::/64 :: U 256 0 1 eth1 fdd0:8184:d967:30::/128 :: Un 0 2 0 lo fdd0:8184:d967:30::a1e:10a/128 :: Un 0 1 392 lo fdd0:8184:d967:30::/64 :: U 256 0 1 eth2 fe80::250:56ff:fea4:1795/128 :: Un 0 1 74 lo fe80::250:56ff:fea4:59c9/128 :: Un 0 1 63 lo fe80::250:56ff:fea4:764f/128 :: Un 0 1 0 lo fe80::/64 :: U 256 0 0 eth1 fe80::/64 :: U 256 0 0 eth2 fe80::/64 :: U 256 0 0 eth0 ::/0
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
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
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
CMPT 471Networking II Review of TCP/UDP The transport layer
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
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
TCP: reliable transmission • Addressing • Multiplexing • Flow control • Logical connection establishment • Logical connection maintenance • Logical connection termination • error control • reorder packets received the application
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
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
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
Structure of a TCP segment SOURCE PORT DESTINATION PORT CHECKSUM Comer 2000: fig 13.7
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.
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.
Structure of a TCP segment SEQUENCE NUMBER ACKNOWLEDGEMENT NUMBER WINDOW Comer 2000: fig 13.7
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
Sequence number (2) Two Different Streams of DATA 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
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
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)
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
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
Stop and Wait: Error free • Packets arrive at destination in the same order they are sent Send F0 Send ACK1 Send F1 T I M E Send ACK2 Send F2 Send ACK3 Send F3 RTT Error free transmission
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