Lecture 11: IP routing, IP protocols

Similar documents
Lecture 13: Transportation layer

Lecture 13: Application layer

User Datagram Protocol

TCP/IP Protocol Suite

Networking Technologies and Applications

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

TSIN02 - Internetworking

TSIN02 - Internetworking

TSIN02 - Internetworking

TSIN02 - Internetworking

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Concept Questions Demonstrate your knowledge of these concepts by answering the following questions in the space that is provided.

Vorlesung Kommunikationsnetze

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

05 Transmission Control Protocol (TCP)

ECE4110 Internetwork Programming. Introduction and Overview

Introduction to TCP/IP networking

Packet Header Formats

CSCI-GA Operating Systems. Networking. Hubertus Franke

TSIN02 - Internetworking

ETSF05/ETSF10 Internet Protocols Network Layer Protocols

EITF25 Internet Techniques and Applications L7: Internet. Stefan Höst

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

On Distributed Communications, Rand Report RM-3420-PR, Paul Baran, August 1964

TCP /IP Fundamentals Mr. Cantu

User Datagram Protocol (UDP):

IPv6 Protocols and Networks Hadassah College Spring 2018 Wireless Dr. Martin Land

QUIZ: Longest Matching Prefix

Lecture 11: Networks & Networking

CHAPTER-2 IP CONCEPTS

EEC-682/782 Computer Networks I

Internet Control Message Protocol

Internetworking/Internetteknik, Examination 2G1305 Date: August 18 th 2004 at 9:00 13:00 SOLUTIONS

RMIT University. Data Communication and Net-Centric Computing COSC 1111/2061. Lecture 2. Internetworking IPv4, IPv6

ECE 650 Systems Programming & Engineering. Spring 2018

Introduction to Internetworking

IPv6. IPv4 & IPv6 Header Comparison. Types of IPv6 Addresses. IPv6 Address Scope. IPv6 Header. IPv4 Header. Link-Local

Unit 2.

Internet Layers. Physical Layer. Application. Application. Transport. Transport. Network. Network. Network. Network. Link. Link. Link.

Network Layer (4): ICMP

ICS 351: Networking Protocols

Layer 4: UDP, TCP, and others. based on Chapter 9 of CompTIA Network+ Exam Guide, 4th ed., Mike Meyers

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

Lecture 17 Overview. Last Lecture. Wide Area Networking (2) This Lecture. Internet Protocol (1) Source: chapters 2.2, 2.3,18.4, 19.1, 9.

University of Toronto Faculty of Applied Science and Engineering. Final Exam, December ECE 461: Internetworking Examiner: J.

Dongsoo S. Kim Electrical and Computer Engineering Indiana U. Purdue U. Indianapolis

EE 610 Part 2: Encapsulation and network utilities

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

Internet Protocols (chapter 18)

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

9th Slide Set Computer Networks

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

ET4254 Communications and Networking 1

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

Da t e: August 2 0 th a t 9: :00 SOLUTIONS

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

IP - The Internet Protocol. Based on the slides of Dr. Jorg Liebeherr, University of Virginia

Lecture 3. The Network Layer (cont d) Network Layer 1-1

Internetworking With TCP/IP

Introduction to IPv6 - II

TSIN02 - Internetworking

IS370 Data Communications and Computer Networks. Chapter 5 : Transport Layer

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

CSC 634: Networks Programming

Lecture 3: The Transport Layer: UDP and TCP

Introduction to Networks and the Internet

IP: Addressing, ARP, Routing

CC231 Introduction to Networks Dr. Ayman A. Abdel-Hamid. Internet Protocol Suite

IPv6 Neighbor Discovery

Interconnecting Networks with TCP/IP. 2000, Cisco Systems, Inc. 8-1

The Transport Layer. Part 1

Sequence Number. Acknowledgment Number. Data

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Lecture 8. Network Layer (cont d) Network Layer 1-1

Table of Contents 1 IPv6 Configuration IPv6 Application Configuration 2-1

SEN366 (SEN374) (Introduction to) Computer Networks

Computer Network Fundamentals Spring Week 4 Network Layer Andreas Terzis

Different Layers Lecture 20

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

Transport: How Applications Communicate

Introduction to Internet. Ass. Prof. J.Y. Tigli University of Nice Sophia Antipolis

Chapter 2 Advanced TCP/IP

ICMP (Internet Control Message Protocol)

II. Principles of Computer Communications Network and Transport Layer

