Network layer functions. Chapter 4 Network Layer. Network layer functions. Network layer functions

Similar documents
Chapter 4: network layer

Chapter 4: Network Layer, partb

Chapter 4 Network Layer. Network Layer 4-1

Last time. Transitioning to IPv6. Routing. Tunneling. Gateways. Graph abstraction. Link-state routing. Distance-vector routing. Dijkstra's Algorithm

Network layer: Overview. Network layer functions Routing IP Forwarding

Chapter 4: outline. Network Layer 4-1

Lecture 4 - Network Layer. Transport Layer. Outline. Introduction. Notes. Notes. Notes. Notes. Networks and Security. Jacob Aae Mikkelsen

Chapter 4: Network Layer

Chapter IV: Network Layer

Chapter 4: Network Layer

Router Architecture Overview

Chapter 4: Network Layer

Chapter 4: Network Layer. Lecture 12 Internet Routing Protocols. Chapter goals: understand principles behind network layer services:

Hierarchical Routing. Our routing study thus far - idealization all routers identical network flat not true in practice

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 12

Data Communication & Networks G Session 7 - Main Theme Networks: Part I Circuit Switching, Packet Switching, The Network Layer

Computer Networking Introduction

Network Routing. Packet Routing, Routing Algorithms, Routers, Router Architecture

Chapter 4 Network Layer

CS555, Spring /5/2005. April 12, 2005 No classes attend Senior Design Projects conference. Chapter 4 roadmap. Internet AS Hierarchy

Internet rou)ng. V. Arun CS491G: Computer Networking Lab University of MassachuseFs Amherst

TDTS06: computer Networks

Chapter 4 Network Layer

DATA COMMUNICATOIN NETWORKING

Chapter 4: Network Layer. Chapter 4 Network Layer. Chapter 4: Network Layer. Network layer. Chapter goals:

Initial motivation: 32-bit address space soon to be completely allocated. Additional motivation:

Network layer. Network Layer 4-1. application transport network data link physical. network data link physical. network data link physical

CSC 4900 Computer Networks: Routing Protocols

Network Layer: Routing

Internet Protocol: Routing Algorithms. Srinidhi Varadarajan

CSCE 463/612 Networks and Distributed Processing Spring 2018

Announcements. CS 5565 Network Architecture and Protocols. Project 2B. Project 2B. Project 2B: Under the hood. Routing Algorithms

Chapter 4: Network Layer

Chapter 4: Network Layer

CS 43: Computer Networks Internet Routing. Kevin Webb Swarthmore College November 14, 2013

UNIT III THE NETWORK LAYER

Chapter 4: network layer. Network service model. Two key network-layer functions. Network layer. Input port functions. Router architecture overview

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 13

Module 3 Network Layer CS755! 3-1!

Chapter 4: Network Layer: Part II

Network layer: Overview. Network layer functions Routing IP Forwarding

CSc 450/550 Computer Networks Internet Routing

internet technologies and standards

CMSC 332 Computer Networks Network Layer

CS 457 Networking and the Internet. Shortest-Path Problem. Dijkstra s Shortest-Path Algorithm 9/29/16. Fall 2016

Topics for This Week

Chapter 4: Network Layer. TDTS06 Computer networks. Subnets. Subnets. Subnets. IP Addressing: introduction

Department of Computer Science Southern Illinois University Carbondale

CSE 3214: Computer Network Protocols and Applications Network Layer

internet technologies and standards

Network layer. Key Network-Layer Functions. Network service model. Interplay between routing and forwarding. CSE 4213: Computer Networks II

Communication Networks ( ) / Fall 2013 The Blavatnik School of Computer Science, Tel-Aviv University. Allon Wagner

EECS 3214: Computer Networks Protocols and Applications

1-1. Switching Networks (Fall 2010) EE 586 Communication and. October 25, Lecture 24

Master Course Computer Networks IN2097

CSC 401 Data and Computer Communications Networks

Chapter 4 Network Layer

Inter-AS routing and BGP. Network Layer 4-1

Chapter 4: Network Layer

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 14

HY 335 Φροντιστήριο 8 ο

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

Lecture 4 The Network Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Network Layer: Routing. Routing. Routing protocol. Graph abstraction for routing algorithms: graph nodes are routers graph edges are physical links

Chapter 5 Network Layer: The Control Plane

Subnets. IP datagram format. The Internet Network layer. IP Fragmentation and Reassembly. IP Fragmentation & Reassembly. IP Addressing: introduction

Chapter 4. Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, sl April 2009.

Computer Networking Introduction

DATA COMMUNICATOIN NETWORKING

COMP211 Chapter 4 Network Layer: The Data Plane

Chapter 4 Network Layer: The Data Plane

Network Layer. CMPS 4750/6750: Computer Networks

NETWORK LAYER DATA PLANE

CS 43: Computer Networks Internet Routing. Kevin Webb Swarthmore College November 16, 2017

Lecture 4. The Network Layer (cont d)

Last time. Wireless link-layer. Introduction. Characteristics of wireless links wireless LANs networking. Cellular Internet access

CSC 4900 Computer Networks: Routing Algorithms

Routing in the Internet

Chapter 4 Network Layer

5.1 introduction 5.5 The SDN control 5.2 routing protocols plane. Control Message 5.3 intra-as routing in Protocol the Internet

Computer Networks. Instructor: Niklas Carlsson

