Network layer functions. Chapter 4 Network Layer. Connection setup. Interplay between routing and forwarding



Similar documents
CS Computer Networks 1: Routing Algorithms

Based on Computer Networking, 4 th Edition by Kurose and Ross

CS 78 Computer Networks. Internet Protocol (IP) our focus. The Network Layer. Interplay between routing and forwarding

Routing Protocols. Interconnected ASes. Hierarchical Routing. Hierarchical Routing

IP addressing and forwarding Network layer

Network layer" 1DT066! Distributed Information Systems!! Chapter 4" Network Layer!! goals: "

Chapter 4 Network Layer

Chapter 4 Network Layer

IP addressing. Interface: Connection between host, router and physical link. IP address: 32-bit identifier for host, router interface

CS 457 Lecture 19 Global Internet - BGP. Fall 2011

value in arriving packet s header routing algorithm local forwarding table header value output link

CS 43: Computer Networks IP. Kevin Webb Swarthmore College November 5, 2013

Datagram-based network layer: forwarding; routing. Additional function of VCbased network layer: call setup.

Advanced Networking Routing: RIP, OSPF, Hierarchical routing, BGP

Network layer: Overview. Network layer functions IP Routing and forwarding

Based on Computer Networking, 4 th Edition by Kurose and Ross

Route Discovery Protocols

Internet inter-as routing: BGP

Classful IP Addressing. Classless Addressing: CIDR. Routing & Forwarding: Logical View of a Router. IP Addressing: Basics

Module 7. Routing and Congestion Control. Version 2 CSE IIT, Kharagpur

Border Gateway Protocol (BGP)

Internet Protocol: IP packet headers. vendredi 18 octobre 13

Компјутерски Мрежи NAT & ICMP

Dynamic Routing Protocols II OSPF. Distance Vector vs. Link State Routing

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

Introduction to LAN/WAN. Network Layer (part II)

The Network Layer. Raj Jain. Washington University in St. Louis

Internet Protocols Fall Lectures 7-8 Andreas Terzis

The Network Layer. Raj Jain. Washington University in St. Louis

Internet inter-as routing: BGP

Answers to Sample Questions on Network Layer

Inter-domain Routing Basics. Border Gateway Protocol. Inter-domain Routing Basics. Inter-domain Routing Basics. Exterior routing protocols created to:

Introduction to TCP/IP

Computer Networks. Main Functions

Lecture 8: Routing I Distance-vector Algorithms. CSE 123: Computer Networks Stefan Savage

Outline. Internet Routing. Alleviating the Problem. DV Algorithm. Routing Information Protocol (RIP) Link State Routing. Routing algorithms

Inter-domain Routing. Outline. Border Gateway Protocol

Network Layer: Network Layer and IP Protocol

8.2 The Internet Protocol

CSC458 Lecture 6. Homework #1 Grades. Inter-domain Routing IP Addressing. Administrivia. Midterm will Cover Following Topics

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

Border Gateway Protocol (BGP-4)

Introduction to LAN/WAN. Network Layer

6.263 Data Communication Networks

Transport and Network Layer

Exterior Gateway Protocols (BGP)

Computer Networks 1 (Mạng Máy Tính 1) Lectured by: Dr. Phạm Trần Vũ

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

Future Internet Technologies

ITRI CCL. IP Routing Primer. Paul C. Huang, Ph.D. ITRI / CCL / N300. CCL/N300; Paul Huang 1999/6/2 1

CSE331: Introduction to Networks and Security. Lecture 8 Fall 2006

GregSowell.com. Mikrotik Routing

How To Understand Bg

The Internet. Internet Technologies and Applications

Routing in Small Networks. Internet Routing Overview. Agenda. Routing in Large Networks

College 5, Routing, Internet. Host A. Host B. The Network Layer: functions

BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Data Center Networks and Basic Switching Technologies

Faculty of Engineering Computer Engineering Department Islamic University of Gaza Network Chapter# 19 INTERNETWORK OPERATION

Internet Protocols. Addressing & Services. Updated:

Classful IP Addressing (cont.)

Outline. EE 122: Interdomain Routing Protocol (BGP) BGP Routing. Internet is more complicated... Ion Stoica TAs: Junda Liu, DK Moon, David Zats

Router and Routing Basics

Using the Border Gateway Protocol for Interdomain Routing

CS 5480/6480: Computer Networks Spring 2012 Homework 3 Due by 1:25 PM MT, Monday March 5 th 2012