Operation Manual IPv6 H3C S3610&S5510 Series Ethernet Switches Table of Contents. Table of Contents

ECE 435 Network Engineering Lecture 15

ICS 451: Today's plan

Guide to Networking Essentials, 6 th Edition. Chapter 5: Network Protocols

On Distributed Communications, Rand Report RM-3420-PR, Paul Baran, August

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Configuring IPv6 for Gigabit Ethernet Interfaces

Network Security. Introduction to networks. Radboud University, The Netherlands. Autumn 2015

Table of Contents 1 IPv6 Configuration IPv6 Application Configuration 2-1

CS4700/CS5700 Fundamentals of Computer Networks

Interconnecting Networks with TCP/IP

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Chapter 5 End-to-End Protocols

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

Transcription:

Lecture 11: IP routing, IP protocols

Contents Routing principles Local datagram delivery ICMP Protocol UDP Protocol TCP/IP Protocol Assuring requirements for streaming TPC Building and terminating TCP connection API for network services (brief info on sockets) AE4B33OSS Lecture 11 / Page 2

Datagram routing (1) Routing is a decision making process on where to forward the datagram (or its fragment). Any device making such decision is called router Routing can be direct or indirect Direct routing occurs when the destination host is a part of the LAN directly connected to the router so that the datagram can be delivered directly to the destination. All other cases represent indirect routing Routers in the Internet form a cooperative interconnected structure. Datagrams pass from router to router until they reach a router capable to deliver directly (locally) to the destination Table driven routing Every router maintains a routing table with entries in the form of pairs (N, G), where N is netid of the destination network and G is the IP address of the next router along the path to the destination network N. The next router must be reachable directly so that the datagram can be forwarded there without further routing AE4B33OSS Lecture 11 / Page 3

Datagram routing (2) 20.0.0.5 30.0.0.6 40.0.0.7 Network 10.0.0.0 F Network Network 20.0.0.0 G 30.0.0.0 H Network 40.0.0.0 10.0.0.5 20.0.0.6 30.0.0.7 Destination is on the net Forward datagram to 20.0.0.0 Deliver directly 30.0.0.0 Deliver directly 10.0.0.0 20.0.0.5 40.0.0.0 30.0.0.7 Routing table of G Default routes Often LAN s are connected to the rest of world through a single router. Such router is called default gateway, i.e. the address where all host on the LAN send datagrams with the destination outside the LAN Host Specific Routes Sometimes it may be reasonable to assign a special routing information for administrative, security, or technical reasons (e.g., dedicated serial line connection) AE4B33OSS Lecture 11 / Page 4

Datagram routing (3) Routing algorithm Extract the destination IP address DA from the datagram and using the netmask determine the netid of the destination network 1. If DA corresponds to a host specific route send the datagram directly to the destination host 2. If netid is equal to the netid of a directly connected LAN then deliver directly (locally) 3. If netid can be found in the routing table send the datagram to the corresponding next router 4. If the default route is specified send the datagram to the default gateway 5. Otherwise send a ICMP Destination unreachable message to the datagram sender AE4B33OSS Lecture 11 / Page 5

Local datagram delivery Direct routing must assure local datagram delivery The same has to be done when forwarding to a router directly connected on the LAN (not through point to point link) Datagram contains the destination IP address but the delivery must be accomplished using a LAN specific physical address Mapping IP addresses to physical addresses Address Resolution Protocol (ARP) dynamic mapping Ethernet case example solution: datagram sent by host A to host B The sender has IP address I A and physical address P A needs to learn the physical address P B but knows only the IP address I B. Host A sends an ARP ethernet broadcast frame and in its data part will contain both I A and I B (Who has ARP request). This frame get all hosts on the LAN. Host which recognizes its IP address I B responds to this broadcast (ARP reply) and tells the requestor its physical address P B. The ethernet broadcast makes a big load for the LAN host; so the requestor caches P B for some time (5 minutes as standard) Host B has learnt from ARP request also addresses I A a P A so it caches it, too (an early datagram from B to A can be expected). A real network capture: 12:32:35.363 arp who-has 147.32.85.117 tell 147.32.85.8 12:32:35.696 arp reply 147.32.85.117 is-at 00:1a:80:d9:27:64 AE4B33OSS Lecture 11 / Page 6

