Data Communication & Networks G22.2262-001 Session 7 - Main Theme Networks: Part I Circuit Switching, Packet Switching, The Network Layer Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 Agenda Packet Switching Virtual Circuit vs. Datagram Networks The Internet Protocol Conclusion 2
Part I Packet Switching 3 Switching Networks Long distance transmission is typically done over a of switched nodes Nodes not concerned with content of data End devices are stations Computer, terminal, phone, etc. A collection of nodes and connections is a communications Data routed by being switched from node to node 4
Technology Two different switching technologies Circuit switching Packet switching 5 Simple Switched Network 6
Circuit Switching Dedicated communication path between two stations (during conversation) Three phases Establish Transfer Disconnect Must have switching capacity and channel capacity to establish connection Must have intelligence to work out routing 7 Circuit Switching - Issues Circuit switching is inefficient (designed for voice) Resources dedicated to a particular call Much of the time a data connection is idle Data rate is fixed Both ends must operate at the same rate Set up (connection) takes time Once connected, transfer is transparent 8
Packet Switching Basic Operation Data transmitted in small packets Typically 1000 octets Longer messages split into series of packets Each packet contains a portion of user data plus some control info Control info Routing (addressing) info Packets are received, stored briefly (buffered) and passed on to the next node Store and forward 9 Use of Packets 10
Network Layer Transport segment from sending to receiving host On sending side encapsulates segments into datagrams On receiving side, delivers segments to transport layer layer protocols in every host, router Router examines header fields in all IP datagrams passing through it application transport application transport 11 Key Network Layer Functions forwarding: move packets from router s input to appropriate router output routing: determine route taken by packets from source to destination Routing algorithms Analogy: routing: process of planning trip from source to destination forwarding: process of getting through single interchange 12
Interplay Between Routing and Forwarding routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 value in arriving packet s header 0111 3 2 1 13 Connection Setup 3rd important function in some architectures: ATM, frame relay, X.25 Before datagrams flow, two hosts and intervening routers establish virtual connection Routers get involved Network and transport layer connection service: Network: between two hosts Transport: between two processes 14
Network Service Model Q: What service model for channel transporting datagrams from sender to receiver? Example services for individual datagrams: Guaranteed delivery Guaranteed delivery with less than 40 msec delay Example services for a flow of datagrams: In-order datagram delivery Guaranteed minimum bandwidth to flow Restrictions on changes in inter-packet spacing 15 Network Layer Service Model Network Architecture Service Model Bandwidth Guarantees? Loss Order Timing Congestion feedback Internet ATM ATM ATM ATM best effort CBR VBR ABR UBR none constant rate guaranteed rate guaranteed minimum none no yes yes no no no yes yes yes yes no yes yes no no no (inferred via loss) no congestion no congestion yes no 16
Part II Virtual Circuit vs. Datagram Networks 17 Network Layer Connection & Connection-Less Service Datagram provides -layer connectionless service VC provides -layer connection service Analogous to the transport-layer services, but: Service: host-to-host No choice: provides one or the other Implementation: in the core 18
Virtual Circuits source-to-dest path behaves much like telephone circuit Performance-wise Network actions along source-to-dest path Call setup, teardown for each call before data can flow Each packet carries VC identifier (not destination host address) Every router on source-dest path maintains state for each passing connection Link, router resources (bandwidth, buffers) may be allocated to VC 19 VC Implementation A VC consists of: 1. Path from source to destination 2. VC numbers, one number for each link along path 3. Entries in forwarding tables in routers along path Packet belonging to VC carries a VC number VC number must be changed on each link New VC number comes from forwarding table 20
Forwarding Table VC number 12 1 2 3 22 32 Forwarding table in northwest router: interface number Incoming interface Incoming VC # Outgoing interface Outgoing VC # 1 12 2 22 2 63 1 18 3 7 2 17 1 97 3 87 Routers maintain connection state information! 21 Virtual Circuits: Signaling Protocols Used to setup, maintain teardown VC Used in ATM, frame-relay, X.25 Not used in today s Internet application transport 5. Data flow begins 6. Receive data 4. Call connected 3. Accept call 1. Initiate call 2. incoming call application transport 22
Datagram Networks No call setup at layer Routers: no state about end-to-end connections No -level concept of connection Packets forwarded using destination host address Packets between same source-dest pair may take different paths application transport 5. Data flow begins 6. Receive data 4. Call connected 3. Accept call 1. Initiate call 2. incoming call application transport 23 Forwarding Table 4 billion possible entries Destination Address Range Link Interface 11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111 otherwise 3 24
Longest Prefix Matching Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3 Examples DA: 11001000 00010111 00010110 10100001 Which interface? DA: 11001000 00010111 00011000 10101010 Which interface? 25 Datagram or VC Network: Why? Internet Data exchange among computers Elastic service, no strict timing req. Smart end systems (computers) Can adapt, perform control, error recovery Simple inside, complexity at edge Many link types Different characteristics Uniform service difficult ATM Evolved from telephony Human conversation: strict timing, reliability requirements need for guaranteed service Dumb end systems Telephones complexity inside 26
Part III IP: The Internet Protocol 27 The Internet Network Layer Host, router layer functions: Transport layer: TCP, UDP Network layer Routing protocols path selection RIP, OSPF, BGP forwarding table IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router signaling Link layer layer 28
IP Addressing: Introduction IP address: 32-bit identifier for host, router interface Interface: connection between host/router and link Router s typically have multiple interfaces Host may have multiple interfaces IP addresses associated with each interface 223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.1.3 223.1.3.27 223.1.2.2 223.1.3.1 223.1.3.2 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 29 1 Subnets IP address: Subnet part (high order bits) Host part (low order bits) What s a subnet? Device interfaces with same subnet part of IP address Can ly reach each other without intervening router 223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.2.2 223.1.1.3 223.1.3.27 LAN 223.1.3.1 223.1.3.2 consisting of 3 subnets 30
Subnets Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated s Each isolated is called a subnet 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 Subnet mask: /24 31 Subnets 223.1.1.2 How many? 223.1.1.1 223.1.1.4 223.1.1.3 223.1.9.2 223.1.7.0 223.1.9.1 223.1.8.1 223.1.8.0 223.1.7.1 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 32
IP Adressing: CIDR CIDR: Classless InterDomain Routing Subnet portion of address of arbitrary length Address format: a.b.c.d/x, where x is # bits in subnet portion of address subnet part host part 11001000 00010111 00010000 00000000 200.23.16.0/23 33 IP protocol version number header length (bytes) type of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to how much overhead with TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead IP Datagram Format 32 bits ver head. type of len service length fragment 16-bit identifier flgs offset time to upper Internet live layer checksum 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, typically a TCP or UDP segment) total datagram length (bytes) for fragmentation/ reassembly E.g. timestamp, record route taken, specify list of routers to visit. 34
IP Fragmentation & Reassembly Recipe Network links have MTU (max.transfer size) - largest possible link-level frame Different link types, different MTUs Large IP datagram divided ( fragmented ) within next One datagram becomes several datagrams Reassembled only at final destination IP header bits used to identify, order related fragments reassembly fragmentation: in: one large datagram out: 3 smaller datagrams 35 IP Fragmentation & Reassembly Example 4000 byte datagram MTU = 1500 bytes length =4000 ID =x fragflag =0 offset =0 One large datagram becomes several smaller datagrams 1480 bytes in data field offset = 1480/8 length =1500 length =1500 length =1040 ID =x ID =x ID =x fragflag =1 fragflag =1 fragflag =0 offset =0 offset =185 offset =370 36
NAT: Network Address Translation rest of Internet 138.76.29.7 10.0.0.4 local (e.g., home ) 10.0.0/24 10.0.0.1 10.0.0.2 10.0.0.3 All datagrams leaving local have same single source NAT IP address: 138.76.29.7, different source port numbers Datagrams with source or destination in this have 10.0.0/24 address for source, destination (as usual) 37 NAT: Network Address Translation Motivation: local uses just one IP address as far as outside world is concerned: No need to be allocated range of addresses from ISP: Just one IP address is used for all devices Can change addresses of devices in local without notifying outside world Can change ISP without changing addresses of devices in local Devices inside local net not explicitly addressable, visible by outside world (a security plus) 38
NAT: Network Address Translation Implementation: NAT router must: outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)... remote clients/servers will respond using (NAT IP address, new port #) as destination addr. remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table 39 NAT: Network Address Translation 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table 2 NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 138.76.29.7 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3 3: Reply arrives dest. address: 138.76.29.7, 5001 10.0.0.4 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4 1 1: host 10.0.0.1 sends datagram to 128.119.40, 80 10.0.0.1 10.0.0.2 10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345 40
NAT: Network Address Translation 16-bit port-number field: 60,000 simultaneous connections with a single LANside address! NAT is controversial: Routers should only process up to layer 3 Violates end-to-end argument NAT possibility must be taken into account by app designers, e.g., P2P applications Address shortage should instead be solved by IPv6 41 Part IV Conclusion 42
Assignment & Readings Assignment #3 (ongoing) Assigned at the completion of Session 6 Readings Chapter 4 (4.1, 4.2, 4.4) 43 Next Session: Networks: Part 2 (Routing) 44