Download CMPT 880: Internet Architectures and Protocols

Document related concepts

Zigbee wikipedia , lookup

TCP congestion control wikipedia , lookup

AppleTalk wikipedia , lookup

Backpressure routing wikipedia , lookup

CAN bus wikipedia , lookup

Distributed firewall wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Peering wikipedia , lookup

Net bias wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Network tap wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Deep packet inspection wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Computer network wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Internet protocol suite wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Airborne Networking wikipedia , lookup

Packet switching wikipedia , lookup

UniPro protocol stack wikipedia , lookup

IEEE 1355 wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
School of Computing Science
Simon Fraser University
CMPT 771/471: Internet Architecture & Protocols
Network Layer
Instructor: Dr. Mohamed Hefeeda
1
Review of Basic Networking Concepts
 Internet structure
 Protocol layering and encapsulation
 Internet services and socket programming
 Network Layer
 Network types: Circuit switching, Packet switching
 Addressing, Forwarding, Routing
 Transport layer
 Reliability and congestion control
 TCP, UDP
 Link Layer
 Multiple Access Protocols
 Ethernet
2
The Network Core
 Mesh of interconnected
routers
 The fundamental question:
how is data transferred
through net?
 circuit switching:
dedicated circuit per
call: telephone net
 packet-switching: data
sent thru net in discrete
“chunks”
3
Network Core: Circuit Switching
 Network resources (e.g., bandwidth) divided into
“pieces” using
 Frequency division multiplexing (FDM)
 Time division multiplexing (TDM)
 Pieces allocated to “calls” (connections)
  guaranteed performance
 Resource piece idle if not used by owning call
 no sharing
 Connection setup is required
 Examples
 (Traditional) Telephone network
4
Circuit Switching: Dedicated Circuits
5
Network Core: Packet Switching
each end-end data stream
divided into packets
resource contention:
 packets from different users
share network resources
 aggregate resource
demand can exceed
amount available
 each packet uses full link
bandwidth
 congestion: packets
queue, wait for link use
 resources used as needed
 store and forward: packets
move one hop at a time
 Node receives complete
packet before forwarding
Bandwidth division into “pieces”
Dedicated allocation
Resource reservation
6
Packet Switching: Statistical Multiplexing
10 Mb/s
Ethernet
A
B
statistical multiplexing
C
1.5 Mb/s
queue of packets
waiting for output
link
D
E
Sequence of A & B packets does not have fixed pattern, shared on
demand  statistical multiplexing
In contrast, in TDM each host gets same slot in revolving TDM
frame
7
Packet Switching: Efficiency
Packet switching allows more users to use network!
 1 Mb/s link
 each user:
 100 kb/s when “active”
 active 10% of time
 circuit-switching:
 10 users
N users
1 Mbps link
 packet switching:
 with 35 users,
probability > 10 active
less than 0 .0004
Q: how did we get value 0.0004?
8
Packet Switching
 Advantages
 no call setup  simpler
 resource sharing (statistical multiplexing) 
• better resource utilization
• more users or faster transfer (a single user can use
entire bw)
• Well suited for bursty traffic (typical in data networks)
 Disadvantages
 Congestion may occur 
• packet delay and loss
• need protocols to control congestion and ensure
reliable data transfer
9
Packet Switching: Two Classes
 Datagram network
 Example: The Internet
 Virtual-circuit network
 Examples: ATM (Asynchronous Transfer Mode), frame
relay, X.25
10
Packet-switched Datagram Networks
 no call setup at network layer
 routers: no state about end-to-end connections
 no network-level concept of “connection”
 packets forwarded using destination host address
 packets between same source-dest pair may take different
paths
application
transport
network
data link 1. Send data
physical
application
transport
2. Receive data network
data link
physical
11
Packet-switched VC Networks
 Source-to-dest path behaves much like telephone circuit
  performance-wise
 connection setup, teardown for each call before data can
flow
 each packet carries VC identifier (not destination address)
 every router on source-dest path maintains state for each
passing connection
 link, router resources (bandwidth, buffers) may be allocated
to VC
 Examples:
 ATM (Asynchronous Transfer Mode), frame relay, X.25
12
VC Networks: Connection Setup
 Signaling protocols are used to
 setup, maintain, and teardown VCs
 Note: not widely used in the current Internet