CS335 Sample Questions for Exam #2

10CS64: COMPUTER NETWORKS - II

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Module 2 Overview of Computer Networks

IP address format: Dotted decimal notation:

Routing in packet-switching networks

OSPF Routing Protocol

Internetworking and Internet-1. Global Addresses

Overview Computer Networking. IP Address Classes (Some are Obsolete) Outline. Lecture 9 IP Packets. CIDR IP addressing. Forwarding examples

NETWORK LAYER/INTERNET PROTOCOLS

Lecture 8. IP Fundamentals

Network Level Multihoming and BGP Challenges

IP - The Internet Protocol

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Asynchronous Transfer Mode: ATM. ATM architecture. ATM: network or link layer? ATM Adaptation Layer (AAL)

IP Address Classes (Some are Obsolete) Computer Networking. Important Concepts. Subnetting Lecture 8 IP Addressing & Packets

Savera Tanwir. Internet Protocol

Lesson 13: MPLS Networks

Internet Protocols Fall Outline

Internet Infrastructure Measurement: Challenges and Tools

IP Routing Configuring RIP, OSPF, BGP, and PBR

Distance Vector Routing Protocols. Routing Protocols and Concepts Ola Lundh

Technical Support Information Belkin internal use only

Chapter 5: Sample Questions, Problems and Solutions Bölüm 5: Örnek Sorular, Problemler ve Çözümleri Örnek Sorular (Sample Questions):

VLAN und MPLS, Firewall und NAT,

RARP: Reverse Address Resolution Protocol

PRASAD ATHUKURI Sreekavitha engineering info technology,kammam

Subnetting,Supernetting, VLSM & CIDR

Internet Packets. Forwarding Datagrams

Routing Protocols (RIP, OSPF, BGP)

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Internet and IP addressing

Routing with OSPF. Introduction

Ausgewählte Kapitel der Rechnernetze

Transcription:

Network laer functions Chapter 4 Network Laer transport packet from sending to receiving hosts laer entit in ever host, router functions: path determination: route taken b 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 data link data link data link data link data link data link data link data link data link application transport data link Network Laer 4- Network Laer 4- Interpla 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 rela, X.5 before datagrams flow, two end hosts and intervening routers establish virtual connection routers get involved vs transport laer connection service: : between two hosts (ma also involve intervening routers in case of VCs) transport: between two processes Network Laer 4-3 Network Laer 4-4

Network service model Network laer 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 deliver guaranteed deliver with less than 40 msec dela Eample services for a flow of datagrams: in-order datagram deliver 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 es rate guaranteed es rate guaranteed no minimum none no no es es es es no es es no no no (inferred via loss) no congestion no congestion es no Network Laer 4-5 Network Laer 4-6 Network laer connection and connection-less service datagram provides -laer connectionless service VC provides -laer connection service analogous to the transport-laer 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) ever router on source-dest path maintains state for each passing connection link, router resources (bandwidth, buffers) ma be allocated to VC (dedicated resources = predictable service) Network Laer 4-7 Network Laer 4-8

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 Laer 4-9 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 Laer 4-0 Virtual circuits: signaling protocols used to setup, maintain teardown VC used in ATM, frame-rela, X.5 not used in toda s Internet Datagram s no call setup at laer 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 ma take different paths application transport data link 5. Data flow begins 6. Receive data 4. Call connected 3. Accept call. Initiate call. incoming call application transport data link application transport data link. Send data. Receive data application transport data link Network Laer 4- Network Laer 4-

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 Laer 4-3 Eamples DA: 00000 0000 00000 00000 DA: 00000 0000 000000 0000 Which interface? Which interface? Network Laer 4-4 Datagram or VC : wh? Router Architecture Overview Internet (datagram) data echange among computers elastic service, no strict timing req. smart end sstems (computers) can adapt, perform control, error recover simple inside, compleit at edge man link tpes different characteristics uniform service difficult ATM (VC) evolved from telephon human conversation: strict timing, reliabilit requirements need for guaranteed service dumb end sstems telephones compleit inside Network Laer 4-5 Two ke router functions: run routing algorithms/protocol (RIP, OSPF, BGP) forwarding datagrams from incoming to outgoing link Network Laer 4-6