Data Communications & Networks. Session 7 Main Theme Networks: Part I Circuit Switching, Packet Switching, The Network Layer

CS 43: Computer Networks. 24: Internet Routing November 19, 2018

CSCI Topics: Internet Programming Fall 2008

Quiz. Segment structure and fields Flow control (rwnd) Timeout interval. Phases transition ssthresh setting Cwnd setting

Interplay between routing, forwarding

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

Inter-AS routing. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley

Network layer: Overview. Network Layer Functions

Network Technology 1 5th - Network Layer. Mario Lombardo -

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

Network layer: Overview. Network layer functions IP Routing and forwarding NAT ARP IPv6 Routing

CSC 8560 Computer Networks: Control Plane

Network Layer: Control Plane 5-2

EC441 Fall 2018 Introduction to Computer Networking Chapter4: Network Layer Data Plane

Network Layer: Internet Protocol

Chapter 4 Network Layer

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 11

Hierarchical Routing. Our routing study thus far - idealization all routers identical network flat no true in practice. administrative autonomy

Computer Networks. Instructor: Niklas Carlsson

Transcription:

Network layer functions Chapter 4 Network Layer transport packet from sending to receiving hosts layer entity in every host, router functions: path determination: route taken by packets from source to dest. Routing algorithms forwarding: move packets from router s input to appropriate router output Call setup (VC s): Set-up routes state before sending packet application transport application transport Network Layer 4- Network Layer 4- Network layer functions Network layer functions transport packet from sending to receiving hosts layer entity in every host, router application transport NH TH TH msg msg transport packet from sending to receiving hosts layer entity in every host, router application transport NH TH msg functions: path determination: route taken by packets from source to dest. Routing algorithms forwarding: move packets from router s input to appropriate router output Call setup (VC s): Set-up routes state before sending packet NH application transport functions: path determination: route taken by packets from source to dest. Routing algorithms forwarding: move packets from router s input to appropriate router output Call setup (VC s): Set-up routes state before sending packet NH application transport TH msg Network Layer 4-3 Network Layer 4-4

Interplay between routing and forwarding Connection setup value in arriving packet s header routing algorithm local forwarding table header value output link 000 00 0 00 0 3 3 3 rd important function in some architectures: ATM, frame relay, X.5 before datagrams flow, two end hosts and intervening routers establish virtual connection routers get involved vs transport layer connection service: : between two hosts (may also involve intervening routers in case of VCs) transport: between two processes Network Layer 4-5 Network Layer 4-6 Network service model Network layer service models: Q: What service model for channel transporting datagrams from sender to receiver? Network Architecture Service Model Bandwidth Guarantees? Loss Order Timing Congestion feedback Eample services for individual datagrams: guaranteed delivery guaranteed delivery with less than 40 msec delay Eample services for a flow of datagrams: in-order datagram delivery guaranteed minimum bandwidth to flow restrictions on changes in interpacket spacing Internet ATM ATM ATM ATM best effort CBR VBR ABR UBR none no constant yes rate guaranteed yes rate guaranteed no minimum none no no yes yes yes yes no yes yes no no no (inferred via loss) no congestion no congestion yes no Network Layer 4-7 Network Layer 4-8

Network layer connection and 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 core Virtual circuits source-to-dest path behaves much like telephone circuit performance-wise 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 (dedicated resources = predictable service) Network Layer 4-9 Network Layer 4-0 VC implementation Forwarding table VC number a VC consists of:. path from source to destination. VC numbers, one number for each link along path 3. entries in forwarding tables in routers along path packet belonging to VC carries VC number (rather than dest address) VC number can be changed on each link. New VC number comes from forwarding table Network Layer 4- Forwarding table in northwest router: interface number 3 3 Incoming interface Incoming VC # Outgoing interface Outgoing VC # 3 63 8 3 7 7 97 3 87 Routers maintain connection state information! Network Layer 4-

Virtual circuits: signaling protocols used to setup, maintain teardown VC used in ATM, frame-relay, X.5 not used in today s Internet Datagram s 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. Initiate call. incoming call application transport application transport. Send data. Receive data application transport Network Layer 4-3 Network Layer 4-4 Forwarding table 4 billion possible entries Datagram or VC : why? Destination Address Range 00000 0000 0000000 00000000 through 0 00000 0000 0000 00000 0000 000000 00000000 through 00000 0000 000000 00000 0000 00000 00000000 through 00000 0000 000 otherwise 3 Link Interface Network Layer 4-5 Internet (datagram) data echange among computers elastic service, no strict timing req. smart end systems (computers) can adapt, perform control, error recovery simple inside, compleity at edge many link types different characteristics uniform service difficult ATM (VC) evolved from telephony human conversation: strict timing, reliability requirements need for guaranteed service dumb end systems telephones compleity inside Network Layer 4-6

Router Architecture Overview Input Port Functions Two key router functions: run routing algorithms/protocol (RIP, OSPF, BGP) forwarding datagrams from incoming to outgoing link Physical layer: bit-level reception Data link layer: e.g., Ethernet see chapter 5 Decentralized switching: given datagram dest., lookup output port using forwarding table in input port memory goal: complete input port processing at line speed queuing: if datagrams arrive faster than forwarding rate into switch fabric Network Layer 4-7 Network Layer 4-8 Three types of switching fabrics Switching Via Memory First generation routers: traditional computers with switching under direct control of CPU packet copied to system s memory speed limited by memory bandwidth ( bus crossings per datagram) Input Port Memory Output Port System Bus Network Layer 4-9 Network Layer 4-0