application
transport 5. Data flow begins
network 4. Call connected
data link 1. Initiate call
physical
6. Receive data application
3. Accept call transport
2. incoming call network
data link
physical
13
Network Taxonomy
Telecommunication
networks
Circuit-switched
networks
FDM
TDM
Packet-switched
networks
Networks
with VCs
Datagram
Networks
14
Review of Basic Networking Concepts
 Internet structure
 Protocol layering and encapsulation
 Internet services and socket programming
 Network Layer
 Network types: Circuit switching, Packet switching
 Addressing, Forwarding, Routing
 Transport layer
 Reliability and congestion control
 TCP, UDP
 Link Layer
 Multiple Access Protocols
 Ethernet
15
Network Layer
 Network layer protocols in
every host and router
 Network layer’s goal
 transport data from
sending host to receiving
host
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
 We focus on datagram
networks (Internet)
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
16
Network Layer in the Internet
Host, router network layer functions:
Transport layer: TCP, UDP
Network
layer
IP protocol
•addressing conventions
•datagram format
•packet handling conventions
Routing protocols
•path selection
•RIP, OSPF, BGP
forwarding
table
ICMP protocol
•error reporting
•router “signaling”
Link layer
physical layer
17
Routing vs. Forwarding
 Routing
 determine route taken by
packets from source to
destination
 Routing algorithms, e.g.,
RIP, OSPF, BGP
 Forwarding
 move packets from
router’s input to
appropriate output
 use forwarding table
populated by routing
algorithm
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
 E.g., IP forwarding
function
18
IP Datagram Format
IP protocol version
number
header length
(bytes)
Provides some QoS
max number
remaining hops
(decremented at
each router)
upper layer protocol
to deliver payload to
32 bits
type of
ver head.
len service
length
fragment
16-bit identifier flgs
offset
upper
time to
Internet
layer
live
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)
IP ver 4.0
E.g. timestamp,
record route
taken, specify
list of routers
to visit.
19
IP Addressing: Introduction
 IP address:
 32-bit identifier for each host, router network interface
 Represented in Dotted-decimal notation
11011111 00000001 00000001 00000001
223
1
1
1
223.1.1.1
20
IP Addressing
 Network interface:




connection between host/router and physical link
routers typically have multiple interfaces
host typically has one interface
Unique IP addresses associated with each interface
223.1.1.1
223.1.2.1
How do we assign IPs?
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
Divide network into subnets,
each has a common ID
223.1.3.1
223.1.3.2
21
223.1.1.0/24
Subnets
223.1.2.0/24
 Subnet is:
 a group of devices that can
reach each other without
intervening router
 identified by high order bits of
IP addresses
11011111 00000001 00000001 00000001
223.1.3.0/24
Subnet ID
Host ID
223.1.1.0/24
/24: # bits in subnet portion of address, subnet mask
22
Subnets
 How many subnets?
223.1.1.2
223.1.1.1
223.1.1.4
223.1.1.3
 6 subnets
223.1.9.2
 Recipe:
 detach each interface
from its host or router,
creating isolated
networks
 Each isolated network
is a subnet
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.3.27
223.1.2.6
223.1.2.1
223.1.2.2
223.1.3.1
223.1.3.2
23
IP Addressing: CIDR
 CIDR: Classless InterDomain Routing
 subnet portion of address of arbitrary length
 address format: a.b.c.d/x, where x is # bits in subnet portion of
address
 Old Classful Addressing:
 Subnet length had to be /8 (class A), /16 (class B), /24 (class C)
 Why CIDR?
 Finer control over address allocation  reduce waste of
addresses
 Ex: company with 2000 machines would have to get class B,
wasting 63,000+ addresses
subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
24
IP Addresses: How to Get One?
Q: How does host get IP address?
 hard-coded by system admin in a file
 WIN: control-panel->network->configuration->tcp/ip>properties
 UNIX: /etc/rc.config
 DHCP: Dynamic Host Configuration Protocol: dynamically
get address from as server
 “plug-and-play”
25
IP Addresses: How to Get One?
Q: How does network get subnet part of IP addr?
A: gets allocated portion of its provider ISP’s address
space
ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
ISPs get their address space from ICANN
ICANN: Internet Corporation for Assigned Names and Numbers
allocates addresses, manages DNS and assigns domain names
26
Hierarchical Addressing: Route Aggregation
Hierarchical addressing allows efficient advertisement of routing
information:
Organization 0
200.23.16.0/23
Organization 1
200.23.18.0/23
Organization 2
200.23.20.0/23
Organization 7
.
.
.
.
.
.
Fly-By-Night-ISP
“Send me anything
with addresses
beginning
200.23.16.0/20”
Internet
200.23.30.0/23
ISPs-R-Us
“Send me anything
with addresses
beginning
199.31.0.0/16”
27
Review of Basic Networking Concepts
 Internet structure
 Protocol layering and encapsulation
 Internet services and socket programming
 Network Layer
 Network types: Circuit switching, Packet switching
 Addressing, Forwarding, Routing
 Transport layer
 Reliability and congestion control
 TCP, UDP
 Link Layer
 Multiple Access Protocols
 Ethernet