Input Port Functions Three tpes of switching fabrics Phsical laer: bit-level reception Data link laer: e.g., Ethernet see chapter 5 Decentralied switching: given datagram dest., lookup output port using forwarding table in input port memor goal: complete input port processing at line speed queuing: if datagrams arrive faster than forwarding rate into switch fabric Network Laer 4-7 Network Laer 4-8 Switching Via Memor First generation routers: traditional computers with switching under direct control of CPU packet copied to sstem s memor speed limited b memor bandwidth ( bus crossings per datagram) Input Port Memor Output Port Sstem Bus Switching Via a Bus datagram from input port memor to output port memor via a shared bus bus contention: switching speed limited b bus bandwidth 3 Gbps bus, Cisco 5600: sufficient speed for access and enterprise routers Network Laer 4-9 Network Laer 4-0

Switching Via An Interconnection Network Output Ports overcome bus bandwidth limitations Banan s, other interconnection nets initiall 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 Buffering required when datagrams arrive from fabric faster than the transmission rate Scheduling discipline chooses among queued datagrams for transmission Network Laer 4- Network Laer 4- Output port queueing buffering when arrival rate via switch eceeds output line speed queueing (dela) and loss due to output port buffer overflow! Network Laer 4-3 How much buffering? RFC 3439 rule of thumb: average buffering equal to tpical RTT (sa 50 msec) times link capacit C e.g., C = 0 Gps link:.5 Gbit buffer Recent recommendation: with N flows, buffering equal to RTT. C N Network Laer 4-4

Input Port Queuing Fabric slower than input ports combined -> queueing ma occur at input queues Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward queueing dela and loss due to input buffer overflow! The Internet Network laer Host, router laer functions: Network laer Routing protocols path selection RIP, OSPF, BGP Transport laer: TCP, UDP forwarding table IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router signaling Link laer laer Network Laer 4-5 Network Laer 4-6 IP datagram format IP protocol version number header length (btes) tpe of data ma number remaining hops (decremented at each router) upper laer protocol to deliver paload to how much overhead with TCP? 0 btes of TCP 0 btes of IP = 40 btes + app laer overhead 3 bits head. tpe of ver length len service fragment 6-bit identifier flgs offset time to upper header live laer checksum 3 bit source IP address 3 bit destination IP address Options (if an) data (variable length, tpicall a TCP or UDP segment) total datagram length (btes) for fragmentation/ reassembl E.g. timestamp, record route taken, specif list of routers to visit. Network Laer 4-7 IP Fragmentation & Reassembl links have MTU (ma.transfer sie) - largest possible link-level frame. different link tpes, different MTUs large IP datagram divided ( fragmented ) within net one datagram becomes several datagrams reassembled onl at final destination IP header bits used to identif, order related fragments reassembl fragmentation: in: one large datagram out: 3 smaller datagrams Network Laer 4-8

IP Fragmentation and Reassembl IP Addressing: introduction Eample 4000 bte datagram MTU = 500 btes 480 btes 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 IP address: 3-bit identifier for host, router interface interface: connection between host/router and link router s tpicall have multiple interfaces host tpicall 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 Laer 4-9 Network Laer 4-30 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 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 l 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 Network Laer 4-3 Network Laer 4-3

Subnets 3...0/4 3...0/4 Subnets 3... 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 How man? 3... 3...4 3...3 3..9. 3..7.0 3..9. 3..7. 3..8. 3..8.0 3...6 3..3.7 3... 3... 3..3. 3..3. Network Laer 4-33 Network Laer 4-34 IP Addresses given notion of, let s re-eamine IP addresses: class-full addressing: class A B C D 0 host 0 host 0 host 0 multicast address 3 bits.0.0.0 to 7.55.55.55 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 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) Network Laer 4-35 Network Laer 4-36

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 Special Addresses Direct Broadcast Address: Address with HostID bit set to is the broadcast address of the identified b NetID. eample: 93.7.3.55 93.7.3.76 93.7.3.55 93.7.3.45 93.7.3.76 93.7.3.55 93.7.3.0 93.7.3.45 93.7.3.0 Network Laer 4-37 Network Laer 4-38 IP addressing: CIDR CIDR: Classless InterDomain Routing subnet portion of address of arbitrar length address format: a.b.c.d/, where is # bits in subnet portion of address subnet part host part 00000 0000 0000000 00000000 IP addresses: how to get one? Q: How does a host get IP address? hard-coded b sstem admin in a file Windows: control-panel->->configuration- >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dnamic Host Configuration Protocol: dnamicall get address from as server plug-and-pla 00.3.6.0/3 Network Laer 4-39 Network Laer 4-40

