0% found this document useful (0 votes)
60 views

Chapter 4.3

The document discusses key concepts in computer networking including virtual circuit and datagram networks, IP protocols, routing algorithms, and routing in the Internet. Specifically, it covers IP addressing and protocols, routing algorithms like link state and distance vector, and common routing protocols such as RIP, OSPF, and BGP. It also compares virtual circuit networks which establish connections before sending data and maintain state at routers, to datagram networks like the Internet which send packets without connection setup using only destination addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Chapter 4.3

The document discusses key concepts in computer networking including virtual circuit and datagram networks, IP protocols, routing algorithms, and routing in the Internet. Specifically, it covers IP addressing and protocols, routing algorithms like link state and distance vector, and common routing protocols such as RIP, OSPF, and BGP. It also compares virtual circuit networks which establish connections before sending data and maintain state at routers, to datagram networks like the Internet which send packets without connection setup using only destination addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 62

Network

Layer
Outline
1. Virtual circuit and Datagram networks
2. IP: Internet Protocol
 datagram format
 IPv4 addressing
 ICMP
 IPv6
3. routing algorithms
 link state
 distance vector
4. routing in the Internet
 RIP
 OSPF
 BGP
5. broadcast and multicast routing

Network Layer 4-2


Network layer
application
 transport segment from transport
network

sending to receiving host data link


physical
network network
 on sending side network
data link
data link
physical
data link
physical

encapsulates segments into physical network


data link
network
data link

datagrams physical physical

 on receiving side, delivers network


data link
network
data link

segments to transport layer physical


network
data link
physical

physical
 network layer protocols in network
application
transport
every host, router network
data link
physical
network
data link
network
data link
physical
router examines header
data link physical
 physical

fields in all IP datagrams


passing through it

Network Layer 4-3


DELIVERY
The network layer supervises the handling of the
packets by the underlying physical networks. We
define this handling as the delivery of a packet.

Network Layer 4-4


Direct and indirect delivery

Network Layer 4-5


Two key network-layer functions
 forwarding: move analogy:
packets from router’s
input to appropriate  routing: process of
router output planning trip from source
to dest
 routing: determine route
taken by packets from  forwarding: process of
source to dest. getting through single
interchange
 routing algorithms

Network Layer 4-6


Interplay between routing and forwarding

routing algorithm routing algorithm determines


end-end-path through network

local forwarding table forwarding table determines


header value output link local forwarding at this router
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

Network Layer 4-7


Connection setup
 3rd important function in some network architectures:
 ATM, frame relay, X.25
 before datagrams flow, two end hosts and intervening
routers establish virtual connection
 routers get involved
 network vs transport layer connection service:
 network: between two hosts (may also involve intervening
routers in case of VCs)
 transport: between two processes

Network Layer 4-8


Connection, connection-less service
 datagram network provides network-layer
connectionless service
 virtual-circuit network provides network-layer
connection service
 analogous to TCP/UDP connecton-oriented /
connectionless transport-layer services, but:
 service: host-to-host
 no choice: network provides one or the other
 implementation: in network core

Network Layer 4-9


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 (dedicated resources = predictable service)

Network Layer 4-10


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 VC number
(rather than dest address)
 VC number can be changed on each link.
 new VC number comes from forwarding table

Network Layer 4-11


VC forwarding table
12 22 32

1 3
2
VC number
interface
forwarding table in 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
… … … …

VC routers maintain connection state information!


Network Layer 4-12
Virtual circuits: signaling protocols
 used to setup, maintain teardown VC
 used in ATM, frame-relay, X.25
 not used in today’s Internet

application application
5. data flow begins 6. receive data
transport transport
network 4. call connected 3. accept call
1. initiate call network
data link 2. incoming call
data link
physical physical

Network Layer 4-13


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

application application
transport transport
network 1. send datagrams 2. receive datagrams network
data link data link
physical physical

Network Layer 4-14


Datagram forwarding table
4 billion IP addresses, so
routing algorithm rather than list individual
destination address
local forwarding table
list range of addresses
dest address output (aggregate table entries)
address-range 1 3 link
address-range 2 2
address-range 3 2
address-range 4 1

IP destination address in
arriving packet’s header
1
3 2

Network Layer 4-15


Datagram forwarding table
Destination Address Range Link Interface

11001000 00010111 00010000 00000000


through 0
11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000


through 1
11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000


through 2
11001000 00010111 00011111 11111111

otherwise 3

Q: but what happens if ranges don’t divide up so nicely?


Network Layer 4-16
Longest prefix matching
longest prefix matching
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface


11001000 00010111 00010*** ********* 0
11001000 00010111 00011000 ********* 1
11001000 00010111 00011*** ********* 2
otherwise 3

examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer 4-17
Datagram or VC network: why?
Internet (datagram) ATM (VC)
 data exchange among  evolved from telephony
computers  human conversation:
 “ elastic” service, no strict  strict timing, reliability
timing req. requirements
 need for guaranteed service
 many link types  “ dumb” end systems
 different characteristics  telephones
 uniform service difficult  complexity inside network
 “ smart” end systems
(computers)
 can adapt, perform control,
error recovery
 simple inside network,
complexity at “edge”

Network Layer 4-18


Forwarding Methods

Network Layer 4-19


Route method versus next-hop method

20
Host-specific versus network-specific method

21
Default method

22
Simplified forwarding module in classless address

23
In classless addressing, we need at
least four columns in a routing table.

24
Example 1

Make a routing table for router R1, using the


configuration in Figure 1.

Solution
Table 22.1 shows the corresponding table.

25
Figure 1 Configuration

26
Table .1 Routing table for router R1 in Figure 1

22.27
Example. 2

Show the forwarding process if a packet arrives at R1 in


Figure 1 with the destination address 180.70.65.140.
Solution
The router performs the following steps:
1. The first mask (/26) is applied to the destination address.
The result is 180.70.65.128, which does not match the
corresponding network address.
2. The second mask (/25) is applied to the destination
address. The result is 180.70.65.128, which matches the
corresponding network address. The next-hop address
and the interface number m0 are passed to ARP for
further processing.
28
Example. 3

Show the forwarding process if a packet arrives at R1 in


Figure 1 with the destination address 201.4.22.35.

Solution
The router performs the following steps:
1. The first mask (/26) is applied to the destination
address. The result is 201.4.22.0, which does not
match the corresponding network address.
2. The second mask (/25) is applied to the destination
address. The result is 201.4.22.0, which does not
match the corresponding network address (row 2).
22.29
Example. 3 (continued)

3. The third mask (/24) is applied to the destination


address. The result is 201.4.22.0, which matches the
corresponding network address. The destination
address of the packet and the interface number m3 are
passed to ARP.

22.30
Example .4

Show the forwarding process if a packet arrives at R1 in


Figure 1 with the destination address 18.24.32.78.

Solution
This time all masks are applied, one by one, to the
destination address, but no matching network address is
found. When it reaches the end of the table, the module
gives the next-hop address 180.70.65.200 and interface
number m2 to ARP. This is probably an outgoing
package that needs to be sent, via the default router, to
someplace else in the Internet.

31
Routing Table

• Static Routing Table.


• Dynamic Routing Table

32
Figure 22.10 Common fields in a routing table

22.33
The Internet network layer
host, router network layer functions:

transport layer: TCP, UDP

routing protocols IP protocol


• path selection • addressing conventions
• RIP, OSPF, BGP • datagram format
network • packet handling conventions
layer forwarding
table ICMP protocol
• error reporting
• router “signaling”

link layer

physical layer

Network Layer 4-34


DHCP: Dynamic Host Configuration Protocol

goal: allow host to dynamically obtain its IP address from network server when
it joins network
 can renew its lease on address in use
 allows reuse of addresses (only hold address while connected/“ on” )
 support for mobile users who want to join network (more shortly)
DHCP overview:
 host broadcasts “ DHCP discover” msg [optional]
 DHCP server responds with “ DHCP offer” msg [optional]
 host requests IP address: “ DHCP request” msg
 DHCP server sends address: “ DHCP ack” msg

Network Layer 4-35


DHCP client-server scenario

DHCP
223.1.1.0/24
server
223.1.1.1 223.1.2.1

223.1.1.2 arriving DHCP


223.1.1.4 223.1.2.9
client needs
address in this
223.1.3.27
223.1.2.2 network
223.1.1.3

223.1.2.0/24

223.1.3.1 223.1.3.2

223.1.3.0/24

Network Layer 4-36


DHCP client-server scenario
DHCP server: 223.1.2.5 DHCP discover arriving
client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server! Here’s an IP
yiaddrr: 223.1.2.4
transaction
address youID:can
654use
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I’ll take
yiaddrr: 223.1.2.4
that IP address!
transaction ID: 655
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
Broadcast: OK. You’ve
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
lifetime: 3600 secs

Network Layer 4-37


DHCP: more than IP addresses
DHCP can return more than just allocated IP address
on subnet:
 address of first-hop router for client
 name and IP address of DNS sever
 network mask (indicating network versus host portion
of address)