ICMP Protocol ICMP (= Internet Control Message Protocol), IP protocol number = 1 (cf. IP datagram header) The simplest protocol for network control and error message passing defined in RFC 792 ICMP header does not have a fixed structure (except for the first 4 bytes) Field TYPE shows ICMP message purpose and determines also the format and meaning of other fields some ICMP types are: TYPE Purpose TYPE Purpose 0 Echo reply 8 Echo request 3 Destination unreachable 11 Datagram TTL exceeded 5 Redirect (route change) 12 Datagram parameter problem AE4B33OSS Lecture 11 / Page 7

IPv6 IPv6 has 128 bits address (IPv4 only 32 bit) IPv6 improves some issues from IPv4 but it is still IP layer Why 6? Internet Stream Protocol from 1979 uses in IP header byte version 5. Next free number was 6. Improvements Larger address space aprox 3.4 10 38 of address Multicasting sending one packet to different computers SLAAC Stateless address autoconfiguration automatic configuration using Neighbor Discovery from router with ICMPv6 protocol (can be used DHCPv6 or static settings) Network security is in IPv6 mandatory Mobility avoid triangular routing for mobile devices Jumbogram datagram with size 2 32 1 (in IPv4 max 65535) AE4B33OSS Lecture 11 / Page 8

IPv6 address Notation 8 groups with 16 bits each group has 4 hexadecimal numbers 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Zeros are not necessary, if they has no meaning 2001:db8:85a3:::8a2e:370:7334 General format unicast and anycast: 48 or more routing prefix 16 or fewer subnet id ( subnet id+routing prefix = 64) 64 interface identifier (it can be MAC address of network card, assigned by DHCPv6, generated randomly, assigned manually) Format for multicast: 8 bits prefix started with FF 4 bits flag 4 bits scope 112 bits group ID AE4B33OSS Lecture 11 / Page 9

IPv6 routing Simplified processing by routers Packet header in IPv6 is more simple IPv6 Routers do not perform fragmentation Minimal MTU (Maximal transmission unit) is 1280 Perform MTU discovery it means detect MTU for specific route IPv6 has no checksum (it is in transport and link layer) TTL (Time To Live) is replaced by Hop Limit routers need not to compute time in queues Routing prefix specify all routing information RFC 3177 (2001) suggested that all end sites receive /48 address allocation RFC 6177 (2011) reduces this address allocation to /56 AE4B33OSS Lecture 11 / Page 10

From IPv4 to IPv6 IPv4 with CIDR routing and NAT slow down change to IPv6 How to transform IPv4 to IPv6 Dual stack router can handle IPv4 and IPv6 together Tunneling encapsulation of IPv6 into IPv4 protocol Proxying and translation for IPv6 only host Backward compatibility, IPv6 host can communicate with IPv4 network You can check your computer on: www.test ipv6.cz www.test ipv6.com ipv6test.google.com AE4B33OSS Lecture 11 / Page 11

Transport layer UDP Protocol UDP (= User Datagram Protocol), IP protocol number = 17 Very simple transport protocol defined in RFC 768 Provides connectionless and unreliable transport of user datagrams. If any kind of transmission reliability is needed, it must be implemented in the user's application. Compared to pure IP datagrams, UDP has the ability to address target processes on the destination host using the port field PORT fields are used to distinguish computing processes awaiting a UDP datagram on the destination host. SOURCE PORT field is optional; must be 0 if unused. Otherwise it contains the port number to which a possible reply should be sent. AE4B33OSS Lecture 11 / Page 12

UDP Protocol (cont.) To ensure that different hosts on Internet will understand each other, IANA (= Internet Assigned Numbers Authority) issues the obligatory list of Well Known Port Numbers Selected UDP port numbers are: For the complete list see http://www.iana.org/assignments/port-numbers AE4B33OSS Lecture 11 / Page 13

TCP Protocol for reliable data streaming TCP is the most important general reliable transport service providing a virtual bidirectional communication channel between two hosts TCP/IP is the IP implementation of this service TCP properties Data stream Applications communicating through a TCP connection consider the communication channel as a byte stream similarly to a file Virtual connection Before the data transmission can start, the communicating applications have to negotiate the connection by means of the network components of their local operating systems create and connect the sockets. The protocol software (transport layer) in the operating systems of both hosts make an agreement on the connection using messages passed over the network. The hosts also verify that the connection can be reliably established and that both end point systems are ready to communicate open the sockets. Afterwards the end point applications are informed about the established connection and the data communication can start. If the connection breaks, both communicating applications are informed The term virtual connection is used to create an illusion that applications are interconnected through a dedicated line. The reliability is ensured by full hand shake communication (everything must be acknowledged by the other party) AE4B33OSS Lecture 11 / Page 14