DHCP: Dnamic Host Configuration Protocol DHCP client-server scenario Goal: allow host to dnamicall obtain its IP address from server when it joins Can renew its lease on address in use Allows reuse of addresses (onl hold address while connected an on ) Support for mobile users who want to join (more shortl) 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 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 Laer 4-4 Network Laer 4-4 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 iaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 0.0.0.0, 68 dest:: 55.55.55.55, 67 iaddrr: 3...4 transaction ID: 655 Lifetime: 3600 secs src: 3...5, 67 dest: 55.55.55.55, 68 iaddrr: 3...4 transaction ID: 654 Lifetime: 3600 secs DHCP ACK src: 3...5, 67 dest: 55.55.55.55, 68 iaddrr: 3...4 transaction ID: 655 Lifetime: 3600 secs arriving client Network Laer 4-43 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 Organiation 0 00000 0000 0000000 00000000 00.3.6.0/3 Organiation 00000 0000 000000 00000000 00.3.8.0/3 Organiation 00000 0000 000000 00000000 00.3.0.0/3....... Organiation 7 00000 0000 0000 00000000 00.3.30.0/3 Network Laer 4-44

Hierarchical addressing: route aggregation Hierarchical addressing allows efficient advertisement of routing information: Hierarchical addressing: more specific routes ISPs-R-Us has a more specific route to Organiation Organiation 0 Organiation 0 00.3.6.0/3 Organiation 00.3.8.0/3 Organiation 00.3.0.0/3 Organiation 7 00.3.30.0/3.... Fl-B-Night-ISP ISPs-R-Us Send me anthing with addresses beginning 00.3.6.0/0 Send me anthing with addresses beginning 99.3.0.0/6 Internet 00.3.6.0/3 Organiation 00.3.0.0/3 Organiation 7 00.3.30.0/3.... Organiation 00.3.8.0/3 Fl-B-Night-ISP ISPs-R-Us Send me anthing with addresses beginning 00.3.6.0/0 Send me anthing with addresses beginning 99.3.0.0/6 or 00.3.8.0/3 Internet Network Laer 4-45 Network Laer 4-46 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 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 Network Laer 4-47 Network Laer 4-48

NAT: Network Address Translation 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 notifing outside world can change ISP without changing addresses of devices in local devices inside local net not eplicitl addressable, visible b outside world (a securit plus). Network Laer 4-49 NAT: Network Address Translation Implementation: NAT router must: outgoing datagrams: replace (source IP address, port #) of ever 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) ever (source IP address, port #) to (NAT IP address, new port #) translation pair incoming datagrams: replace (NAT IP address, new port #) in dest fields of ever incoming datagram with corresponding (source IP address, port #) stored in NAT table Network Laer 4-50 NAT: Network Address Translation 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: Repl 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 4 D: 0.0.0., 3345 : 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 Laer 4-5 6-bit port-number field: 60,000 simultaneous connections with a single LAN-side address! NAT is controversial: routers should onl process up to laer 3 violates end-to-end argument NAT possibilit must be taken into account b app designers, eg, PP applications address shortage should instead be solved b IPv6 Network Laer 4-5

NAT traversal problem NAT traversal problem 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) onl one eternall visible NATted address: 38.76.9.7 solution : staticall configure NAT to forward incoming connection requests at given port to server e.g., (3.76.9.7, port 500) alwas forwarded to 0.0.0. port 5000 Client? 38.76.9.7 NAT router 0.0.0.4 0.0.0. solution : Universal Plug and Pla (UPnP) Internet Gatewa 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. Network Laer 4-53 Network Laer 4-54 NAT traversal problem solution 3: relaing (used in Skpe) Client NATed client establishes connection to rela Eternal client connects to rela rela bridges packets between to connections. connection to rela initiated b client 3. relaing established. connection to rela initiated b NATted host 38.76.9.7 NAT router 0.0.0. 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. Network Laer 4-55 Network Laer 4-56

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 laer will send datagram directl to B inside link-laer frame B and A are directl 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 Laer 4-57 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 directl attached routing table: net hop router to E is 3...4 link laer sends datagram to router 3...4 inside linklaer 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 Laer 4-58 Getting a datagram from source to dest. misc fields 3... 3...3 data Dest. Arriving at 3..4, destined for 3... look up address of E in router s forwarding table E on same as router s interface 3...9 router, E directl attached link laer sends datagram to 3... inside link-laer frame via interface 3...9 datagram arrives at 3...!!! (hoora!) forwarding table in router Net router Nhops interface 3.. - 3...4 3.. - 3...9 3..3-3..3.7 A B 3... 3... 3... 3...4 3...9 3...3 3..3. 3..3.7 3...3 E 3..3. Network Laer 4-59 Graph abstraction Graph: G = (N,E) 5 v 3 u 3 w 5 N = set of routers = { u, v, w,,, } E = set of links ={ (u,v), (u,), (v,), (v,w), (,w), (,), (w,), (w,), (,) } Remark: Graph abstraction is useful in other contets Eample: PP, where N is set of peers and E is set of TCP connections Network Laer 4-60

