0% found this document useful (0 votes)
12 views28 pages

IP Addressing

This is IP addressing

Uploaded by

Burhan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views28 pages

IP Addressing

This is IP addressing

Uploaded by

Burhan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

IP addressing: the last word...

Q: How does an ISP get block of addresses?


A: ICANN: Internet Corporation for Assigned
Names and Numbers
– allocates addresses
– manages DNS
– assigns domain names, resolves disputes

Network Layer 4-1


NAT: Network Address Translation

rest of local network


Internet (e.g., home network)
10.0.0/24 10.0.0.1

10.0.0.4
10.0.0.2
138.76.29.7

10.0.0.3

All datagrams leaving local Datagrams with source or


network have same single source NAT IP destination in this network
address: 138.76.29.7, have 10.0.0/24 address for
different source port numbers source, destination (as usual)

Network Layer 4-2


NAT: Network Address Translation

• Motivation: local network uses just one IP address as far as


outside world is concerned:
– no need to be allocated range of addresses from ISP:
- just one IP address is used for all devices
– can change addresses of devices in local network
without notifying outside world
– can change ISP without changing addresses of
devices in local network
– devices inside local net not explicitly addressable,
visible by outside world (a security plus).
Network Layer 4-3
NAT: Network Address Translation
Implementation: NAT router must:

– outgoing datagrams: replace (source IP address, port #) of


every outgoing datagram to (NAT IP address, new port #)
. . . remote clients/servers will respond using (NAT IP address, new
port #) as destination addr.

– remember (in NAT translation table) every (source IP


address, port #) to (NAT IP address, new port #)
translation pair

– incoming datagrams: replace (NAT IP address, new port #)


in dest fields of every incoming datagram with
corresponding (source IP address, port #) stored in NAT
table
Network Layer 4-4
NAT: Network Address Translation
NAT translation table
2: NAT router 1: host 10.0.0.1
WAN side addr LAN side addr
changes datagram sends datagram to
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.186, 80
source addr from
…… ……
10.0.0.1, 3345 to
138.76.29.7, 5001, S: 10.0.0.1, 3345
updates table D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345 4
S: 128.119.40.186, 80
D: 138.76.29.7, 5001 3 10.0.0.3
4: NAT router
3: Reply arrives changes datagram
dest. address: dest addr from
138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345

Network Layer 4-5


NAT: Network Address Translation

• 16-bit port-number field:


– 60,000 simultaneous connections with a single
LAN-side address!
• NAT is controversial:
– routers should only process up to layer 3
– violates end-to-end argument
• NAT possibility must be taken into account by app
designers, eg, P2P applications
– address shortage should instead be solved by IPv6

Network Layer 4-6


Routing Algorithm
Purpose: to find a good path form source router to
destination router, given a set of routers with links
connecting the routers

Here source router is the default router of the source


host while destination router is the default router
of the destination host

Network Layer 4-1


Graph abstraction
5
3
v w 5
2
u 2 1 z
3
1 2
Graph: G = (N,E)
x 1
y

N = set of routers (nodes) = { u, v, w, x, y, z }

E = set of links (edges) ={ (u,v), (u,x), (u,w), (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

Network Layer 4-8


Graph abstraction: costs
5 • c(x,x’) = cost of link (x,x’)
3
v w 5
2 - e.g., c(w,z) = 5
u 2 1 z
3 • cost could always be 1, or
1 2 inversely related to bandwidth,
x 1
y
or inversely related to
congestion

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

Network Layer 4-9


A Link-State (LS) Routing Algorithm

Notation:algorithm
Dijkstra’s
•• net topology,
c(x,y): link from
link cost costsnode
known toy;all=nodes
x to ∞ if not direct neighbors
– accomplished via “link state broadcast”
• D(v): current value of cost of path from source to dest. v
– all nodes have same info
• p(v): predecessor node along path from source to v
• computes least cost paths from one node (‘source”) to all other nodes
• N': set offorwarding
– gives nodes whose least
table forcost
thatpath
nodedefinitively known
• iterative: after k iterations, know least cost path to k dest.’s

Network Layer 4-10


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'

Network Layer 4-11


Dijkstra’s algorithm: example
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz

5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y

Network Layer 4-12


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 (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Network Layer 4-13
Network layer connection and connection-
less service
• Datagram network provides network-layer
connectionless service
• VC network provides network-layer
connection service
• Analogous to the transport-layer services, but:
– Service: host-to-host
– No choice: network provides one or the other

Network Layer 4-14


Virtual circuits
“source-to-dest path behaves much like telephone circuit”
– performance-wise
– network actions along source-to-dest path

• call setup, teardown for each call before data can flow
• each packet carries VC identifier (not destination host address)
• every router on source-dest path maintains “state” for each passing
connection
• link, router resources (bandwidth, buffers) may be allocated to VC

Network Layer 4-15


VC implementation
A VC consists of:
1. Path from source to destination
2. VC numbers, one number for each link along
path
3. Entries in forwarding tables in routers along path
• Packet belonging to VC carries a VC number.
• VC number must be changed on each link.
– New VC number comes from forwarding table

Network Layer 4-16


ForwardingVCtable
number

12 22 32

1 3
2

Forwarding table in interface


number
northwest router:
Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …

Routers maintain connection state information!


Network Layer 4-17
Virtual circuits: signaling protocols

• used to setup, maintain teardown VC


• not used in today’s Internet

application
5. Data flow begins 6. Receive data application
transport
transport
network 4. Call connected 3. Accept call
1. Initiate call 2. incoming call network
data link
data link
physical
physical

Network Layer 4-18


In virtual-circuit switching, all packets
belonging to the same source and
destination travel the same path;
but the packets may arrive at the
destination with different delays
if resource allocation is on demand.

Network Layer 4-19


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
application
transport
transport
network
1. Send data 2. Receive data network
data link
data link
physical
physical

Network Layer 4-20


Key Network-Layer Functions
• forwarding: move analogy:
packets from router’s  routing: process of
input to appropriate planning trip from source
router output to dest
• routing: determine  forwarding: process of
route taken by packets getting through single
from source to dest. interchange

– Routing algorithms

Network Layer 4-21


Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming)
Define
dx(y) := cost of least-cost path from x to y

Then

dx(y) = minv {c(x,v) + dv(y) }

where min is taken over all neighbors v of x


Network Layer 4-22
Bellman-Ford example
5
3
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
x 1
y
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
Network Layer 4-23
Distance Vector Algorithm
• 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
– For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
Network Layer 4-24
Distance vector algorithm (4)
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

Network Layer 4-25


Distance Vector Algorithm (5)
Iterative, asynchronous: each Each node:
local iteration caused by:
• local link cost change
• DV update message from wait for (change in local link
neighbor cost of msg from neighbor)

Distributed:
• each node notifies neighbors recompute estimates
only when its DV changes
– neighbors then notify their
neighbors if necessary if DV to any dest has
changed, notify neighbors

Network Layer 4-26


Distance Vector (DV) Algorithm
At each node x:
1 Initialization:
2 for all destinations y in N:
3 Dx (y) = c(x,y) // if y is not a neighbor than c(x,y) = ∞
4 for each neighbor w
5 Dw (y) = ∞ for all destinations y in N
6 for each neighbor w
7 send distance vector Dx = [Dx(y): y in N] to w
8 Loop
9 wait (until I see a link cost change to some neighbor w or
10 until I receive a distance vector from some neighbor w
11 for each y in N:
12 Dx(y) = minv{ c(x,v) + Dv(y) }
13 if Dx(y) changed for any destination y
14 send distance vector Dx = [Dx(y): y in N] to all neighbors
15 forever Network Layer 4-27
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
node x table = min{2+1 , 7+0} = 3
cost to cost to cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from

from

from
y ∞∞ ∞ y 2 0 1 y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node y table
cost to cost to cost to
x y z x y z x y z y
2 1
x ∞∞ ∞ x 0 2 7 x 0 2 3 x z
from
from

from
y 2 0 1 y 2 0 1 y 7
2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node z table
cost to cost to cost to
x y z x y z x y z

x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from
from

y ∞∞ ∞ y 2 0 1 y 2 0 1
z 7 1 0 z 3 1 0 z 3 1 0
time
Network Layer 4-28

You might also like