TCP/IP TCP Protocol IP Implementation Besides of the general TCP properties, the TCP/IP implementation provides: Buffered transport (streaming) To improve the efficiency, the TCP/IP module in the OS assembles bytes from the stream into packets (datagrams) of reasonable size. If this is not desirable (e.g., TELNET ctrl C), TCP/IP is equipped by a mechanism enforcing the priority transfer of a short datagram out oforder. Full duplex connection Application processes can see the TCP/IP link as two independent data streams running in opposite directions without an apparent interaction. The protocol software actually acknowledges data running in one direction in the packets sent together with the data in the opposite direction. AE4B33OSS Lecture 11 / Page 15

TCP reliability solution The reliable transfer is ensured by positive acknowledging of the received data together with repeated packet transfer Events on the sender side Send packet 1 Get ACK1 Send packet 2 Get ACK2 Datagrams on network Events on the receiver side Get packet 1 Send ACK1 Get packet 2 Send ACK2 Lost packet are repeated based on suitable timeouts Events on the sender side Send packet 1 Start timer ACK should have arrived now but it timed-out. Datagrams on network Packet lost Events on the receiver side Packet should have arrived ACK should have been sent Resend packet 1 Start timer Get ACK1 Stop timer Get packet 1 Send ACK1 AE4B33OSS Lecture 11 / Page 16

TCP reliability solution (cont.) Datagrams may get duplicated during the travel (both data and ACK). This problem is solved by sequential numbering of datagrams The problem of positive acknowledgement efficiency The moving window method Events on the sender side Send packet 1 Massages on the net Events on the receiver side Send packet 2 Send packet 3 Get ACK1 Get ACK2 Get packet 1 Send ACK1 Get packet 2 Send ACK2 Get packet 3 Get ACK3 Get ACK3 AE4B33OSS Lecture 11 / Page 17

TCP ports, connections and end points TCP/IP also uses ports to distinguish target applications on the connected hosts The port numbers can be the same as in UPD because protocols are separated first To use a service provided by a server by any number of client hosts, TCP/IP is equipped by so called virtual connections (virtual channels): These virtual channels are actually connection between so called endpoints, which IP addresses with an appended port number (6 bytes in IPv4), e.g., 147.32.85.34:80 TCP/IP virtual connection is then specified by two end points of the particular connection (12 bytes in IPv4) Passive and active end point opening TCP/IP needs the system between which the connection should be established to negotiate the connection parameters The application at the first end point must ask its local OS to accomplish passive open on the particular port indicating thus the willingness to accept the incoming requests for connections. This end point is usually denoted as server. It listens on to particular port for incoming connection requests. If a client application wants to connect to a server, it asks its local OS to make an active open to the server IP address and the applicable port. The local client OS finds a free local port (usually 1024 2047). Both hosts establish the connection that is identified by the two end points and may start communicating each to other. AE4B33OSS Lecture 11 / Page 18

TCP/IP segments and their format TCP data stream is split into segments Segments travel over the Internet as IP datagrams Every byte in the data stream has its 32 bit sequential number within the connection TCP datagram (segment) header: TCP header fields SOURCE PORT, DESTINATION PORT: Application identifications on both connection end points SEQUENCE NUMBER: Sequential number of the first byte in the data stream transferred in the datagram. ACKNOWLEDGMENT NUMBER: Sequential number of the first byte in the opposite stream which the sender expects from the receiver as the answer. Remark: SEQUENCE NUMBER is related to the transfer direction, in which the segment is sent while ACKNOWLEDGMENT NUMBER relates to the opposite direction. AE4B33OSS Lecture 11 / Page 19

TCP/IP segments and their format (cont.) TCP header fields (cont.) HLEN: Header length in 32 bit words CODE: Structured field containing 1 bit flags: URG: Field URGENT POINTER is valid ACK: Datagram carries an acknowledgement of the opposite running segment PSH: This segment requires a "push", i.e. an immediate delivery to the target application without any receiver side buffering RST: Connection reset SYN: Active request to establish a connection (sequence numbers synchronization) FIN: Connection termination (sender detected the end of data strem) WINDOW: Determines how much data the sender can accept in the opposite running data stream URGENT POINTER: Pointer to an urgent data element in the segment data section (e.g., ctrl C in an Telnet session) makes sense only if the URG flag is set OPTIONS: Optional fields used during the connection negotiation (e.g., maximum segment size) AE4B33OSS Lecture 11 / Page 20