Graph abstraction: costs Routing Algorithm classification 5 c(, ) = cost of link (, ) v 3 w 5 u 3 - e.g., c(w,) = 5 cost could alwas be, or inversel related to bandwidth, or inversel related to congestion Cost of path (,, 3,, p ) = c(, ) + c(, 3 ) + + c( p-, p ) Question: What s the least-cost path between u and? Routing algorithm: algorithm that finds least-cost path Network Laer 4-6 Global or decentralied information? Global: all routers have complete topolog, link cost info link state algorithms Decentralied: router knows lconnected neighbors, link costs to neighbors iterative process of computation, echange of info with neighbors distance vector algorithms Static or dnamic? Static: routes change slowl over time Dnamic: routes change more quickl periodic update in response to link cost changes Network Laer 4-6 A Link-State Routing Algorithm Dijsktra s Algorithm Dijkstra s algorithm net topolog, 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(,): link cost from node to ; = 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 definitivel known Network Laer 4-63 Initialiation: 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' Network Laer 4-64

Dijkstra s algorithm: eample Dijkstra s algorithm: eample () Step 0 3 4 5 N' u u u uv uvw uvw 5 uvw D(v),p(v),u,u,u D(w),p(w) 5,u 4, 3, 3, D(),p(),u D(),p(), D(),p() 4, 4, 4, Resulting shortest-path tree from u: u v w Resulting forwarding table in u: u 5 v 3 3 w 5 Network Laer 4-65 destination v w link (u,v) (u,) (u,) (u,) (u,) Network Laer 4-66 Dijkstra s algorithm, discussion Algorithm compleit: 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 initiall A +e 0 D B +e 0 C 0 recompute routing A 0 +e D B 0 0 C +e recompute A +e 0 D B +e 0 C e recompute Network Laer 4-67 Distance Vector Algorithm Bellman-Ford Equation (dnamic programming) Define d () := cost of least-cost path from to Then d () = min {c(,v) + d v () } v where min is taken over all neighbors v of Network Laer 4-68

Bellman-Ford eample Distance Vector Algorithm u 5 v 3 3 w 5 Clearl, d v () = 5, d () = 3, d w () = 3 B-F equation sas: d u () = min { c(u,v) + d v (), c(u,) + d (), c(u,w) + d w () } = min { + 5, + 3, 5 + 3} = 4 Node that achieves minimum is net hop in shortest path forwarding table Network Laer 4-69 D () = estimate of least cost from to Node knows cost to each neighbor v: c(,v) Node maintains distance vector D = [D (): є N ] Node also maintains its neighbors distance vectors For each neighbor v, maintains D v = [D v (): є N ] Network Laer 4-70 Distance vector algorithm (4) Distance Vector Algorithm (5) Basic idea: From time-to-time, each node sends its own distance vector estimate to neighbors Asnchronous When a node receives new DV estimate from neighbor, it updates its own DV using B-F equation: D () min v {c(,v) + D v ()} for each node N Under minor, natural conditions, the estimate D () converge to the actual least cost d () Iterative, asnchronous: each local iteration caused b: local link cost change DV update message from neighbor Distributed: each node notifies neighbors onl when its DV changes neighbors then notif their neighbors if necessar Each node: wait for (change in local link cost or msg from neighbor) recompute estimates if DV to an dest has changed, notif neighbors Network Laer 4-7 Network Laer 4-7