Network Layer 4-38


DHCP: example
DHCP DHCP  connecting laptop needs
DHCP UDP its IP address, addr of
DHCP IP
DHCP Eth
first-hop router, addr of
Phy DNS server: use DHCP
DHCP
 DHCP request encapsulated
in UDP, encapsulated in IP,
DHCP DHCP 168.1.1.1 encapsulated in 802.1
DHCP UDP Ethernet
DHCP IP
DHCP Eth router with DHCP
 Ethernet frame broadcast
Phy server built into (dest: FFFFFFFFFFFF) on LAN,
router received at router running
DHCP server
 Ethernet demuxed to IP
demuxed, UDP demuxed to
DHCP

Network Layer 4-39


DHCP: example
DHCP DHCP
 DCP server formulates DHCP
DHCP UDP ACK containing client’s IP
DHCP IP address, IP address of first-
DHCP Eth hop router for client, name &
Phy IP address of DNS server

 encapsulation of DHCP
DHCP DHCP server, frame forwarded
DHCP UDP to client, demuxing up to
DHCP IP DHCP at client
DHCP Eth router with DHCP
DHCP
Phy server built into  client now knows its IP
router address, name and IP
address of DSN server,
IP address of its first-hop
router

Network Layer 4-40


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 destination in this network
source NAT IP address: have 10.0.0/24 address for
138.76.29.7,different source source, destination (as usual)
port numbers
Network Layer 4-41
Table Addresses for private networks

42
A NAT implementation

43
Addresses in a NAT

44
NAT address translation

45
Five-column translation table

46
An ISP and NAT

47
Routing algorithm classification
Q: global or decentralized Q: static or dynamic?
information?
static:
global:  routes change slowly over
 all routers have complete
topology, link cost info
time
 “ link state” algorithms dynamic:
 routes change more
decentralized:
 router knows physically- quickly
connected neighbors, link costs  periodic update
to neighbors  in response to link cost
 iterative process of computation, changes
exchange of info with neighbors
 “ distance vector” algorithms

Network Layer 4-49


Figure 2 Autonomous systems

50
Figure 3 Popular routing protocols

51
Figure 4 Distance vector routing tables

52
Figure 5 Initialization of tables in distance vector routing

53
In distance vector routing, each node
shares its routing table with its
immediate neighbors periodically and
when there is a change.

22.54
Figure 6 Updating in distance vector routing

55
link state routing

56
Figure 22.21 Link state knowledge

57
Figure 22.22 Dijkstra algorithm

58
Figure 22.23 Example of formation of shortest path tree

59
Comparison of LS and DV algorithms
message complexity robustness: what happens if
 LS: with n nodes, E links, O(nE) router malfunctions?
msgs sent LS:
 DV: exchange between neighbors  node can advertise incorrect
only link cost
 convergence time varies  each node computes only its
own table
speed of convergence DV:
 LS: O(n2) algorithm requires
O(nE) msgs  DV node can advertise
incorrect path cost
 may have oscillations
 each node’s table used by
 DV: convergence time varies others
 may be routing loops • error propagate thru
 count-to-infinity problem network

Network Layer 4-60


ICMP: internet control message protocol

 used by hosts & routers to


communicate network- Type Code description
0 0 echo reply (ping)
level information 3 0 dest. network unreachable
 error reporting: unreachable 3 1 dest host unreachable
host, network, port, protocol 3 2 dest protocol unreachable
 echo request/reply (used by 3 3 dest port unreachable
ping) 3 6 dest network unknown
 network-layer “ above” IP: 3 7 dest host unknown
 ICMP msgs carried in IP 4 0 source quench (congestion
datagrams control - not used)
8 0 echo request (ping)
 ICMP message: type, code 9 0 route advertisement
plus first 8 bytes of IP 10 0 router discovery
datagram causing error 11 0 TTL expired
12 0 bad IP header

Network Layer 4-61


Broadcast routing
 deliver packets from source to all other nodes
 source duplication is inefficient:
duplicate
duplicate R1 creation/transmission R1
duplicate
R2 R2

R3 R4 R3 R4

source in-network
duplication duplication

 source duplication: how does source determine


recipient addresses?
Network Layer 4-62
Multicast routing: problem statement
goal: find a tree (or trees) connecting routers having
local mcast group members legend
 tree: not all paths between routers used group
 shared-tree: same tree used by all group members member
not group
 source-based: different tree from each sender to rcvrs member
router
with a
group
member
router
without
group
member

shared tree source-based trees


Network Layer 4-63

You might also like