28
Graph Abstraction
5
 Graph: G = (N,E)
 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)}
 cost of link (x1, x2):




Metric value, e.g., c(w,z) = 5
could be 1 (typical), or
inversely related to bandwidth, or
inversely related to congestion
2
u
v
3
2
1
x
w
3
1
5
z
1
y
2
Routing algorithm: find the least-cost path
29
Classification of Routing Algorithms
Global or local information?
Global:
 all routers have complete topology, link cost info
 “link state” algorithms
Local:
 each router knows physically-connected neighbors, link
costs to neighbors
 “distance vector” algorithms
30
A Link-State Routing Algorithm
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
31
A Link-State Routing Algorithm
Notation:
 c(x,y): link cost from node x to y;
 c(x,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
32
Dijsktra’s Algorithm
1 Initialization:
2 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
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'
33
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
uxyvw
uxyvwz
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
D(x),p(x)
1,u
D(y),p(y)
∞
2,x
D(z),p(z)
∞
∞
4,y
4,y
4,y
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
2
34
Dijkstra’s algorithm: example (2)
Resulting shortest-path tree from u:
v
w
u
z
x
y
Resulting forwarding table in u:
destination
link
v
x
(u,v)
(u,x)
y
(u,x)
w
(u,x)
z
(u,x)
35
Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming)
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min {c(x,v) + dv(y) }
v
where min is taken over all neighbors v of x
36
Bellman-Ford example
Determine du(z)
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
u has 3 neighbors: v, x, w and
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
How would you use BF equation
to construct shortest paths?
37
Distance Vector Algorithm: Idea
Basic idea:
 Each node periodically sends its own distance vector
estimate to neighbors
 When a node x receives new DV estimate from neighbor, it
updates its own DV using B-F equation:
Dx(y) ← minv{c(x,v) + Dv(y)}
for each node y ∊ N
 Under minor, natural conditions, the estimate Dx(y) converge
to the actual least cost dx(y)
38
Distance Vector Algorithm: Notes
 Dx(y) = estimate of least cost from x to y
 Distance vector: Dx = [Dx(y): y є N ]
 Node x knows cost to each neighbor v: c(x,v)
 Node x maintains Dx = [Dx(y): y є N ]
 Node x also maintains its neighbors’ distance
vectors, that is:
 x maintains Dv = [Dv(y): y є N ] for every neighbor v
39
Distance Vector Algorithm
Each node:
wait for (change in local link
cost or msg from neighbor)
 Iterative
 Continues until no more info is
exchanged
 Each iteration caused by:
• local link cost change
• DV update message from neighbor
 Asynchronous
recompute estimates
if DV to any dest has
changed, notify neighbors
 Nodes do not operate in lockstep
 Distributed
 Each node receives info only from
its directly attached neighbors
 NO Global info