Retransmission timeouts Constant value of timeout when to resend the TCP/IP segment is inappropriate Internet is too heterogeneous and is composed of a huge number of LAN s based on different HW technologies Giga bit ethernet, 33 kbit serial line, intercontinental satellite link, etc. TCP/IP adapts to changing timing parameters of the virtual connection A simple adaptive algorithm to adjust the timeout is used The algorithm is based on continuous monitoring of round trip time (RTT) Time between dispatching the packet and its acknowledgement. The real timeout is then computed as a weighted average of RTT measured in the recent history. This strategy quickly accommodates to the speed and load changes on the intermediate networks and routers AE4B33OSS Lecture 11 / Page 21

Establishing the TCP connection TCP uses a three stage procedure to establish the virtual connection: 1. In the first step, the connection initiator (client) sends the other party (server) a segment containing SYN bit = 1, randomly generated SEQUENCE NUMBER = x and an empty data section. 2. The server responds by a segment with SYN and ACK set to 1, random SEQUENCE NUMBER = y and ACKNOWLEDGMENT NUMBER = x+1. 3. After receiving this segment, the client acknowledges it by sending a segment with ACK set to 1, SYN bit=0 and the ACKNOWLEDGMENT NUMBER = y+1. This way the initial values of SEQUENCE NUMBER and ACKNOWLEDGMENT NUMBER fields are synchronized for the future life time of the virtual connection and are used to number the following TCP/IP segments The sequential numbers are random It enables to detect a failure or restart of hosts on the connection ends that can happen during a longer timeout AE4B33OSS Lecture 11 / Page 22

TCP connection termination Connection is normally terminated on request of one of the connected applications Application tells TCP that there are no more data to be exchanged If server passive close If client active close TCP software closes the connection by sending a segment with a set FIN bit For the final termination of the virtual connection, it is necessary also to close the opposite direction. The party that received the segment with FIN bit reacts by sending a segment with FIN bit, too. The TCP connection can be terminated forcibly using the RST bit AE4B33OSS Lecture 11 / Page 23

Well known TCP ports Examples of some TCP/IP ports and many others (see http://www.iana.org/assignments/port-numbers) AE4B33OSS Lecture 11 / Page 24

TCP finite state machine Dashed arrows server side state transitions Solid arrows client side state transitions Lower left frame active connection close Lower right frame passive connection close appl: transition caused by system call from application recv: transition caused by received segment send: shows what is sent in reaction to state change AE4B33OSS Lecture 11 / Page 25

API for network services The basic system API for network communication is a socket (see also Berkeley sockets) Create socket (get a socket file descriptor) sock_descr = socket(af, type, protocol) af specifies address and protocol family (for IP af = AF_INET) type determines the way of communication SOCK_STREAM, SOCK_DGRAM, SOCK_RAW,... protocol particular protocol type (TCP, UDP, ICMP,...) Assign socket a local address (passive socket open server side) bind(sock_descr, local_addr, addr_len) sock_descr socket local_addr local address, for AF_INET a structure including port addr_len address length in bytes Listen for incoming connections (server side) listen(sock_descr, backlog) sock_descr socket, backlog number of allowable connections An incoming connection arrived (server gets the client identification) new_sd = accept(sock_descr, *client_addr, *client_addr_len) Connect to a remote address (active open client side) connect(sock_descr, remote_addr, addr_len) parameters like for bind() Data transfers using write, send, sendmsg, read, recv, recvmsg Terminating the connection close(sock_descr) AE4B33OSS Lecture 11 / Page 26

Server side 1. Create socket calling socket() 2. Assign the local address (and port) using bind() 3. Prepare socket for incoming connection requests calling listen() listening socket 4. Calling accept() the server blocks until a request for connection comes. The accept() return value is a new socket descriptor open for communication. The original socket continues listening and accept() can be called again. 5. Communication using send() and recv() or write() and read() 6. Possible call to close() when the server exits (passive close) Using the network API Client 1. Create socket calling socket() 2. Call connect() to make a connection to server. The local socket descriptor becomes open for succeeding communication (local operating system assigns a free local port) 3. Communication with the server using send() and recv() or write() and read() 4. Calling close() ends the connection to the server (active close) AE4B33OSS Lecture 11 / Page 27

End of Lecture 11 Questions?