Switching Via a Bus Switching Via An Interconnection Network datagram from input port memory to output port memory via a shared bus bus contention: switching speed limited by bus bandwidth 3 Gbps bus, Cisco 5600: sufficient speed for access and enterprise routers overcome bus bandwidth limitations Banyan s, other interconnection nets initially developed to connect processors in multiprocessor advanced design: fragmenting datagram into fied length cells, switch cells through the fabric. Cisco 000: switches 60 Gbps through the interconnection Network Layer 4- Network Layer 4- Output Ports Output port queueing Buffering required when datagrams arrive from fabric faster than the transmission rate Scheduling discipline chooses among queued datagrams for transmission Network Layer 4-3 buffering when arrival rate via switch eceeds output line speed queueing (delay) and loss due to output port buffer overflow! Network Layer 4-4

How much buffering? RFC 3439 rule of thumb: average buffering equal to typical RTT (say 50 msec) times link capacity C e.g., C = 0 Gps link:.5 Gbit buffer Recent recommendation: with N flows, buffering equal to RTT. C N Input Port Queuing Fabric slower than input ports combined -> queueing may occur at input queues Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward queueing delay and loss due to input buffer overflow! Network Layer 4-5 Network Layer 4-6 The Internet Network layer Host, router layer functions: Network layer Routing protocols path selection RIP, OSPF, BGP Transport layer: TCP, UDP forwarding table Link layer layer IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router signaling Network Layer 4-7 IP datagram format IP protocol version number header length (bytes) type of data ma number remaining hops (decremented at each router) upper layer protocol to deliver payload to how much overhead with TCP? 0 bytes of TCP 0 bytes of IP = 40 bytes + app layer overhead 3 bits head. type of ver length len service fragment 6-bit identifier flgs offset time to upper header live layer checksum 3 bit source IP address 3 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. Network Layer 4-8

IP Fragmentation & Reassembly IP Fragmentation and Reassembly links have MTU (ma.transfer size) - largest possible link-level frame. different link types, different MTUs large IP datagram divided ( fragmented ) within net 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 Eample 4000 byte datagram MTU = 500 bytes 480 bytes in data field offset = 480/8 length =4000 ID = fragflag =0 offset =0 One large datagram becomes several smaller datagrams length ID fragflag offset =500 = = =0 length =500 length =040 ID = ID = fragflag = fragflag =0 offset =85 offset =370 Network Layer 4-9 Network Layer 4-30 IP Addressing: introduction IP address: 3-bit identifier for host, router interface interface: connection between host/router and link router s typically have multiple interfaces host typically has one interface IP addresses associated with each interface 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3... 3..3. 3... = 0 0000000 0000000 0000000 3 Network Layer 4-3 IP Addressing Address can be divided in two parts NetID HostID NetID identifies the HostID identifies the host within the Network Host Hosts within the same have the same NetId Network Layer 4-3

Subnets Subnets 3...0/4 3...0/4 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 3... 3... 3... 3...4 3...9 3... 3...3 3..3.7 subnet 3..3. 3..3. consisting of 3 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. 3..3.0/4 Subnet mask: /4 Network Layer 4-33 Network Layer 4-34 Subnets 3... IP Addresses How many? 3... 3...4 given notion of, let s re-eamine IP addresses: 3...3 class-full addressing: 3..9. 3..7.0 class A 0 host.0.0.0 to 7.55.55.55 3..9. 3..8. 3...6 3... 3... 3..7. 3..8.0 3..3.7 3..3. 3..3. B C D 0 host 0 host 0 multicast address 3 bits 8.0.0.0 to 9.55.55.55 9.0.0.0 to 3.55.55.55 4.0.0.0 to 39.55.55.55 Network Layer 4-35 Network Layer 4-36

Counting up 3 bit IP address: 3 = 4.94.967.96 theoretical IP addresses class A: The IP 7 - =6 s [0.0.0.0 and 7.0.0.0 reserved] address 4 - = 6.777.4 maimum hosts Pie!.3.98.964 addressable hosts (49,% of ma) class B 4 =6.384 s Class B 6 - = 65.534 maimum hosts Class A.073.709.056 addressable hosts (4,99% of ma) C class C D =.097.5 s E 8 - = 54 maimum hosts 53.676.608 addressable hosts (,40% of ma) Special Addresses Network Address: An address with the HostID bits set to 0 identifies the with the given NetID (used in routing tables) eamples: class B : 3.75.0.0 class C : 93.7.3.0 93.7.3.76 93.7.3.55 93.7.3.0 93.7.3.45 Network Layer 4-37 Network Layer 4-38 Special Addresses Direct Broadcast Address: Address with HostID bit set to is the broadcast address of the identified by NetID. eample: 93.7.3.55 IP addressing: CIDR CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/, where is # bits in subnet portion of address 93.7.3.76 93.7.3.55 93.7.3.45 93.7.3.0 subnet part host part 00000 0000 0000000 00000000 00.3.6.0/3 Network Layer 4-39 Network Layer 4-40