40
Dx(z) = min{c(x,y) + Dy(z),
c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
x 0 2 3
y 2 0 1
z 7 1 0
x y z
cost to
x y z
x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
x 0 2 7
y 2 0 1
z 7 1 0
from
from
node y tablecost to
node z tablecost to
cost to
x y z
x ∞∞ ∞
y ∞∞ ∞
z 71 0
x 0 2 7
y 2 0 1
z 3 1 0
from
from
x y z
from
x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
cost to
x y z
x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z
from
cost to
x y z
x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z
from
cost to
x y z
from
from
node x table
x
2
y
1
7
z
Example
x 0 2 3
y 2 0 1
z 3 1 0
time
41
Comparison of LS and DV algorithms
Message complexity
 LS: with n nodes, E links,
O(nE) msgs sent
 DV: exchange between
neighbors only
 But send entire table
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
Robustness: what happens if
router malfunctions?
LS: node can advertise incorrect
link cost
 each node computes only its
own table  some degree of
robustness
DV: node can advertise incorrect
path cost
 each node’s table used by
others error propagates
thru network
In The Internet:
LS: OSPF (recent, more features)
DV: RIP (old, small nets)
42
Hierarchical Routing
Our routing study thus far - idealization
 all routers identical
 network “flat” … not true in practice
scale: with 200 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
43
Hierarchical Routing
 aggregate routers into regions, “autonomous systems” (AS)
 routers in same AS run same routing protocol
 “intra-AS” routing protocol
 routers in different ASes can run different intra-AS routing
protocols
Gateway router
 Direct link to router in another AS, must use same inter-AS
routing protocol
44
Interconnected ASes
3c
3a
3b
AS3
1a
2a
1c
1d
1b
Intra-AS
Routing
protocol
2c
AS2
AS1
Inter-AS
Routing
protocol
Forwarding
table
2b
 Forwarding table is
configured by both intraand inter-AS routing
protocols
 Intra-AS sets entries for
internal destinations
 Inter-AS & Intra-As sets
entries for external
destinations
45
Inter-AS tasks
AS1 needs:
 Suppose router in AS1
receives datagram for
which dest is outside of
AS1
1. to learn which dests are
reachable through AS2
and which through AS3
 Router should forward
packet towards one of
the gateway routers, but
which one?
2. to propagate this
reachability info to all
routers in AS1
Job of inter-AS routing!
3c
3b
3a
AS3
1a
2a
1c
1d
1b
2c
AS2
2b
AS1
46
Example: Choosing among multiple ASes
 Now suppose AS1 learns from the 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
 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.
47
Internet inter-AS routing: BGP
 BGP (Border Gateway Protocol): the de facto
standard
 BGP provides each AS a means to:
1. Obtain subnet reachability information from neighboring
Ases (reachability = AS path)
2. Propagate the reachability information to all routers
internal to the AS
3. Determine “good” routes to subnets based on
reachability information and policy
 BGP allows a subnet to advertise its existence to
rest of the Internet: “I am here”
48
BGP basics
 Pairs of routers (BGP peers) exchange routing info over semipermanent TCP connections: BGP sessions
 Note: BGP sessions do not correspond to physical links
 When AS2 advertises a prefix to AS1, AS2 is promising it will
forward any datagrams destined to that prefix towards the
prefix
 AS2 can aggregate prefixes in its advertisement
3c
3a
3b
AS3
1a
AS1
2a
1c
1d
1b
2c
AS2
2b
eBGP session
iBGP session
49
Distributing reachability info
 With eBGP session between 3a and 1c, AS3 sends prefix reachability
info to AS1
 1c can then use iBGP to distribute this new prefix reachability info to
all routers in AS1
 1b can then re-advertise the new reachability info to AS2 over the
1b-to-2a eBGP session
 When router learns about a new prefix, it creates an entry for the
prefix in its forwarding table.
3c
3a
3b
AS3
1a
AS1
2a
1c
1d
1b
2c
AS2
2b
eBGP session
iBGP session
50
Path attributes & BGP routes
 When advertising a prefix, advert. includes BGP
attributes
 prefix + attributes = “route”
 Two important attributes:
 AS-PATH: contains ASes on the path to the prefix
 NEXT-HOP: Indicates the specific internal-AS router to
next-hop-AS. (There may be multiple links from
current AS to next-hop-AS.)
 When gateway router receives route advert., it
uses import policy to accept/decline
51
BGP messages
 BGP messages exchanged 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
52
BGP Route Selection
 Router may learn about more than 1 route to some
prefix. Router must select a route
 Elimination rules:
1. Local preference value: policy decision
(Routes are assigned values by AS administrator based on
import policy)
2. Shortest AS-PATH
3. Closest NEXT-HOP router: hot potato routing
4. Additional criteria
53
BGP Routing: Route Advertising
legend:
B
W
provider
network
X
A
customer
network:
C
Y
Figure 4.5-BGPnew: a simple BGP scenario
 A,B,C are provider networks
 X,W,Y are customer (of provider networks)
 X is dual-homed: attached to two provider networks
 X does not want to route traffic from B to C
 … so X will not advertise to B its route to C
 BGP export policy
54
BGP Routing: Route Advertising (cont’d)
legend:
B
W
provider
network
X
A
customer
network:
C
Y
Figure 4.5-BGPnew: a simple BGP scenario
 A advertises to B the path AW
 B advertises to X (its client) the path BAW
 Should B advertise to C the path BAW?
 No way! B gets no “revenue” for routing CBAW since neither W
nor C are B’s customers
 Rule of thumb: a provider wants to route only to/from its
customers! (unless there is a mutual peering deal)
55
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
56
Unicast, multicast, broadcast
 Unicast: one source, one destination
 E.g., web session
 Multicast: one source, multiple destinations
 Subset of all possible destinations
 E.g., streaming a hockey game to interested fans
 Broadcast: one source, all destinations
 E.g., broadcasting link state info to ALL routers in a domain
in OSPF protocol
 Anycast: multiple possible sources, one destination
 Sources have same (anycast) address
 Request is forwarded to appropriate source
 (Still in research phases)
57