CS461 Internet and Transport Protocols PDF
Document Details
Uploaded by IndulgentLobster7671
HiLCoE
Tags
Summary
This document is lecture notes from a Computer Science class, likely at an undergraduate level. It covers topics on Internet and Transport Protocols, including the functionality of LANs, WANs, and their interconnection processes.
Full Transcript
CS461 Internet Internetworking IP IP Addresses Internet and Transport Protocols Internet Apps TCP Application CS461: Computer Networks HiLCoE School of Computer Science and Technology CS461 Contents...
CS461 Internet Internetworking IP IP Addresses Internet and Transport Protocols Internet Apps TCP Application CS461: Computer Networks HiLCoE School of Computer Science and Technology CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 LANs and WANs Internet Internetworking LANs IP I Different types: different topologies, different IP Addresses technologies, different purposes Internet Apps TCP I Many LANs operate at layers 1 and 2 (Physical and Application Data Link Layer) using switches and hubs I Bridges can connect LANs of similar technologies together WANs I Can interconnect LANs over a larger distance I Point-to-point link (e.g. ADSL, PDH) or a network (e.g. ATM, SDH, telephone) using packet or circuit switching I Device that interconnects the WAN to LAN must support both technologies I WANs typically operate at Layers 1 and 2 CS461 Connect Multiple LANs and WANs Internet Internetworking I Organisations have different requirements of their IP network, and therefore may choose different IP Addresses technologies for their LANs/WANs Internet Apps I Aim: allow any computer to communicate with any TCP other computer, independent of what LAN/WAN they Application are connected to I Internetworking involves connecting the many different types of LANs/WANs together to achieve this aim I An internetworking protocol supports data delivery across different types of LANs/WANs I E.g. the Internet Protocol (IP) CS461 Internetworking with Routers Internet Internetworking I Internetworking is performed using routers IP I Routers connect two or more LANs or WANs together IP Addresses I Routers are packet switches that operate at network Internet Apps layer TCP Application CS461 The Internet Protocol Internet Internetworking I IP is the internetworking protocol used in the Internet IP I Implemented in hosts and routers IP Addresses I Features: Internet Apps I Datagram packet switching TCP I Network layer Application I Connnection-less I Addressing I Fragmentation-and-reassembly I IP version 4 most widely used; IPv6 is available I Features IP does NOT provide: I Connection control, error control, flow control (TCP) I Status reporting (ICMP) I Priority, quality of service (DiffServ, IntServ) I Security (IPsec) CS461 Terminology Internet I Routers: nodes that connect networks (LANs/WANs) together; Internetworking operate at network layer IP I Subnetworks: individual networks (LANs and WANs) IP Addresses I Internetworking: connect two or more subnets together using Internet Apps routers TCP I An internetwork or an internet: the resulting network from Application internetworking I The Internet: an internet that uses the Internet Protocol (IP) and used today to connect networks across the globe I Routing: process of discovering a path from source to destination through a network I Forwarding: process of sending data along a path through a network I Packet Switch: a generic device that performs switching in a Packet Switching network. May operate at data link or network layer. A packet switch at network layer is called a router I Circuit Switch: a generic device that performs circuit switching in a Circuit Switching network I Ethernet switch: an IEEE 802.3 switch (either Ethernet, Fast Ethernet or Gigabit Ethernet). Operates at data link layer CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 IP in the TCP/IP Stack Internet Internetworking IP IP Addresses Internet Apps TCP Application CS461 IP Hosts and Routers Internet I Hosts are the end-devices (stations) Internetworking IP I Usually only use single network interface at a time I Hosts do not forward IP datagrams IP Addresses I Either source or destination Internet Apps TCP I Routers are the datagram packet switches Application I Routers have two or more interfaces (since they connect LANs/WANs together) I Routers forward datagrams I Routers can act as a source or destination of datagrams (however this is mainly for management purposes) I IP routing is the process of discovering the best path between source and destination; store destination and next router in routing table I E.g. RIP, EIGRP, OSPF, BGP I IP forwarding is the process of delivering an IP datagram from source to destination; read next router from routing table CS461 IP Hosts and Routers Internet Internetworking IP IP Addresses Internet Apps TCP Application CS461 IP Datagram Internet Internetworking I Variable length header and variable length data IP I Header: 20 Bytes of required fields; optional fields may IP Addresses bring header size to 60 Bytes Internet Apps I Data: length must be integer multiple of 8 bits; TCP maximum size of header + data is 65,656 Bytes Application 0 4 8 14 16 19 31 Version HLength DiffServ ECN Total Length Identification Flags Fragment Offset 20 Bytes Time To Live Protocol Header Checksum Source IP Address Destination IP Address Options + Padding (optional) Data CS461 IP Datagram Fields Internet I Version [4 bits]: version number of IP; current value is 4 (IPv4) Internetworking I Header Length [4 bits]: length of header, measured in 4 byte words IP I DiffServ [6 bits]: Used for quality of service control IP Addresses I ECN [2 bits]: Used for notifying nodes about congestion Internet Apps I Total Length [16 bits]: total length of the datagram, including TCP header, measured in bytes Application I Identification: sequence number for datagram I Flags: 2 bits are used for Fragmentation and Re-assembly, the third bit is not used I Fragment Offset [13 bits]: See Fragmentation and Re-assembly I Time To Live [8 bits]: datagram lifetime I Protocol [8 bits]: indicates the next higher layer protocol I Header Checksum [16 bits]: error-detecting code applied to header only; recomputed at each router I Source Address [32 bits]: IP address of source host I Destination Address [32 bits]: IP address of destination host I Options: variable length fields to include options I Padding: used to ensure datagram is multiple of 4 bytes in length I Data: variable length of the data CS461 IP Routing and Forwarding Internet Internetworking Routing Tables IP IP Addresses I Store address of destination and next node Internet Apps I Created manually or by routing protocols TCP Application Routing Protocols in the Internet I Collect network status information, calculate least cost paths and update routing tables I Adaptive routing protocols: OSPF, RIP, EIGRP, BGP Forwarding I Routers forward IP datagrams from source host to destination host I Destination host address in IP datagram header I Lookup destination address in routing table CS461 Other Features Internet I IP includes: Internetworking IP I Fragmentation and reassembly: source host and routers may divide datagrams into smaller fragments; IP Addresses destination host reassembles fragments into full Internet Apps datagram TCP I Time To Live (TTL): source sents “lifetime” of Application datagram in header; decremented by each router; if 0, datagram is discarded I Other network layer features: I ICMP: error reporting, ping I ARP: map IP addresses to Ethernet addresses I IPv6 I Multicasting I Quality of Service (DiffServ) I Mobility (Mobile IP) I Security (IPsec) CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 IPv4 Addresses Internet Internetworking I IPv4 addressess are 32 bits in length IP I Split into network portion and host portion: first N bits IP Addresses identify a subnet in the Internet; last H bits identify an Internet Apps IP device (host/router) in that subnet TCP I All subnets in the Internet have unique network portion Application I All IP devices in a subnet have same network portion, but unique host portions I Where/how to split has changed over time: Classful, Subnet addressing, Classless addressing I Focus on classless addressing I Why split? Allows hierarchical addressing, makes routing in Internet scalable CS461 Representing IPv4 Addresses Internet Internetworking I Writing and remembering 32 bits is difficult for humans IP I IP addresses usually written in dotted decimal notation IP Addresses I Decimal number represents the bytes of the 32 bit Internet Apps address TCP Application I Decimal numbers are separated by dots IP: 11000000111001000001000100111001 CS461 Classless IP Addressing Internet Internetworking I Subnet mask or address mask identifies where the IP IP address is split between network and host portion IP Addresses I Mask is 32 bits: a bit 1 indicates the corresponding bit Internet Apps in the IP address is the network portion; a bit 0 TCP indicates the corresponding bit in the IP address is the Application host portion I The mask can be given in dotted decimal form or a shortened form, which counts the number of bit 1’s from left IP: 10000010000100010010100110000001 Mask: 11111111111111111111110000000000 CS461 Special Case IP Addresses Internet Internetworking Selected IP addressess are used for special purposes; they IP cannot be used to identify a host IP Addresses Network Address identifies a subnet in the internet; all bits Internet Apps in host portion are 0 TCP Directed Broadcast Address identifies all hosts on a specific Application subnet; all bits in host portion are 1 Local Broadcast Address identifies all hosts on the current subnet; all bits are 1 Loopback Address identifies current host; first 8 bits are 01111111; also called localhost Startup Source Address identifies host if currently it has no address; all bits are 0 Selected addresses reserved for private networks (e.g. not connected to Internet; behind NAT) I 10.0.0.0—10.255.255.255 I 172.16.0.0—172.31.255.255 I 192.168.0.0—192.168.255.255 CS461 Example of IP Addressing Internet Internetworking 1.1.1.0/24 2.2.2.0/24 3.3.3.0/24 IP 1.1.1.2 1.1.1.3 2.2.2.100 3.3.3.11 3.3.3.22 IP Addresses Internet Apps TCP 1.1.1.6 Application 1.1.1.1 2.2.2.2 3.3.3.55 2.2.2.1 /24 /24 /24 1.1.1.4 1.1.1.5 2.2.2.101 3.3.3.33 3.3.3.44 Host (Sub)network Router IP address Subnet mask CS461 Example of Unicast Internet Internetworking IP Datagram IP Header Data IP Addresses Internet Apps Src = 1.1.1.6 Dst = 3.3.3.44 TCP Application 1.1.1.2 1.1.1.3 2.2.2.100 3.3.3.11 3.3.3.22 1.1.1.6 1.1.1.1 2.2.2.2 3.3.3.55 2.2.2.1 /24 /24 /24 1.1.1.4 1.1.1.5 2.2.2.101 3.3.3.33 3.3.3.44 CS461 Example of Directed Broadcast Internet Internetworking IP Datagram IP Header Data IP Addresses Internet Apps Src = 1.1.1.6 Dst = 2.2.2.255 TCP Application 1.1.1.2 1.1.1.3 2.2.2.100 3.3.3.11 3.3.3.22 1.1.1.6 1.1.1.1 2.2.2.2 3.3.3.55 2.2.2.1 /24 /24 /24 1.1.1.4 1.1.1.5 2.2.2.101 3.3.3.33 3.3.3.44 CS461 Example of Startup Source and Local Broadcast Internet Internetworking IP Datagram IP Header Data IP Addresses Internet Apps Src = 0.0.0.0 Dst = 255.255.255.255 TCP Application 1.1.1.2 1.1.1.3 2.2.2.100 3.3.3.11 3.3.3.22 1.1.1.6 1.1.1.1 2.2.2.2 3.3.3.55 2.2.2.1 /24 /24 /24 1.1.1.4 1.1.1.5 2.2.2.101 3.3.3.33 3.3.3.44 CS461 Example of Loopback Address Internet Internetworking IP Datagram IP Header Data IP Addresses Internet Apps Src = 127.0.0.1 Dst = 127.0.0.1 TCP Application 1.1.1.2 1.1.1.3 2.2.2.100 3.3.3.11 3.3.3.22 1.1.1.6 1.1.1.1 2.2.2.2 3.3.3.55 2.2.2.1 /24 /24 /24 1.1.1.4 1.1.1.5 2.2.2.101 3.3.3.33 3.3.3.44 CS461 IP Addressing Example Internet Internetworking My office computer has address 104.209.61.169/18. What IP is the network address and directed broadcast address for my IP Addresses network? How many IP devices can be attached to my Internet Apps network? TCP Application CS461 Obtaining an IP Address Internet Internetworking I Internet Assigned Numbers Authority (IANA) manages IP the assignment of IP addresses IP Addresses I IANA delegates IP network ranges to regional Internet Apps authorities (e.g. APNIC), delegated further to national TCP registries (e.g. THNIC) Application I Organisations obtain network addresses from national/local registries I Organisations are free to assign addresses as they wish from assigned network address I Manually set IP address on each computer I Protocol to automatically configure IP addresses in computers on network: Dynamic Host Configuration Protocol CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 Internet Applications Internet I Most Internet applications follow a client/server model Internetworking of initiating communication: IP 1. Server waits for client to initiate communication IP Addresses 2. Client initiates communication Internet Apps 3. Once the communication is initiated, data can flow in TCP both directions (client to server and server to client) Application I Examples: I Web browser (Firefox, Safari) and web server (Apache, IIS) I Email client (Thunderbird, Outlook) and email server (MS Exchange, Postfix) I Instant messaging client and server (LINE, MSN, TextSecure) I Bittorrent (uTorrent, Transmission) and tracker (Opentracker, VUZE) CS461 Issues with Client/Server Applications Internet I How to make it easy for programmers to create Internetworking applications without knowing details of IP communications? IP Addresses I Transport protocols implement features common to Internet Apps many apps, e.g. TCP, UDP TCP Application I How to allow applications implemented in different languages/OS by different people to communicate? I Application layer protocols, e.g. HTTP, SMTP, FTP I Use a common API: Sockets I How to identify different applications on same computer? I Addresses to identify applications: Ports CS461 Transport Protocols Internet Internetworking I Send data between application processes on source and IP destination hosts IP Addresses I End-to-end (or host-to-host) communications Internet Apps I Transmission Control Protocol TCP I Most widely used transport protocol Application I Connection-oriented, error control, flow control, congestion control I Others: User Datagram Protocol (UDP), SCTP, DCCP, old and domain-specific protocols I Protocol number: identifies transport protocol used by both hosts I 8-bit number; e.g. 6 = TCP, 17 = UDP; 1 = ICMP I Included in IP header http://www.iana.org/assignments/protocol-numbers/ CS461 How does a client identify a server application? Internet I Internet contains multiple hosts Internetworking IP I Host (interface) identified by IP address IP Addresses I A host may implement multiple transport protocols Internet Apps I Transport protocol identified by protocol number TCP I Multiple applications may use same transport protocol Application I Ports identify application processes on a host I Five addresses uniquely identify end-to-end communications 1. Source IP 2. Destination IP 3. Protocol number 4. Source port 5. Destination port CS461 Multiple Applications, Multiple Transport Internet Protocols Internetworking IP IP Addresses Internet Apps TCP Application CS461 Port Numbers Internet Internetworking I Ports are 16-bit numbers IP I Source port, destination port in transport protocol IP Addresses header Internet Apps I On a host, ports are managed by operating system TCP I Unique port assigned to processes for Internet Application communications I Ports are local to a host I Well-known ports: 0–1023 I Common servers use well-known ports by default I http = 80, https = 443, ssh = 22, ftp = 20/21, smtp = 25, dns = 53, dhcp = 67, ipp = 631 I Registed ports: 0–49151 I Servers use registed ports by default I openvpn = 1094, mysql = 3306, steam = 27015,... I Dynamic ports: 49152–65535 I Clients use dynamic ports, assigned by OS http://www.iana.org/assignments/port-numbers/ CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 Transmission Control Protocol Internet I Most commonly used transport protocol today Internetworking IP I Web browsing, email, file sharing, instant messaging, file transfer, database access, proprietary business IP Addresses applications, some multimedia applications (at least for Internet Apps control purposes),... TCP Application I Services provided by TCP: I Stream-oriented: TCP treats data from application as continuous stream of bytes, sequence numbers count bytes I Connection-oriented: setup connection before data transfer I Full duplex connection: send data in either direction I Flow and error control: Go-Back-N style I Congestion control: if network congestion, source slows down CS461 TCP Segment Internet Internetworking 0 4 8 16 31 IP Source Port Destination Port IP Addresses Sequence Number 20 Bytes Internet Apps Acknowledgement Number TCP HLength Reserved Flags Advertised Window Application Checksum Urgent Pointer Options + Padding (optional) Data I Header contains 20 bytes, plus optional fields I Optional fields must be padded out to multiple of 4 bytes CS461 TCP Segment Fields Internet Internetworking I Source/Destination port IP I Sequence number of the first data byte in this segment IP Addresses (or ISN) Internet Apps I Acknowledgement number: sequence number of the TCP next data byte TCP expects to receive Application I Header Length: Size of header (measured in 4 bytes) I Window: number of bytes the receiver is willing to accept (for flow control) I Checksum: error detection on TCP segment I Urgent pointer points to the sequence number of the last byte of urgent data in the segment I Options: such as maximum segment size, window scaling, selective acknowledgement,... CS461 TCP Segment Flags Internet Internetworking I Flags (1 bit each, if 1 the flag is true or on): IP I CWR: Congestion Window Reduced IP Addresses I ECE: Explicit Congestion Notification Echo Internet Apps TCP I URG: segment carries urgent data, use the urgent Application pointer field; receiver should notify application program of urgent data as soon as possible I ACK: segment carries ACK, use the ACK field I PSH: push function I RST: reset the connection I SYN: synchronise the sequence numbers I FIN: no more data from sender CS461 TCP Connection Establishment: Three-Way Internet Handshake Internetworking IP Agree upon initial sequence numbers, prepare buffer for data IP Addresses A B Internet Apps Flags=SYN TCP SN=ISNA Application Flags=SYN,ACK SN=ISNB AN=ISNA+1 Flags=ACK AN=ISNB+1 I Initiator A selects an Initial Sequence Number, ISNA I B acknowledges ISNA and also chooses its own ISNAB I Data transfer can start after ISNB is ACKed I Optionally, 3rd segment can contain data CS461 TCP Data Transfer Internet Internetworking I Segments can contain varying amount of data IP I Set ACK flag to indicate an acknowledgement, IP Addresses piggybacking is common Internet Apps I Speed of data transfer depends on: TCP I Flow control: sliding-window Application I Error control: Go-Back-N style I Congestion control: loss of segments indicates congestion, sender slows down CS461 Contents Internet Internetworking IP Internetworking IP Addresses Internet Apps The Internet Protocol TCP Application IP Addressing Internet Applications Transmission Control Protocol Application Layer Protocols CS461 Application Layer Protocols Internet I Many different protocols to support types of Internetworking applications IP I HTTP, FTP, SMTP, SSH, Telnet, BitTorrent, SIP, IP Addresses IMAP, RDP, SMB,... Internet Apps TCP I Other protocols to support network operation Application I DNS, DHCP/BOOTP, NTP, SNMP,...