IP addresses: how to get one? Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->->configuration- >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server plug-and-play Network Layer 4-4 DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from server when it joins Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an on ) Support for mobile users who want to join (more shortly) DHCP overview: host broadcasts DHCP discover msg DHCP server responds with DHCP offer msg host requests IP address: DHCP request msg DHCP server sends address: DHCP ack msg Network Layer 4-4 DHCP client-server scenario A B 3... DHCP server 3... 3...4 3...9 3...3 3..3. 3..3.7 3... E 3..3. 3... arriving DHCP client needs address in this Network Layer 4-43 DHCP client-server scenario DHCP server: 3...5 time DHCP request DHCP discover src : 0.0.0.0, 68 dest.: 55.55.55.55,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 0.0.0.0, 68 dest:: 55.55.55.55, 67 yiaddrr: 3...4 transaction ID: 655 Lifetime: 3600 secs src: 3...5, 67 dest: 55.55.55.55, 68 yiaddrr: 3...4 transaction ID: 654 Lifetime: 3600 secs DHCP ACK src: 3...5, 67 dest: 55.55.55.55, 68 yiaddrr: 3...4 transaction ID: 655 Lifetime: 3600 secs arriving client Network Layer 4-44

Getting a datagram from source to dest. IP datagram: misc source dest fields IP addr IP addr data datagram remains unchanged, as it travels source to destination addr fields of interest here A B forwarding table in A Dest. Net. net router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3...3 E 3..3. Getting a datagram from source to dest. misc fields 3... 3...3 data Starting at A, send IP datagram addressed to B: look up net. address of B in forwarding table find B is on same net. as A link layer will send datagram directly to B inside link-layer frame B and A are directly connected A B forwarding table in A Dest. Net. net router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3...3 E 3..3. Network Layer 4-45 Network Layer 4-46 Getting a datagram from source to dest. misc fields 3... 3...3 data Starting at A, dest. E: look up address of E in forwarding table E on different A, E not directly attached routing table: net hop router to E is 3...4 link layer sends datagram to router 3...4 inside linklayer frame datagram arrives at 3...4 continued.. A B forwarding table in A Dest. Net. net router Nhops 3.. 3.. 3...4 3..3 3...4 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3...3 E 3..3. Network Layer 4-47 Getting a datagram from source to dest. forwarding table in router misc fields 3... 3...3 data Dest. Net router Nhops interface 3.. - 3...4 Arriving at 3..4, 3.. - 3...9 destined for 3... 3..3-3..3.7 look up address of E in router s forwarding table A 3... E on same as router s 3... 3... interface 3...9 3...4 3...9 router, E directly attached link layer sends datagram to 3...3 inside link-layer frame via interface 3...9 datagram arrives at 3...3!!! (hooray!) B 3...3 3..3. 3..3.7 3...3 E 3..3. Network Layer 4-48

Forwarding table 4 billion possible entries Longest prefi matching Destination Address Range 00000 0000 0000000 00000000 through 0 00000 0000 0000 Link Interface Prefi Match Link Interface 00000 0000 0000 0 00000 0000 000000 00000 0000 000 otherwise 3 00000 0000 000000 00000000 through 00000 0000 000000 00000 0000 00000 00000000 through 00000 0000 000 otherwise 3 Network Layer 4-49 Eamples DA: 00000 0000 00000 00000 DA: 00000 0000 000000 0000 Which interface? Which interface? Network Layer 4-50 IP addresses: how to get one? Q: How does get subnet part of IP addr? A: gets allocated portion of its provider ISP s address space ISP's block 00000 0000 0000000 00000000 00.3.6.0/0 Organization 0 00000 0000 0000000 00000000 00.3.6.0/3 Organization 00000 0000 000000 00000000 00.3.8.0/3 Organization 00000 0000 000000 00000000 00.3.0.0/3....... Organization 7 00000 0000 0000 00000000 00.3.30.0/3 Hierarchical addressing: route aggregation Hierarchical addressing allows efficient advertisement of routing information: Organization 0 00.3.6.0/3 Organization 00.3.8.0/3 Organization 00.3.0.0/3 Organization 7 00.3.30.0/3.... Fly-By-Night-ISP ISPs-R-Us Send me anything with addresses beginning 00.3.6.0/0 Send me anything with addresses beginning 99.3.0.0/6 Internet Network Layer 4-5 Network Layer 4-5