D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table cost to cost to 0 7 node table cost to from from from 0 node table cost to 7 0 from 0 3 0 7 0 time D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 3 7 Network Laer 4-73 D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table cost to cost to cost to 0 7 0 3 0 3 0 0 7 0 3 0 node table cost to cost to cost to 0 7 0 3 0 0 0 7 0 3 0 from from node table cost to from 7 0 from from from cost to 0 7 0 3 0 from from from cost to 0 3 0 3 0 time D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 3 7 Network Laer 4-74 Distance Vector: link cost changes Distance Vector: link cost changes Link cost changes: node detects local link cost change updates routing info, recalculates distance vector if DV changes, notif neighbors good news travels fast 4 At time t 0, detects the link-cost change, updates its DV, and informs its neighbors. At time t, receives the update from and updates its table. It computes a new least cost to and sends its neighbors its DV. At time t, receives s update and updates its distance table. s least costs do not change and hence does not send an message to. 50 Network Laer 4-75 Link cost changes: good news travels fast bad news travels slow - count to infinit problem! 44 iterations before algorithm stabilies: 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 completel solve count to infinit problem? 60 4 50 Network Laer 4-76

Comparison of LS and DV algorithms Message compleit LS: with n nodes, E links, O(nE) msgs sent DV: echange between neighbors onl convergence time varies Speed of Convergence LS: O(n ) algorithm requires O(nE) msgs ma have oscillations DV: convergence time varies ma be routing loops count-to-infinit problem Robustness: what happens if router malfunctions? LS: node can advertise incorrect link cost each node computes onl its own table DV: DV node can advertise incorrect path cost each node s table used b others error propagate thru Hierarchical Routing Network Laer 4-77 Network Laer 4-78 Hierarchical Routing Hierarchical Routing Our routing stud thus far - idealiation 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 autonom internet = of s each admin ma want to control routing in its own aggregate routers into regions, autonomous sstems (AS) routers in same AS run same routing protocol intra-as routing protocol routers in different AS can run different intra- AS routing protocol gatewa 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 gatewa routers Network Laer 4-79 Network Laer 4-80

Intra-AS and Inter-AS routing Intra-AS and Inter-AS routing a C C.b b d A A.a a b inter-as, intra-as routing in gatewa A.c A.c c B.a a B c Gatewas: perform inter-as routing amongst themselves b perform intra-as routers with other routers in their AS laer link laer laer 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 shortl Network Laer 4-8 Network Laer 4-8 Interconnected ASes 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 b both intra- and inter-as routing algorithm intra-as sets entries for internal dests inter-as & intra-as sets entries for eternal dests Inter-AS tasks suppose router in AS receives datagram destined outside of AS: router should forward packet to gatewa router, but which one? 3c 3a 3b AS3 a c d b AS must:. learn which dests are reachable through AS, which through AS3. propagate this reachabilit info to all routers in AS Job of inter-as routing! AS a c b AS Network Laer 4-83 Network Laer 4-84

