* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download UNIT 3.ppt - E
Backpressure routing wikipedia , lookup
Distributed firewall wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Deep packet inspection wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Network tap wikipedia , lookup
Wake-on-LAN wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Computer network wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Internet protocol suite wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Airborne Networking wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
UniPro protocol stack wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
UNIT –III Network Layer Prof. Nalini Mhetre, Dept. of Computer Engg. SKNCOE, Pune Network Layer • • • • • • • • Introduction Basics of IPV4, ICMPV4, IPV6, ARP, RARP, Mobile IP, Link state routing algorithms, Distance vector routing algorithms Routing protocols: – RIP, OSPF, BGP Introduction Position of network layer Network layer • transport segment from sending to receiving host • on sending side encapsulates segments into datagrams • on receiving side, delivers segments to transport layer • network layer protocols in every host, router • router examines header fields in all IP datagrams passing through it application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical Network layer at the source Network layer at a router Network layer at the destination Network layer duties The challenge is interconnecting different networks (various LAN technologies, telephone network, satellite link, ATM networks etc.) and making them look the same to the transport layer. The transport layer should not be worried about the underlying physical network ! Network layer duties Unique addresses are required to define each host/machine/device/user in the network. We cannot use the data link layer addresses !! Because these addresses depend on the technology used in the data link layer. Remember, network layer is independent of the data link layer. Network layer duties This is a task common to all layers. The Protocol Data Units (PDU’s) coming from the transport layer must be placed in network-layer packets and sent to the datalink layer. Network layer duties Remember, the network layer must be able to operate on top of any data-link layer technology (Ethernet, Fast Ethernet, ATM etc.). All these technologies can handle a different packet length. The network layer must be able to fragment transport layer PDUs into smaller units so that they can be transferred over various data-link layer technologies. Network layer duties Now that you have your network layer packet, where do you send it ? Used in computer networks and (also in modern telephone networks). Packets of bits (not lines) are switched! Used in telephone networks for more than 100 years. A physical link is dedicated between Source and Destination. Data can be sent as a stream of bits without the need for packetising. (Also called Connection-oriented networking) (Also called Connectionless networking) Note: An IP address is a 32-bit address. Note: The IP addresses are unique and universal. Dotted-decimal notation Note: In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Finding the class in binary notation If the addresses are given in binary notation , first few bites can immediately tell us the class of the address. Finding the address class One can follow the procedure to systematically check the bits & find the class. Finding the class in decimal notation When the address is given in dotted-decimal notation , then we need to look only at the first byte (number) to determine the class of the address. Each class has a specific range of numbers. Example Find the class of each address: a. 227.12.14.87 b. 252.5.15.111 c. 134.11.78.56 Solution a. b. c. The first byte is 227 (between 224 and 239); the class is D. The first byte is 252 (between 240 and 255); the class is E. The first byte is 134 (between 128 and 191); the class is B. Unicast ,Multicast & Reserved Addresses • Addresses in classes A, B & C are for unicast communication, form one source to one destination. A host needs to have at least one unicast address to be send or receive packets. • Addresses in class D are for Multicast communication, form one source to group of destination. Multicast address can be used only as a destination address, but never as a source address. • Addresses in class E are reserved. The original idea was to use them for special purpose. They have been used only in few cases. Netid and hostid In classful addressing, an IP address in classes A,B & C is divided into netid and hostid . These parts are of varying lengths, depending on the class of the address . Classes D and E are not divided in to netid and hostid. Note: In classful addressing, the network address is the one that is assigned to the organization. Note: A network address is different from a netid. A network address has both netid and hostid, with 0s for the hostid. Sample internet Addresses in a network with and without subnetting Hierarchy concept in a telephone number Default masks Class In Binary A 11111111 00000000 00000000 00000000 B 11111111 11111111 00000000 00000000 C 11111111 111111111 11111111 00000000 In DottedDecimal Using Slash 255.0.0.0 /8 255.255.0.0 /16 255.255.255.0 /24 Note: The network address can be found by applying the default mask to any address in the block (including itself). It retains the netid of the block and sets the hostid to 0s. Subnet mask Basics of IPV4 The Internet network layer host, router network layer functions: transport layer: TCP, UDP IP protocol routing protocols network layer • addressing conventions • datagram format • packet handling conventions • path selection • RIP, OSPF, BGP forwarding table ICMP protocol • error reporting • router “signaling” link layer physical layer IP v4 datagram format 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 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead 32 bits ver head. type of len service 16-bit identifier upper time to layer live length flgs fragment offset header checksum total datagram length (bytes) for fragmentation/ reassembly 32 bit source IP address 32 bit destination IP address options (if any) data (variable length, typically a TCP or UDP segment) e.g. timestamp, record route taken, specify list of routers to visit. Basics of ICMPV4 ICMP: internet control message protocol • used by hosts & routers to communicate network-level information – error reporting: unreachable host, network, port, protocol – echo request/reply (used by ping) • network-layer “above” IP: – ICMP msgs carried in IP datagrams • ICMP message: type, code plus first 8 bytes of IP datagram causing error ICMP Message format Type 8-bits Code 8-bits Checksum 16-bits Unused IP HEADER AND ORIGINAL DATAGRAM Type: type of ICMP msg. Error reporting or query Code: parameter of msg type Checksum: checksum of entire ICMP msg Sample ‘Type and codes’ with their meaning Type Code description 0 3 3 3 3 3 3 4 0 0 1 2 3 6 7 0 8 9 10 11 12 0 0 0 0 0 echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header ICMP basics • IP provides unreliable & connectionless datagram delivery. • IP has two deficiencies : Lack of error control & Lack of assistance mechanisms. • It has no error reporting & error-correcting mechanisms. • The Internet Control Message Protocol (ICMP) has been designed to compensate for the above tow deficiencies. It is a companion to the IP. • ICMP itself is a network layer protocol. • Its messages are not passed directly to the data link layer . • Instead ,the messages are first encapsulated inside IP datagram before going to the lower layer. • The value of the protocol field in the IP is 1 to indicate that the IP data are an ICMP message. ICMP encapsulation • ICMP messages are divided in to two broad categories: 1)Error-reporting messages. 2) Query messages. Error-reporting messages. • One of the main responsibility of ICMP is to report error. • ICMP does not correct errors, it simply reports them. • Errors correction is left to the higher layer protocol. • Error reporting messages are always sent to the original source because the only information available in the datagram about the route is the source & destination IP addresses. • ICMP uses the source IP address to send the error message to the source of the datagram. • ICMP always reports error messages to the original source. Basics of IPV6 IPv6: motivation • initial motivation: 32-bit address space soon to be completely allocated. • additional motivation: – header format helps speed processing/forwarding – header changes to facilitate QoS IPv6 datagram format: – fixed-length 40 byte header – no fragmentation allowed IPv6 datagram format Priority/traffic class: identify priority among datagrams in flow flow Label: identify datagrams in same “flow.” (concept of “flow” not well defined). next header: identify upper layer protocol for data ver pri flow label hop limit payload len next hdr source address (128 bits) destination address (128 bits) data 32 bits • Ver: 4 bits for IP protocol version • Priority/traffic class: priority of packet wrt congestion • flow Label: 3 bytes for special handling at routers • Payload len:16 bits for total len incuding header • Next header: 8 bits to specify next imm header after ip header • Hop limit: like TTL • Source and destination addr: each of 128 bits Other changes from IPv4 • checksum: removed entirely to reduce processing time at each hop • options: allowed, but outside of header, indicated by “Next Header” field • ICMPv6: new version of ICMP – additional message types, e.g. “Packet Too Big” – multicast group management functions IP v6 addresses (128 bits) Dotted hexadecimal form is used in practice Abbreviated address Abbreviated address with consecutive zeros Comparison of network layers in version 4 and version 6 Tunneling Header translation ARP and RARP ARP operation ARP packet Note: An ARP request is broadcast; an ARP reply is unicast. Mobile IP Effect of Mobility on Protocol Stack • • • • • Application: new applications and adaptations Transport: congestion and flow control Network: addressing and routing Link: media access and handoff Physical: transmission errors and interference Routing and Mobility • Finding a path from a source to a destination • Issues – Frequent route changes – Route changes may be related to host movement – Low bandwidth links Routing and Mobility (contd) • Goal of routing protocols – decrease routing-related overhead – find short routes – find “stable” routes (despite mobility) Mobile IP (RFC 3344): Motivation • Traditional routing – based on IP address; network prefix determines the subnet – change of physical subnet implies • change of IP address (conform to new subnet), or • special routing table entries to forward packets to new subnet Quick Solution • Changing of IP address – Use DHCP to have a new IP address when mobile device moves to a new subnet • but then the new address may not be known to anyone – Take help of DNS to update the entry • DNS updates take long time – TCP connections break – security problems • Changing entries in routing tables – change routing table entries as the MN moves from one network to another • does not scale with the number of mobile hosts and frequent changes in the location • security problems Mobile IP requirements • Solution requirements – Compatibility • The new standard cannot introduce changes to applications and network protocols in use • Should be compatible with lower layers – use same layer 2 protocols – Transparency • New protocol should be transparent to higher layer – For TCP it means the MN should retain same IP address – Scalability • Enhancing IP for mobility should not generate too many messages • Should scale when there are a large number of MNs – Security • Management messages should be authenticated Mobile IP: Terminology • Mobile Node (MN) – node that moves across networks without changing its IP address • Correspondent Node (CN) – host with which MN is “corresponding” (TCP) • Home Agent (HA) – host in the home network of the MN, typically a router – registers the location of the MN, tunnels IP packets to the COA Terminology (contd.) • Foreign Agent (FA) – host in the current foreign network of the MN, typically a router – forwards tunneled packets to the MN, typically the default router for MN • Care-of Address (COA) – address of the current tunnel end-point for the MN (at FA or MN) – actual location of the MN from an IP point of view Mobility: Vocabulary home network: permanent “home” of mobile (e.g., 128.119.40/24) Permanent address: address in home network, can always be used to reach mobile home agent: entity that will perform mobility functions on behalf of mobile, when mobile is remote wide area network e.g., 128.119.40.186 Correspondent node: Source: Jim Kurose’s slides Mobility: more vocabulary Permanent address: remains constant (e.g., 128.119.40.186) visited network: network in which mobile currently resides (e.g., 79.129.13/24) Care-of-address: address in visited network. (e.g., 79,129.13.2) wide area network correspondent: wants to communicate with mobile Foreign agent: entity in visited network that performs mobility functions on behalf of mobile. Source: Jim Kurose’s slides Mobility: approaches • Let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table exchange. – routing tables indicate where each mobile located – no changes to end-systems • Let end-systems handle it: – indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote – direct routing: correspondent gets foreign address of mobile, sends directly to mobile Source: Jim Kurose’s slides Mobility: registration visited network home network 2 1 wide area network foreign agent contacts home agent home: “this mobile is resident in my network” mobile contacts foreign agent on entering visited network End result: • Foreign agent knows about mobile Source: Jim Kurose’s slides • Home agent knows location of mobile Mobility via Indirect Routing foreign agent receives packets, forwards to mobile home agent intercepts packets, forwards to foreign agent home network visited network 3 wide area network correspondent addresses packets using home address of mobile 1 2 4 mobile replies directly to correspondent Source: Jim Kurose’s slides Indirect Routing: comments • Mobile uses two addresses: – permanent address: used by correspondent (hence mobile location is transparent to correspondent) – care-of-address: used by home agent to forward datagrams to mobile • foreign agent functions may be done by mobile itself • triangle routing: correspondent-home-network-mobile – inefficient when correspondent, mobile are in same network Forwarding datagrams to remote mobile foreign-agent-to-mobile packet packet sent by home agent to foreign agent: a packet within a packet dest: 79.129.13.2 dest: 128.119.40.186 dest: 128.119.40.186 Permanent address: 128.119.40.186 dest: 128.119.40.186 packet sent by correspondent Care-of address: 79.129.13.2 Source: Jim Kurose’s slides Indirect Routing: moving between networks • suppose mobile user moves to another network – registers with new foreign agent – new foreign agent registers with home agent – home agent update care-of-address for mobile – packets continue to be forwarded to mobile (but with new care-of-address) • Mobility, changing foreign networks transparent: on going connections can be maintained! Source: Jim Kurose’s slides Mobility via Direct Routing correspondent forwards to foreign agent foreign agent receives packets, forwards to mobile home network 4 wide area network 2 correspondent requests, receives foreign address of mobile visited network 1 3 4 mobile replies directly to correspondent Source: Jim Kurose’s slides Mobility via Direct Routing: comments • overcome triangle routing problem • non-transparent to correspondent: correspondent must get care-of-address from home agent – What happens if mobile changes networks? Source: Jim Kurose’s slides Mobile IP • RFC 3344 • has many features we’ve seen: – home agents, foreign agents, foreign-agent registration, care-of-addresses, encapsulation (packet-within-a-packet) • three components to standard: – agent discovery – registration with home agent – indirect routing of datagrams Source: Jim Kurose’s slides Routing • Routing algorithms – Link state routing algorithms – Distance vector routing algorithms • Routing in the internet • RIP • OSPF • BGP Graph abstraction 5 2 u 2 1 Graph: G = (N,E) v x 3 w 3 1 5 z 1 y 2 N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections Graph abstraction: costs 5 2 u v 2 1 x What factors influence this cost ? 3 w 3 1 z 1 y Should costs be only on links ? 5 2 Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Question: What’s the least-cost path between u and z ? Routing algorithm: algorithm that finds least-cost path Routing Algorithm classification 2 main classes: Centralized • all routers have complete topology, link cost info • “link state” algorithms Distributed: • Each router knows link costs to neighbor routers only • “distance vector” algorithms Link state routing algorithms A Link-State Routing Algorithm Dijkstra’s algorithm • Link costs known to all nodes • 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 Dijkstra’s Algorithm Notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest. v 1 Initialization: 2 N' = {u} 3 for all nodes v 5 4 if v adjacent to u 5 then D(v) = c(u,v) v 2 6 else D(v) = ∞ u 7 2 8 Loop 1 x 9 find w not in N' s.t. D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N' 3 w 3 1 5 z 1 y 2 Dijkstra’s algorithm: example Resulting shortest-path tree from u: v w u z x Resulting forwarding table in u: destination link v x (u,v) (u,x) y (u,x) w (u,x) z (u,x) y Distance vector routing algorithms Distributed: Distance Vector To find D, node S asks each neighbor X How far X is from D X asks its neighbors … comes back and says C(X,D) Node S deduces C(S,D) = C(S,X) + C(X,D) S chooses neighbor Xi that provides min C(S,D) Later, Xj may find better route to D Xj advertizes C(Xj,D) All nodes update their cost to D if new min found Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y v1 Then x v2 dx(y) = min {c(x,v) + dv(y) } v where min is taken over all neighbors v of x y Bellman-Ford example 5 2 u v 2 1 x 3 w 3 1 5 z 1 y Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 2 B-F equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table Distance Vector: link cost changes Link cost changes: if DV changes, notify neighbors 1 x 4 y 50 1 z At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t2, 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. Comparison of LS and DV algorithms message complexity robustness: what happens if router malfunctions? • LS: with n nodes, E links, O(nE) msgs sent LS: • DV: exchange between neighbors only – node can advertise incorrect link cost – each node computes only its own table – convergence time varies speed of convergence • LS: O(n2) algorithm requires O(nE) msgs – may have oscillations • DV: convergence time varies – may be routing loops – count-to-infinity problem DV: – DV node can advertise incorrect path cost – each node’s table used by others • error propagate thru network Analogy: Routing in Internet Similar to international FedEx routing FedEx figures out best route within country • Uses google maps say • This is link state -- All info available USA FedEx does not have international map, also no permission to operate outside USA Gets price quote from Germany FedEx, Japan FedEx etc. to route to India Chooses minimum price and handles package to say Germany (Distance Vector) Germany has country map (link state) Germany asks for cost from Egypt, South Africa … Internet Routing • Think of each country FedEx as ISPs – Routing on internet very similar to prior example • The link state and DV routing protocols used in internet routing – RIP (routing information protocol) – OSPF (Open shortest path first) – BGP (Border gateway protocol) • They utilize the concepts of – Link state – Distance vector routing Routing protocols • RIP • OSPF • BGP Hierarchical routing our routing study thus far - idealization all routers identical network “flat” … not true in practice scale: with 600 million destinations: • can’t store all dest’s in routing tables! • routing table exchange would swamp links! administrative autonomy • internet = network of networks • each network admin may want to control routing in its own network Hierarchical 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 router: • at “edge” of its own AS • has link to router in another AS Interconnected ASes 3c 3a 3b AS3 2a 1c 1a 1d 2c 2b AS2 1b AS1 Intra-AS Routing algorithm Inter-AS Routing algorithm Forwarding table forwarding table configured by both intraand inter-AS routing algorithm • intra-AS sets entries for internal dests • inter-AS & intra-AS sets entries for external dests Inter-AS tasks • suppose router in AS1 receives datagram destined outside of AS1: – router should forward packet to gateway router, but which one? AS1 must: 1. learn which dests are reachable through AS2, which through AS3 2. propagate this reachability info to all routers in AS1 job of inter-AS routing! 3c 3b other networks 3a AS3 2c 1c 1a AS1 1d 2a 1b 2b AS2 other networks Example: setting forwarding table in router 1d • suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c), but not via AS2 – inter-AS protocol propagates reachability info to all internal routers • router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c – installs forwarding table entry (x,I) x 3c 3b other networks 3a AS3 2c 1c 1a AS1 1d 2a 1b 2b AS2 other networks Example: choosing among multiple ASes • now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. • to configure forwarding table, router 1d must determine which gateway it should forward packets towards for dest x – this is also job of inter-AS routing protocol! x 3c 3b other networks 3a AS3 2c 1c 1a AS1 1d ? 2a 1b 2b AS2 other networks Example: choosing among multiple ASes • now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. • to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x – 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 x 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 (x,I) in forwarding table Intra-AS Routing • 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) RIP ( Routing Information Protocol) • included in BSD-UNIX distribution in 1982 • distance vector algorithm – distance metric: # hops (max = 15 hops), each link has cost 1 – DVs exchanged with neighbors every 30 sec in response message (aka advertisement) – each advertisement: list of up to 25 destination subnets (in IP addressing sense) u v A z C B w x D y from router A to destination subnets: subnet hops u 1 v 2 w 2 x 3 y 3 z 2 RIP: example z w A x y B D C routing table in router D destination subnet next router # hops to dest w y z x A B B -- 2 2 7 1 …. …. .... RIP: example dest w x z …. w A A-to-D advertisement next hops 1 1 C 4 … ... x z y B D C routing table in router D destination subnet next router # hops to dest w y z x A B A B -- 2 2 5 7 1 …. …. .... RIP: link failure, recovery if no advertisement heard after 180 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 = 16 hops) RIP table processing • RIP routing tables managed by application-level process called route-d (daemon) • advertisements sent in UDP packets, periodically repeated routed routed transport (UDP) network (IP) link physical transprt (UDP) forwarding table forwarding table network (IP) link physical 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 • advertisements flooded to entire AS – carried in OSPF messages directly over IP (rather than TCP or UDP • IS-IS routing protocol: nearly identical to OSPF 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 ToS; high for real time ToS) • integrated uni- and multicast support: – Multicast OSPF (MOSPF) uses same topology data base as OSPF • hierarchical OSPF in large domains. Hierarchical OSPF boundary router backbone router backbone area border routers area 3 internal routers area 1 area 2 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. Internet inter-AS routing: BGP • BGP (Border Gateway Protocol): the de facto inter-domain routing protocol – “glue that holds the Internet together” • BGP provides each AS a means to: – eBGP: obtain subnet reachability information from neighboring ASs. – iBGP: propagate reachability information to all ASinternal routers. – determine “good” routes to other networks based on reachability information and policy. • allows subnet to advertise its existence to rest of Internet: “I am here” BGP basics BGP session: two BGP routers (“peers”) exchange BGP messages: advertising paths to different destination network prefixes (“path vector” protocol) exchanged over semi-permanent TCP connections • when AS3 advertises a prefix to AS1: – AS3 promises it will forward datagrams towards that prefix – AS3 can aggregate prefixes in its advertisement 3c 3b other networks 3a BGP message AS3 2c 1c 1a AS1 1d 2a 1b 2b AS2 other networks BGP basics: distributing path information • Using eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1. – 1c can then use iBGP do distribute new prefix info to all routers in AS1 – 1b can then re-advertise new reachability info to AS2 over 1b-to-2a eBGP session • When router learns of new prefix, it creates entry for prefix in its forwarding table. eBGP session 3b other networks 3a AS3 iBGP session 2c 1c 1a AS1 1d 2a 1b 2b AS2 other networks Path attributes and BGP routes • advertised prefix includes BGP attributes – prefix + attributes = “route” • two important attributes: – AS-PATH: contains ASs through which prefix advertisement has passed: e.g., AS 67, AS 17 – NEXT-HOP: indicates specific internal-AS router to nexthop AS. (may be multiple links from current AS to nexthop-AS) • gateway router receiving route advertisement uses import policy to accept/decline – e.g., never route through AS x – policy-based routing BGP route selection • Router may learn about more than 1 route to destination AS, selects route based on: 1. Local preference value attribute: policy decision 2. Shortest AS-PATH 3. Closest NEXT-HOP router: hot potato routing 4. Additional criteria BGP messages • BGP messages exchanged between peers over TCP connection • 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 policy legend: B W X A customer network: C Y provider network A,B,C are provider networks X,W,Y are customer (of provider networks) X is dual-homed: attached to two networks X does not want to route from B via X to C .. so X will not advertise to B a route to C BGP routing policy (2) legend: B W provider network X A customer network: C Y A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C? 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! Why different Intra-, 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