Hierarchical addressing: more specific routes ISPs-R-Us has a more specific route to Organization Organization 0 00.3.6.0/3 Organization 00.3.0.0/3 Organization 7 00.3.30.0/3.... Organization 00.3.8.0/3 Fly-By-Night-ISP ISPs-R-Us Send me anything with addresses beginning 00.3.6.0/0 Send me anything with addresses beginning 99.3.0.0/6 or 00.3.8.0/3 Internet IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes Network Layer 4-53 Network Layer 4-54 NAT: Network Address Translation NAT: Network Address Translation rest of Internet 38.76.9.7 All datagrams leaving local have same single source NAT IP address: 38.76.9.7, different source port numbers 0.0.0.4 local (e.g., home ) 0.0.0/4 Datagrams with source or destination in this have 0.0.0/4 address for source, destination (as usual) 0.0.0. 0.0.0. 0.0.0.3 Motivation: local uses just one IP address as far as outside world is concerned: range of addresses not needed from ISP: just one IP address 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 eplicitly addressable, visible by outside world (a security plus). Network Layer 4-55 Network Layer 4-56

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 Network Layer 4-57 NAT: Network Address Translation : NAT router changes datagram source addr from 0.0.0., 3345 to 38.76.9.7, 500, updates table NAT translation table WAN side addr LAN side addr 38.76.9.7, 500 0.0.0., 3345 S: 38.76.9.7, 500 D: 8.9.40.86, 80 S: 8.9.40.86, 80 D: 38.76.9.7, 500 3 3: Reply arrives dest. address: 38.76.9.7, 500 0.0.0.4 S: 0.0.0., 3345 D: 8.9.40.86, 80 38.76.9.7 S: 8.9.40.86, 80 D: 0.0.0., 3345 4 : host 0.0.0. sends datagram to 8.9.40.86, 80 0.0.0. 0.0.0. 0.0.0.3 4: NAT router changes datagram dest addr from 38.76.9.7, 500 to 0.0.0., 3345 Network Layer 4-58 NAT: Network Address Translation NAT traversal problem 6-bit port-number field: 60,000 simultaneous connections with a single LAN-side 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, eg, PP applications address shortage should instead be solved by IPv6 Network Layer 4-59 client wants to connect to server with address 0.0.0. server address 0.0.0. local to LAN (client can t use it as destination addr) only one eternally visible NATted address: 38.76.9.7 solution : statically configure NAT to forward incoming connection requests at given port to server e.g., (3.76.9.7, port 500) always forwarded to 0.0.0. port 5000 Client? 38.76.9.7 NAT router 0.0.0.4 0.0.0. Network Layer 4-60

NAT traversal problem solution : Universal Plug and Play (UPnP) Internet Gateway Device (IGD) Protocol. Allows NATted host to: learn public IP address (38.76.9.7) add/remove port mappings (with lease times) i.e., automate static NAT port map configuration 38.76.9.7 NAT router IGD 0.0.0.4 0.0.0. NAT traversal problem solution 3: relaying (used in Skype) Client NATed client establishes connection to relay Eternal client connects to relay relay bridges packets between to connections. connection to relay initiated by client 3. relaying established. connection to relay initiated by NATted host 38.76.9.7 NAT router 0.0.0. Network Layer 4-6 Network Layer 4-6 Graph abstraction Graph abstraction: costs Graph: G = (N,E) 5 v 3 u 3 w 5 z y N = set of routers = { u, v, w,, y, z } E = set of links ={ (u,v), (u,), (v,), (v,w), (,w), (,y), (w,y), (w,z), (y,z) } Remark: Graph abstraction is useful in other contets Eample: PP, where N is set of peers and E is set of TCP connections 5 c(, ) = cost of link (, ) v 3 w 5 u 3 y z - e.g., c(w,z) = 5 cost could always be, or inversely related to bandwidth, or inversely related to congestion Cost of path (,, 3,, p ) = c(, ) + c(, 3 ) + + c( p-, p ) Question: What s the least-cost path between u and z? Routing algorithm: algorithm that finds least-cost path Network Layer 4-63 Network Layer 4-64

Routing Algorithm classification A Link-State Routing Algorithm Global or decentralized information? Global: all routers have complete topology, link cost info link state algorithms Decentralized: router knows lyconnected neighbors, link costs to neighbors iterative process of computation, echange of info with neighbors distance vector algorithms Static or dynamic? Static: routes change slowly over time Dynamic: routes change more quickly periodic update in response to link cost changes Dijkstra s algorithm net topology, link costs known to all nodes accomplished via link state broadcast all nodes have same info computes least cost paths from one node ( source ) to all other nodes gives forwarding table for that node iterative: after k iterations, know least cost path to k dest. s Notation: c(,y): link cost from node to y; = if not direct neighbors D(v): current value of cost of path from source to dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known Network Layer 4-65 Network Layer 4-66 Dijsktra s Algorithm Dijkstra s algorithm: eample Initialization: N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = 7 8 Loop 9 find w not in N' such that D(w) is a minimum 0 add w to N' update D(v) for all v adjacent to w and not in N' : D(v) = min( D(v), D(w) + c(w,v) ) 3 /* new cost to v is either old cost to v or known 4 shortest path cost to w plus cost from w to v */ 5 until all nodes in N' Step 0 3 4 N' u u uy uyv uyvw 5 uyvwz u D(v),p(v),u,u,u 5 v D(w),p(w) 5,u 4, 3,y 3,y 3 3 w y 5 D(),p(),u z D(y),p(y), D(z),p(z) 4,y 4,y 4,y Network Layer 4-67 Network Layer 4-68

Dijkstra s algorithm: eample () Dijkstra s algorithm, discussion Resulting shortest-path tree from u: destination v y w z u link v Resulting forwarding table in u: (u,v) (u,) (u,) (u,) (u,) w y z Network Layer 4-69 Algorithm compleity: n nodes each iteration: need to check all nodes, w, not in N n(n+)/ comparisons: O(n ) more efficient implementations possible: O(nlogn) Oscillations possible: e.g., link cost = amount of carried traffic A +e D B 0 0 0 C e e initially A +e 0 D B 0 +e C 0 recompute routing A 0 +e D B 0 0 C +e recompute A +e 0 D B 0 +e C e recompute Network Layer 4-70 Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define d (y) := cost of least-cost path from to y Then d (y) = min {c(,v) + d v (y) } v where min is taken over all neighbors v of Network Layer 4-7 Bellman-Ford eample u 5 v 3 3 w y 5 z Clearly, d v (z) = 5, d (z) = 3, d w (z) = 3 B-F equation says: d u (z) = min { c(u,v) + d v (z), c(u,) + d (z), c(u,w) + d w (z) } = min { + 5, + 3, 5 + 3} = 4 Node that achieves minimum is net hop in shortest path forwarding table Network Layer 4-7

