Chapter 4
Network Layer
Computer Networking: A
Top Down Approach
4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2007.
Hierarchical Routing
 All routers run the same routing

Algorithm?
… not true in practice

Scale: With millions of
destinations:
 Can’t store all destinations

in routing tables
 Exchange of Routing
updates would swamp links!

Administrative Autonomy
 Internet = network of

networks
 Each network administrator
may want to control routing
in its own network
Hierarchical Routing
Gateway Routers
 One or more of the
into “Autonomous
routers in an AS will
Systems” (ASs).
have the added task of
 Routers in same
administrative domain
forwarding packets to
destinations outside
 Routers in same AS run
the AS.
same routing protocol
 Routers are organized





The routing algorithm
within an autonomous
system is called an
“intra-AS” routing
protocol
Routers in different AS
can run different intraAS routing protocol

1c
1a
1d

1b

AS1
Interconnected ASs

3c
3b

3a

2a

AS3

1c
1a
1d

2c
2b
AS2

1b

AS1

1b, 1c, 2a and 3a are Gateway Routers
Inter-AS tasks

AS1 must:
1. Learn which destinations are
reachable through AS2, which
through AS3
2. Propagate this reachability
information to all routers in
AS1.

Configure Forwarding table
Job of inter-AS routing protocol!

 Suppose router in AS1

receives datagram destined
outside of AS1:
 Router should forward
packet to gateway
router, but which one?

3c
3a
3b AS3

1a

2a

1c
1d

1b

Intra-AS
Routing
algorithm

AS1
Inter-AS
Routing
algorithm

Forwarding
table

2c
AS2

2b
Example: Setting forwarding table in router 1d
 Suppose AS1 learns (via inter-AS protocol) that

network 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

3a
3b
AS3
1a

2a

1c
1d

1b AS1

2c

2b
AS2
Example: Choosing among multiple ASs
 Now suppose AS1 learns from inter-AS protocol

that a network 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.
 Hot Potato Routing: Send packet towards closest of
two routers.
x

3c

3a
3b
AS3
1a

2a

1c
1d

1b

2c
AS2

AS1

2b
Example: Choosing among multiple ASs

Learn from inter-AS
protocol that network
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 the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table

Steps in adding an outside AS destination in a routers forwarding Table
Routing Protocols
Path Vector Routing
Path Vector Routing
Loop Prevention
If a router receives a message, checks
to see if its autonomous system is in the
path list to the destination.
If it is, looping is involved and the

message is ignored.
Policy Routing
If one of the path in the path vector is
against the policy it can ignore that
path and does not update its routing
table.
Inter-AS Routing in Internet: BGP
 BGP (Border Gateway Protocol)
 BGP provides each AS a means to:
1. Obtain subnet reachability information from
neighboring ASs.
2. Propagate reachability information to all ASinternal routers.
3. Determine “good” routes to subnets based on
reachability information and policy.

 Allows subnet to advertise its existence to

rest of Internet: “I am here”
BGP Basics
 Pairs of routers (BGP peers) exchange routing info over TCP

connections using port 179.
 For each TCP connection, the two routers at the end of the
connection are called BGP Peers
 The TCP connection along with all the BGP messages sent over
the connection is called a BGP Session
 Internal (IBGP) neighbours
 A pair of BGP speakers within the same AS



External (EBGP) neighbours

 Two BGP speakers from two different AS

eBGP session

3c
3a
3b
AS3
1a
AS1

iBGP session

2a

1c

1d

1b

2c
AS2

2b
BGP Basics
 BGP allows each AS to learn which destinations

are reachable via its neighboring ASs.
 Destinations are not hosts but instead are
CIDRized prefixes.


E.g. AS1 has four subnets attached to it
It will aggregate the prefixes of these four and will
advertise the single prefix

 AS1 and AS2 send reachability information

trough their gateway routers 1b and 2a.
 When a gateway router receives e-BGP learned
prefixes, the gateway router uses iBGP sessions
to distribute the prefixes to other routers in
the AS.
Distributing Reachability info
 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

3c
3a
3b
AS3
1a
AS1

iBGP session

2a

1c

1d

1b

2c
AS2

2b
Path Attributes & BGP Routes
 In BGP an AS is recognized by its

globally unique Autonomous System
Number (ASN).
 Assigned by ICANN Regional
Registries.
 Advertised prefix includes BGP
attributes.
 prefix + attributes = “route”
 Two important attributes:
 AS-PATH and NEXT-HOP
Path Attributes & BGP Routes
 AS-PATH

 Contains

ASs through which prefix
advertisement has passed.
 When a prefix is passed into an AS, the As
adds its ASN to the AS-PATH attribute.
E.g suppose that the prefix
138.16.64.0/24 is first advertised from
AS2 to AS1.
If AS1 then advertises the prefix to
AS3, AS-PATH would be AS2 AS1.
 Detect and prevent looping advertisements
Routing Loop Prevention
AS2

[ Net1, (AS3,AS4) ]

[ Net1,
(AS2,AS3,AS4)]

AS3

AS1