Eample: Setting forwarding table in router d suppose AS learns (via inter-as protocol) that subnet reachable via AS3 (gatewa c) but not via AS. inter-as protocol propagates reachabilit 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 entr (,I) 3c 3a 3b AS3 a c d b AS a c b AS Network Laer 4-85 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 gatewa 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 Network Laer 4-86 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 gatewa 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 gatewas Use routing info from intra-as protocol to determine costs of least-cost paths to each of the gatewas Hot potato routing: Choose the gatewa that has the smallest least cost Determine from forwarding table the interface I that leads to least-cost gatewa. Enter (,I) in forwarding table Routing in the Internet The Global Internet consists of Autonomous Sstems (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 man 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 Network Laer 4-87 Network Laer 4-88

Internet AS Hierarch Inter-AS border (eterior gatewa) routers Intra-AS Routing also known as Interior Gatewa Protocols (IGP) most common Intra-AS routing protocols: RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gatewa Routing Protocol (Cisco proprietar) Intra-AS interior (gatewa) routers Network Laer 4-89 Network Laer 4-90 RIP ( Routing Information Protocol) distance vector algorithm included in BSD-UNIX Distribution in 98 distance metric: # of hops (ma = 5 hops) u A C B D v w From router A to subnets: destination hops u v w 3 3 RIP advertisements distance vectors: echanged among neighbors ever 30 sec via Response Message (also called advertisement) each advertisement: list of up to 5 destination subnets within AS Network Laer 4-9 Network Laer 4-9

RIP: Eample w A D B C Destination Network Net Router Num. of hops to dest. w A B B 7 --..... Routing/Forwarding table in D Network Laer 4-93 RIP: Eample Dest Net hops w - - C 4.... Advertisement from A to D w A D B C Destination Network Net Router Num. of hops to dest. w A B B A 7 5 --..... Routing/Forwarding table in D Network Laer 4-94 RIP: Link Failure and Recover 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 quickl (?) propagates to entire net poison reverse used to prevent ping-pong loops (infinite distance = 6 hops) RIP Table processing RIP routing tables managed b application-level process called route-d (daemon) advertisements sent in UDP packets, periodicall repeated Transprt (UDP) link routed forwarding (IP) table forwarding table routed Transprt (UDP) (IP) link Network Laer 4-95 Network Laer 4-96

RIP message 0 7 8 5 6 3 Command (-6)Version () 0 Address famil () IP address 0 0 Metric 0 0 btes Up to 4 more routes with same 0 btes format Command: =request to send all or part of the routing table; =repl (3-6 obsolete or non documented) Address famil: =IP addresses metric: distance of emitting router from the specified IP address in number of hops (valid from to 5; 6=infinite) Network Laer 4-97 Message sie 8 UDP header 4 btes RIP header 0 btes up to 5 entries total: maimum of 5 btes UDP datagram 5 entries: too little to transfer an entire routing table more than UDP datagram generall needed Network Laer 4-98 Initialiation When routing daemon started, send special RIP request on ever interface command = (request) metric set to 6 (infinite) This asks for complete routing table from all connected routers allows to discover adjacent routers! OSPF (Open Shortest Path First) open : publicl available uses Link State algorithm LS packet dissemination topolog map at each node route computation using Dijkstra s algorithm OSPF advertisement carries one entr per neighbor router advertisements disseminated to entire AS (via flooding) carried in OSPF messages directl over IP (rather than TCP or UDP Network Laer 4-99 Network Laer 4-00

OSPF advanced features (not in RIP) Hierarchical OSPF securit: all OSPF messages authenticated (to prevent malicious intrusion) multiple same-cost paths allowed (onl 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 topolog data base as OSPF hierarchical OSPF in large domains. Network Laer 4-0 Network Laer 4-0 Hierarchical OSPF two-level hierarch: local area, backbone. Link-state advertisements onl in area each nodes has detailed area topolog; onl know direction (shortest path) to nets in other areas. area border routers: summarie distances to nets in own area, advertise to other Area Border routers. backbone routers: run OSPF routing limited to backbone. boundar routers: connect to other AS s. Internet inter-as routing: BGP BGP (Border Gatewa Protocol): the de facto standard BGP provides each AS a means to:. Obtain subnet reachabilit information from neighboring ASs.. Propagate reachabilit information to all ASinternal routers. 3. Determine good routes to subnets based on reachabilit information and polic. allows subnet to advertise its eistence to rest of Internet: I am here Network Laer 4-03 Network Laer 4-04

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 Distributing reachabilit info using ebgp session between 3a and c, AS3 sends prefi reachabilit info to AS. c can then use ibgp do distribute new prefi info to all routers in AS b can then re-advertise new reachabilit info to AS over b-to-a ebgp session when router learns of new prefi, it creates entr for prefi in its forwarding table. 3c 3a 3b AS3 a AS c d ebgp session ibgp session b a c b AS Network Laer 4-05 3c 3a 3b AS3 a AS c d ebgp session ibgp session b a c b AS Network Laer 4-06 Path attributes & BGP routes BGP route selection 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. (ma be multiple links from current AS to net-hop-as) when gatewa router receives route advertisement, uses import polic to accept/decline. router ma learn about more than route to some prefi. Router must select route. elimination rules:. local preference value attribute: polic decision. shortest AS-PATH 3. closest NEXT-HOP router: hot potato routing 4. additional criteria Network Laer 4-07 Network Laer 4-08

BGP messages 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 BGP routing polic W A A,B,C are provider s B C X Y legend: 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 provider customer : Network Laer 4-09 Network Laer 4-0 BGP routing polic () W A A advertises path AW to B B advertises path BAW to X B C X Y legend: Should B advertise path BAW to C? provider customer : No wa! 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 onl to/from its customers! Network Laer 4- Wh different Intra- and Inter-AS routing? Polic: Inter-AS: admin wants control over how its traffic routed, who routes through its net. Intra-AS: single admin, so no polic decisions needed Scale: hierarchical routing saves table sie, reduced update traffic Performance: Intra-AS: can focus on performance Inter-AS: polic ma dominate over performance Network Laer 4-