Distance Vector Algorithm D (y) = estimate of least cost from to y Node knows cost to each neighbor v: c(,v) Node maintains distance vector D = [D (y): y є N ] Node also maintains its neighbors distance vectors For each neighbor v, maintains D v = [D v (y): y є N ] Distance vector algorithm (4) Basic idea: From time-to-time, each node sends its own distance vector estimate to neighbors Asynchronous When a node receives new DV estimate from neighbor, it updates its own DV using B-F equation: D (y) min v {c(,v) + D v (y)} for each node y N Under minor, natural conditions, the estimate D (y) converge to the actual least cost d (y) Network Layer 4-73 Network Layer 4-74 Distance Vector Algorithm (5) Iterative, asynchronous: each local iteration caused by: local link cost change DV update message from neighbor Distributed: each node notifies neighbors only when its DV changes neighbors then notify their neighbors if necessary Each node: wait for (change in local link cost or msg from neighbor) recompute estimates if DV to any dest has changed, notify neighbors Network Layer 4-75 D (y) = min{c(,y) + D y (y), c(,z) + D z (y)} = min{+0, 7+} = node table cost to cost to y z y z 0 7 y z node y table cost to y z from from from y z 0 node z table cost to y z y z 7 0 from y z 0 3 0 7 0 time D (z) = min{c(,y) + D y (z), c(,z) + D z (z)} = min{+, 7+0} = 3 y 7 z Network Layer 4-76

D (y) = min{c(,y) + D y (y), c(,z) + D z (y)} = min{+0, 7+} = node table cost to cost to cost to y z y z y z 0 7 0 3 0 3 y y 0 y 0 z z 7 0 z 3 0 node y table cost to cost to cost to y z y z y z 0 7 0 3 y 0 y 0 y 0 z z 7 0 z 3 0 from from node z table cost to y z from y z 7 0 from from from y z cost to y z 0 7 0 3 0 from from from y z cost to y z 0 3 0 3 0 time D (z) = min{c(,y) + D y (z), c(,z) + D z (z)} = min{+, 7+0} = 3 y 7 z Network Layer 4-77 Distance Vector: link cost changes Link cost changes: node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors good news travels fast 4 At time t 0, y detects the link-cost change, updates its DV, and informs its neighbors. At time t, z receives the update from y and updates its table. It computes a new least cost to and sends its neighbors its DV. At time t, y receives z s update and updates its distance table. y s least costs do not change and hence y does not send any message to z. y 50 z Network Layer 4-78 Distance Vector: link cost changes Comparison of LS and DV algorithms Link cost changes: good news travels fast bad news travels slow - count to infinity problem! 44 iterations before algorithm stabilizes: see tet Poisoned reverse: If Z routes through Y to get to X : Z tells Y its (Z s) distance to X is infinite (so Y won t route to X via Z) will this completely solve count to infinity problem? 60 4 y 50 z Network Layer 4-79 Message compleity LS: with n nodes, E links, O(nE) msgs sent DV: echange between neighbors only convergence time varies Speed of Convergence LS: O(n ) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies may be routing loops count-to-infinity problem Robustness: what happens if router malfunctions? LS: node can advertise incorrect link cost each node computes only its own table DV: DV node can advertise incorrect path cost each node s table used by others error propagate thru Network Layer 4-80

Hierarchical Routing Hierarchical Routing Our routing study thus far - idealization all routers identical flat not true in practice scale: with 00 million destinations: can t store all dest s in routing tables! routing table echange would swamp links! administrative autonomy internet = of s each admin may want to control routing in its own Network Layer 4-8 Network Layer 4-8 Hierarchical Routing Intra-AS and Inter-AS routing aggregate routers into regions, autonomous systems (AS) routers in same AS run same routing protocol intra-as routing protocol routers in different AS can run different intra- AS routing protocol gateway routers special routers in AS run intra-as routing protocol with all other routers in AS also responsible for routing to destinations outside AS run inter-as routing protocol with other gateway routers a C C.b b d A A.a a b inter-as, intra-as routing in gateway A.c A.c c B.a a B c Gateways: perform inter-as routing amongst themselves b perform intra-as routers with other routers in their AS layer link layer layer Network Layer 4-83 Network Layer 4-84

Intra-AS and Inter-AS routing Interconnected ASes a Host h C C.b b A.a Inter-AS routing between A and B A.c a d A b c Intra-AS routing within AS A B.a a B c b Host h Intra-AS routing within AS B We ll eamine specific inter-as and intra-as Internet routing protocols shortly 3c 3a 3b AS3 a c d b Intra-AS Routing algorithm AS Forwarding table Inter-AS Routing algorithm a c b AS forwarding table configured by both intra- and inter-as routing algorithm intra-as sets entries for internal dests inter-as & intra-as sets entries for eternal dests Network Layer 4-85 Network Layer 4-86 Inter-AS tasks suppose router in AS receives datagram destined outside of AS: router should forward packet to gateway router, but which one? AS must:. learn which dests are reachable through AS, which through AS3. propagate this reachability info to all routers in AS Job of inter-as routing! Eample: Setting forwarding table in router d suppose AS learns (via inter-as protocol) that subnet reachable via AS3 (gateway c) but not via AS. inter-as protocol propagates reachability info to all internal routers. router d determines from intra-as routing info that its interface I is on the least cost path to c. installs forwarding table entry (,I) 3c 3a 3b AS3 a c d b AS a c b AS Network Layer 4-87 3c 3a 3b AS3 a c d b AS a c b AS Network Layer 4-88