[Net1, (AS4)]
AS4
Net1

[ Net1,
(AS1,AS2,AS3,AS4)]
AS3 won’t forward this further

Week14 lec1

  • 1.
    Chapter 4 Network Layer ComputerNetworking: A Top Down Approach 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
  • 2.
    Hierarchical Routing  Allrouters run the same routing Algorithm? … not true in practice Scale: With millions of destinations:  Can’t store all destinations in routing tables  Exchange of Routing updates would swamp links! Administrative Autonomy  Internet = network of networks  Each network administrator may want to control routing in its own network
  • 3.
    Hierarchical Routing Gateway Routers One or more of the into “Autonomous routers in an AS will Systems” (ASs). have the added task of  Routers in same administrative domain forwarding packets to destinations outside  Routers in same AS run the AS. same routing protocol  Routers are organized   The routing algorithm within an autonomous system is called an “intra-AS” routing protocol Routers in different AS can run different intraAS routing protocol 1c 1a 1d 1b AS1
  • 4.
  • 5.
    Inter-AS tasks AS1 must: 1.Learn which destinations are reachable through AS2, which through AS3 2. Propagate this reachability information to all routers in AS1.  Configure Forwarding table Job of inter-AS routing protocol!  Suppose router in AS1 receives datagram destined outside of AS1:  Router should forward packet to gateway router, but which one? 3c 3a 3b AS3 1a 2a 1c 1d 1b Intra-AS Routing algorithm AS1 Inter-AS Routing algorithm Forwarding table 2c AS2 2b
  • 6.
    Example: Setting forwardingtable in router 1d  Suppose AS1 learns (via inter-AS protocol) that network 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 3a 3b AS3 1a 2a 1c 1d 1b AS1 2c 2b AS2
  • 7.
    Example: Choosing amongmultiple ASs  Now suppose AS1 learns from inter-AS protocol that a network 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.  Hot Potato Routing: Send packet towards closest of two routers. x 3c 3a 3b AS3 1a 2a 1c 1d 1b 2c AS2 AS1 2b
  • 8.
    Example: Choosing amongmultiple ASs Learn from inter-AS protocol that network 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 the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table Steps in adding an outside AS destination in a routers forwarding Table
  • 9.
  • 10.
  • 11.
    Path Vector Routing LoopPrevention If a router receives a message, checks to see if its autonomous system is in the path list to the destination. If it is, looping is involved and the message is ignored. Policy Routing If one of the path in the path vector is against the policy it can ignore that path and does not update its routing table.
  • 12.
    Inter-AS Routing inInternet: BGP  BGP (Border Gateway Protocol)  BGP provides each AS a means to: 1. Obtain subnet reachability information from neighboring ASs. 2. Propagate reachability information to all ASinternal routers. 3. Determine “good” routes to subnets based on reachability information and policy.  Allows subnet to advertise its existence to rest of Internet: “I am here”
  • 13.
    BGP Basics  Pairsof routers (BGP peers) exchange routing info over TCP connections using port 179.  For each TCP connection, the two routers at the end of the connection are called BGP Peers  The TCP connection along with all the BGP messages sent over the connection is called a BGP Session  Internal (IBGP) neighbours  A pair of BGP speakers within the same AS  External (EBGP) neighbours  Two BGP speakers from two different AS eBGP session 3c 3a 3b AS3 1a AS1 iBGP session 2a 1c 1d 1b 2c AS2 2b
  • 14.
    BGP Basics  BGPallows each AS to learn which destinations are reachable via its neighboring ASs.  Destinations are not hosts but instead are CIDRized prefixes.  E.g. AS1 has four subnets attached to it It will aggregate the prefixes of these four and will advertise the single prefix  AS1 and AS2 send reachability information trough their gateway routers 1b and 2a.  When a gateway router receives e-BGP learned prefixes, the gateway router uses iBGP sessions to distribute the prefixes to other routers in the AS.
  • 15.
    Distributing Reachability info 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 3c 3a 3b AS3 1a AS1 iBGP session 2a 1c 1d 1b 2c AS2 2b
  • 16.
    Path Attributes &BGP Routes  In BGP an AS is recognized by its globally unique Autonomous System Number (ASN).  Assigned by ICANN Regional Registries.  Advertised prefix includes BGP attributes.  prefix + attributes = “route”  Two important attributes:  AS-PATH and NEXT-HOP
  • 17.
    Path Attributes &BGP Routes  AS-PATH  Contains ASs through which prefix advertisement has passed.  When a prefix is passed into an AS, the As adds its ASN to the AS-PATH attribute. E.g suppose that the prefix 138.16.64.0/24 is first advertised from AS2 to AS1. If AS1 then advertises the prefix to AS3, AS-PATH would be AS2 AS1.  Detect and prevent looping advertisements
  • 18.
    Routing Loop Prevention AS2 [Net1, (AS3,AS4) ] [ Net1, (AS2,AS3,AS4)] AS3 AS1 [Net1, (AS4)] AS4 Net1 [ Net1, (AS1,AS2,AS3,AS4)] AS3 won’t forward this further