Eample: Choosing among multiple ASes now suppose AS learns from inter-as protocol that subnet is reachable from AS3 and from AS. to configure forwarding table, router d must determine towards which gateway it should forward packets for dest. this is also job of inter-as routing protocol! 3c 3a 3b AS3 a c d b AS a c b AS Eample: Choosing among multiple ASes now suppose AS learns from inter-as protocol that subnet is reachable from AS3 and from AS. to configure forwarding table, router d must determine towards which gateway it should forward packets for dest. this is also job of inter-as routing protocol! hot potato routing: send packet towards closest of two routers. Learn from inter-as protocol that subnet is reachable via multiple gateways Use routing info from intra-as protocol to determine costs of least-cost paths to each of the gateways Hot potato routing: Choose the gateway that has the smallest least cost Determine from forwarding table the interface I that leads to least-cost gateway. Enter (,I) in forwarding table Network Layer 4-89 Network Layer 4-90 Routing in the Internet The Global Internet consists of Autonomous Systems (AS) interconnected with each other: Stub AS: small corporation: one connection to other AS s Multihomed AS: large corporation (no transit): multiple connections to other AS s Transit AS: provider, hooking many AS s together Two-level routing: Intra-AS: administrator responsible for choice of routing algorithm within Inter-AS: unique standard for inter-as routing: BGP Internet AS Hierarchy Inter-AS border (eterior gateway) routers Intra-AS interior (gateway) routers Network Layer 4-9 Network Layer 4-9

Intra-AS Routing RIP ( Routing Information Protocol) also known as Interior Gateway Protocols (IGP) most common Intra-AS routing protocols: RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gateway Routing Protocol (Cisco proprietary) distance vector algorithm included in BSD-UNIX Distribution in 98 distance metric: # of hops (ma = 5 hops) z u A C B D v y w From router A to subnets: destination hops u v w 3 y 3 z Network Layer 4-93 Network Layer 4-94 RIP advertisements distance vectors: echanged among neighbors every 30 sec via Response Message (also called advertisement) each advertisement: list of up to 5 destination subnets within AS Network Layer 4-95 RIP: Eample w y A D B C Destination Network Net Router Num. of hops to dest. w A y B z B 7 --..... Routing/Forwarding table in D z Network Layer 4-96

RIP: Eample Dest hops w z 4.... Advertisement from A to D w y A D B C Destination Network Net Router Num. of hops to dest. w A y B z B A 7 5 --..... Routing/Forwarding table in D z Network Layer 4-97 RIP: Link Failure and Recovery If no advertisement heard after 80 sec --> neighbor/link declared dead routes via neighbor invalidated new advertisements sent to neighbors neighbors in turn send out new advertisements (if tables changed) link failure info quickly (?) propagates to entire net poison reverse used to prevent ping-pong loops (infinite distance = 6 hops) Network Layer 4-98 RIP Table processing RIP routing tables managed by application-level process called route-d (daemon) advertisements sent in UDP packets, periodically repeated routed routed RIP message 0 7 8 5 6 3 Command (-6)Version () 0 Address family () 0 IP address 0 0 Metric 0 bytes Transprt (UDP) forwarding (IP) table link forwarding table Transprt (UDP) (IP) link Network Layer 4-99 Up to 4 more routes with same 0 bytes format Command: =request to send all or part of the routing table; =reply (3-6 obsolete or non documented) Address family: =IP addresses metric: distance of emitting router from the specified IP address in number of hops (valid from to 5; 6=infinite) Network Layer 4-00

Message size 8 UDP header 4 bytes RIP header 0 bytes up to 5 entries total: maimum of 5 bytes UDP datagram 5 entries: too little to transfer an entire routing table more than UDP datagram generally needed Initialization When routing daemon started, send special RIP request on every interface command = (request) one entry all bit set to 0 This asks for complete routing table from all connected routers allows to discover adjacent routers! Network Layer 4-0 Network Layer 4-0 OSPF (Open Shortest Path First) open : publicly available uses Link State algorithm LS packet dissemination topology map at each node route computation using Dijkstra s algorithm OSPF advertisement carries one entry per neighbor router advertisements disseminated to entire AS (via flooding) carried in OSPF messages directly over IP (rather than TCP or UDP OSPF advanced features (not in RIP) security: all OSPF messages authenticated (to prevent malicious intrusion) multiple same-cost paths allowed (only one path in RIP) For each link, multiple cost metrics for different TOS (e.g., satellite link cost set low for best effort; high for real time) integrated uni- and multicast support: Multicast OSPF (MOSPF) uses same topology data base as OSPF hierarchical OSPF in large domains. Network Layer 4-03 Network Layer 4-04

Hierarchical OSPF Hierarchical OSPF two-level hierarchy: local area, backbone. Link-state advertisements only in area each nodes has detailed area topology; only know direction (shortest path) to nets in other areas. area border routers: summarize distances to nets in own area, advertise to other Area Border routers. backbone routers: run OSPF routing limited to backbone. boundary routers: connect to other AS s. Network Layer 4-05 Network Layer 4-06 Internet inter-as routing: BGP BGP (Border Gateway Protocol): the de facto standard BGP provides each AS a means to:. Obtain subnet reachability information from neighboring ASs.. Propagate reachability information to all ASinternal routers. 3. Determine good routes to subnets based on reachability information and policy. allows subnet to advertise its eistence to rest of Internet: I am here Network Layer 4-07 BGP basics pairs of routers (BGP peers) echange routing info over semi-permanent TCP connections: BGP sessions BGP sessions need not correspond to links. when AS advertises a prefi to AS: AS promises it will forward datagrams towards that prefi. AS can aggregate prefies in its advertisement 3c 3a 3b AS3 a AS c d ebgp session ibgp session b a c b AS Network Layer 4-08

Distributing reachability info using ebgp session between 3a and c, AS3 sends prefi reachability info to AS. c can then use ibgp do distribute new prefi info to all routers in AS b can then re-advertise new reachability info to AS over b-to-a ebgp session when router learns of new prefi, it creates entry for prefi in its forwarding table. 3c 3a 3b AS3 a AS c d ebgp session ibgp session b a c b AS Network Layer 4-09 Path attributes & BGP routes advertised prefi includes BGP attributes. prefi + attributes = route two important attributes: AS-PATH: contains ASs through which prefi advertisement has passed: e.g, AS 67, AS 7 NEXT-HOP: indicates specific internal-as router to net-hop AS. (may be multiple links from current AS to net-hop-as) when gateway router receives route advertisement, uses import policy to accept/decline. Network Layer 4-0 BGP route selection BGP messages router may learn about more than route to some prefi. Router must select route. elimination rules:. local preference value attribute: policy decision. shortest AS-PATH 3. closest NEXT-HOP router: hot potato routing 4. additional criteria BGP messages echanged using TCP. BGP messages: OPEN: opens TCP connection to peer and authenticates sender UPDATE: advertises new path (or withdraws old) KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also used to close connection Network Layer 4- Network Layer 4-

Putting it Altogether: How Does an Entry Get Into a Router s Forwarding Table? Answer is complicated! Ties together hierarchical routing (Section 4.5.3) with BGP (4.6.3) and OSPF (4.6.). How does entry get in forwarding table? entry routing algorithms local forwarding table prefi 38.6.64/ output 3 port 4./6 /8 4.. Assume prefi is in another AS. Provides nice overview of BGP! Dest IP 3 How does entry get in forwarding table? High-level overview. Router becomes aware of prefi. Router determines output port for prefi 3. Router enters prefi-port in forwarding table Router becomes aware of prefi other s 3c 3a 3b AS3 a AS BGP message c d b c a b AS other s BGP message contains routes route is a prefi and attributes: AS-PATH, NEXT- HOP, Eample: route: Prefi:38.6.64/ ; AS-PATH: AS3 AS3 ; NEXT-HOP: 0.44.3.5

Router may receive multiple routes other s 3c 3a 3b AS3 a AS BGP message c d b c a b AS other s Router may receive multiple routes for same prefi Has to select one route Select best BGP route to prefi Router selects route based on shortest AS-PATH Eample: select AS AS7 to 38.6.64/ AS3 AS3 AS0 to 38.6.64/ What if there is a tie? We ll come back to that! Find best intra-route to BGP route Use selected route s NEXT-HOP attribute Route s NEXT-HOP attribute is the IP address of the router interface that begins the AS PATH. Eample: AS-PATH: AS AS7 ; NEXT-HOP:.99.86.55 Router uses OSPF to find shortest path from c to.99.86.55 other s 3c 3a 3b AS3 a AS c d.99.86.55 c a b b AS other s Router identifies port for route Identifies port along the OSPF shortest path Adds prefi-port entry to its forwarding table: other s (38.6.64/, port 4) 3c 3a 3b AS3 c 4 3 a AS d router port b c a b AS other s

Hot Potato Routing Suppose there two or more best inter-routes. Then choose route with closest NEXT-HOP other s Use OSPF to determine which gateway is closest Q: From c, chose AS3 AS3 or AS AS7? A: route AS3 AS0 since it is closer 3c 3a 3b AS3 a AS c d b c a b AS other s How does entry get in forwarding table? Summary. Router becomes aware of prefi via BGP route advertisements from other routers. Determine router output port for prefi Use BGP route selection to find best inter-as route Use OSPF to find best intra-as route leading to best inter-as route Router identifies router port for that best route 3. Enter prefi-port entry in forwarding table BGP routing policy BGP routing policy () W A B C X legend: provider customer : W A B C X legend: provider customer : A,B,C are provider s X,W,Y are customer (of provider s) X is dual-homed: attached to two s X does not want to route from B via X to C.. so X will not advertise to B a route to C Y Network Layer 4-3 A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C? Y No way! B gets no revenue for routing CBAW since neither W nor C are B s customers B wants to force C to route to w via A B wants to route only to/from its customers! Network Layer 4-4

Why different Intra- and Inter-AS routing? Policy: Inter-AS: admin wants control over how its traffic routed, who routes through its net. Intra-AS: single admin, so no policy decisions needed Scale: hierarchical routing saves table size, reduced update traffic Performance: Intra-AS: can focus on performance Inter-AS: policy may dominate over performance Network Layer 4-5