Title: Network%20Layer:%20a.%20Forwarding
1Network Layer a. Forwarding
- Goals
- understand principles behind network layer
services - forwarding
- routing (path selection)
- dealing with scale
- instantiation and implementation in the Internet
- Overview
- network layer services
- IP addresses their usage
- NAT
- IP header
- IP fragmentation
- ICMP
- IPv6
2Network Layer objectives
- Transport packet from source to dest.
- Net layer in all hosts, routers
- Basic functions
- Forwarding
- move packets from source to destination through
routers - Routing
- prepare info (table) that enables finding a path
for every packet/ data stream - Call setup (VC only, see later)
- find path for a data session before data transfer
starts - keep record of it in routers
Data plane
Control plane
3Interplay between routing and forwarding
Build routing tables
value in arriving packets header
1
0111
2
3
Forwarding
Move packets from input link to output link
4Network Layer issues
- For users/ hosts quality of service
- guaranteed bandwidth?
- Fixed delay (no jitter)?
- loss-free delivery?
- in-order delivery?
- Interaction between hosts and network
- signaling congestion feedback?/resource
reservation? - For network providers
- efficiency
- policy of route control
- scalability
5Network service model
- Q What service model for channel transporting
packets from sender to receiver? - guaranteed bandwidth?
- preservation of inter-packet timing (no jitter)?
- loss-free delivery?
- in-order delivery?
- congestion feedback to sender?
The most important abstraction provided by
network layer
?
?
virtual circuit or datagram?
?
service abstraction
6Virtual circuits signaling protocols
- Principle
- prepare a path ( VC) before moving data
- each direction is a separate path
- Signaling
- used to set up, maintain, teardown VC
- used in ATM, frame-relay, X.25
- not used in todays Internet
- but Ciscos MPLS builds a VC service over IP
6. Receive data
5. Data flow begins
4. Call connected
3. Accept call
1. Initiate call
2. incoming call
more path details
path recorded
7Virtual Circuit call setup
- Path preparation resource allocation
- Call setup message flows from source to
destination. - path recorded at this time
- Path determination (routing)
- Source based or network based.
- Msg may indicate required resources
- BW, latency, buffer, etc.
- A router can either
- accept (and commit required resources) or reject
- Path accepted if all routers accept.
8Virtual Circuit Identifiers
- Forward call-setup pass
- each router allocates an ID for the VC
- intended for incoming (I/C) packets of the VC
- records it the preceding following node of
path - Backward call-setup pass
- each router tells predecessor its ID for the VC
- will use this ID on outgoing (O/G) packets of
this VC - lists in the I/C ports fwding table the I/C
VC-ID and the corresponding O/G portO/G ID - Runtime when receiving a packet with an ID
- find, in the I/C ports forwarding table, the I/C
IDs record - read from it the outgoing port the O/G ID
- send packet on the required port with new ID .
9VC identifiers preparation
BW1Mb
BW1Mb
BW1Mb
1
2
1
2
In port VC id in Out port VC id out
1 22 2
In port VC id in Out port VC id out
1 22 2 xx
In port VC id in Out port VC id out
1
In port VC id in Out port VC id out
1
In port VC id in Out port VC id out
1 38 2
In port VC id in Out port VC id out
1 38 2 22
10VC identifiers usage
VCid38
VCidxx
VCid22
2
1
2
1
In port VC id in Out port VC id out
1 22 2
In port VC id in Out port VC id out
1 22 2 xx
In port VC id in Out port VC id out
1
In port VC id in Out port VC id out
1
In port VC id in Out port VC id out
1 38 2
In port VC id in Out port VC id out
1 38 2 22
11VC summary
- source-to-dest path behaves much like telephone
circuit - similar preparations along source-to-dest path
- however performance similar to datagram network
- unless resources are allocated using QoS
protocols - only performance advantage in-order packet
arrival
- call setup, teardown for each call before data
can flow - each packet carries VC identifier (not
destination host ID) - every router on source-dest path maintains
state for each passing connection - link, router resources (bandwidth, buffers) may
be allocated to VC - to get circuit-like performance.
12VC implementation
- A VC consists of
- Path from source to destination
- VC numbers, one number for each link along path
- Entries in forwarding tables in routers along
path - Data packet belonging to VC carries a VC number,
no destination address. - VC number must be changed on each link.
- New VC number taken from forwarding table
13VC Forwarding table
18
29
63
VC number
Forwarding table in northwest router
Routers maintain connection state information!
Lecture 6 Network Layer
13
14Datagram networks Internet model
- no call setup at network layer
- routers no state about end-to-end connections
- no network-level concept of connection
- packets typically routed using destination host
ID - packets between same source-dest pair may take
different paths
1. Send data
2. Receive data
15ATM overview
- Asynchronous Transfer Mode
- Fixed packets size called cells
- 53 bytes 5 header 48 data
- All virtual-circuit based
- Types of virtual circuits
- virtual circuits aggregated into virtual
paths - Permanent or switched
- Architecture is QoS-focused
- Service Quality types CBR, VBR, ABR, UBR
- Access traffic policing
- Typical tool leaky-bucket access control
16Network Layer Quality of Service
Guarantees ?
Network Architecture Internet ATM ATM ATM ATM
Service Model best effort CBR VBR ABR UBR
Congestion feedback no (inferred via
loss/delay) no congestion no congestion yes no
Bandwidth none constant rate guaranteed rate gua
ranteed minimum none
Loss no yes yes no no
Order no yes yes yes yes
Timing no yes yes no no
- Internet model is being extended Intserv,
Diffserv - multimedia networking
ATM Asynchronous Transfer Mode CBR Constant
Bit Rate V Variable A available U
Unspecified
17Datagram or VC network why?
- Internet (Datagram)
- data exchange among hosts
- (mostly) elastic service, no strict timing req.
- smart end systems
- can adapt, perform control, error recovery
- simple inside network, complexity at edge
- many link types
- different characteristics
- uniform service difficult
- Datagram benefit
- Simplicity
- ATM (VC)
- evolved from telephony
- but supports also data
- human conversation
- strict timing reliability requirements
- svc guaranteed needed
- dumb end systems
- telephones
- complexity inside network
- VC Benefits
- Fast forwarding
- Traffic Engineering.
- In order delivery
18The Internet Network layer
- Host, router network layer functions
Transport layer TCP, UDP
Network layer
Link layer
physical layer
19IP Addressing Scheme
- We need an address to uniquely identify each
destination - Routing scalability requires flexibility in
aggregation of destination addresses - we should be able to aggregate a set of
destinations as a single routing unit - necessary for routing table scalability
- Preview the unit of routing in the Internet is a
network - the destinations in the routing
protocols and tables are networks
20IP Addressing introduction
223.1.1.1
- IP address 32-bit identifier for host or router
interface - interface connection between host/router and
physical link - routers typically have multiple interfaces
- a host has typically a single interface
- IP addresses associated with interface, not host,
or router
223.1.2.9
223.1.1.4
223.1.1.3
223.1.1.1 11011111 00000001 00000001 00000001
223
1
1
1
21IP Addressing
223.1.1.1
- IP address is divided into two parts
- network prefix
- K high order bits
- host number
- remaining low order bits
- This partitioning of the address depends on the
context network in which we see this NIC - networks are nested inside each other
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.2.2
223.1.1.3
223.1.3.27
LAN
223.1.3.2
223.1.3.1
Qn What is the routers IP address in the
drawing we see?
22What is a network in IP view?
223.1.1.1
- IP network terminology
- a Subnet is
- a set of devices that can physically reach each
other without intervening router(s) - e.g. a LAN
- a Network is
- a subnet , or
- the union of several subnets that are
interconnected by links
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.2.2
223.1.1.3
223.1.3.27
LAN
223.1.3.2
223.1.3.1
three subnets (LANs) 223.1.1., 223.1.2.,
223.1.3., together they form a larger network
with prefix 223.1 (16 bits) (OR MORE bits?)
23IP Address Structure (CIDR method)
- the network prefix consists of the K most
significant bits of the address - in some cases it is called the subnet prefix (see
subnets below) - the host number the other (32-K) bits
- the size K of the network prefix differs and must
be specified in each case. Two methods used for
this - network mask has all 1s in the prefix part and
all 0s elsewhere - short notation is /K (also called the CIDR
notation)
- Exercise 1
- write the following IP address in dotted decimal
notation - specify corresponding netwk mask (binary and
dotted decimal) - show network prefix host parts of that
address (binary)
11001000 00010111 00010001 10110101 /23
see solutions at end of chapter
24Special Types of IP Address
- network broadcast address host 11...1
- means all the hosts in the network specified in
address prefix - used only as destination address of packets
- if dest. address 11 1 (32 1s), broadcast on
senders subnet - network address host 0 (all zeros)
- means the whole network (used only in routing
tables) - therefore the IP address of a host/router can not
have host number 0 or all ones
- Exercise 2
- write the network address of the network from
Exercise 1 - write the broadcast address for that network
- how many IP host addresses are possible in that
network? - write host network address with /K notation
- write the first and last host address on that
network
25Subnets
Example
Network 223.1.0.0 / 21
- Recipe
- To determine the subnets of a network, detach
each interface from its host or router, creating
islands of isolated networks. Each isolated
network is a subnet.
Divide network into subnets and give an address
to each subnet
26Solution of Example
Stage 2
Network 223.1.0.0 / 21
Stage 1
Subnet 223.1.1.0 / 24
Subnet 223.1.2.0 / 24
223.1.1.1
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.3.27
223.1.1.3
223.1.2.2
223.1.3.2
223.1.3.1
Subnet 223.1.3.0 / 24
Subnets /24
27Subnets
Whole network 223.1.0.0/20
223.1.1.2
Subnet 223.1.1.0/24
223.1.1.1
223.1.1.4
- How many subnets?
- Write an address for each subnet,including /K
- Write an address for the whole network,including
/K
223.1.1.3
223.1.7.2
223.1.9.2
Subnet 223.1.7.0/24
Subnet 223.1.9.0/24
223.1.9.1
223.1.7.1
223.1.8.2
223.1.8.1
Subnet 223.1.8.0/24
223.1.2.6
223.1.3.27
223.1.2.2
223.1.3.2
223.1.3.1
223.1.2.1
Subnet 223.1.3.0/24
Subnet 223.1.2.0/24
28IP Addresses
- given notion of network, lets re-examine IP
addresses
classful addressing (does not need mask or /K
indicator)
() this range used as multicast also in CIDR
method
29IP addressing CIDR
- classful addressing
- inefficient use of address space, address space
exhaustion - e.g., class B net allocated enough addresses for
65K hosts, even if only 2K hosts in that network - CIDR Classless InterDomain Routing
- network portion of address of arbitrary length
- address format a.b.c.d/x, where x is bits in
network portion of address - Requires inclusion of mask or /K in routing
table
30IP addresses how to get one?
- Hosts (host number)
- hard-coded by system admin in a file
- Can see in IPConfig
- DHCP Dynamic Host Configuration Protocol
dynamically get address plug-and-play - host broadcasts DHCP discover msg
- DHCP server responds with DHCP offer msg
- host requests IP address DHCP request msg
- DHCP server sends address DHCP ack msg
- this is the common practice in LAN (why?)
- in home access same procedure using PPP protocol
31IP addresses how to get one?
- Network (network prefixmask)
- get allocated portion of ISPs address space
ISP's block 11001000 00010111 00010000
00000000 200.23.16.0/20 Organization 0
11001000 00010111 00010000 00000000
200.23.16.0/23 Organization 1 11001000
00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100
00000000 200.23.20.0/23 ...
..
. . Organization
7 11001000 00010111 00011110 00000000
200.23.30.0/23
32IP addresses how to get one?
- ISP
- Gets a block of addresses from ICANN
- A ICANN Internet Corporation for Assigned
- Names and Numbers
- allocates addresses
- manages DNS
- assigns domain names, resolves disputes
- allocates codes for the various protocols
33Hierarchical addressing route aggregation
Hierarchical addressing allows efficient
advertisement of routing information
Organization 0
Organization 1
Send me anything with addresses beginning
200.23.16.0/20
Organization 2
Fly-By-Night-ISP
Internet
Organization 7
Send me anything with addresses beginning
199.31.0.0/16
ISPs-R-Us
34Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to
Organization 1
Organization 0
Send me anything with addresses beginning
200.23.16.0/20
Organization 2
Fly-By-Night-ISP
Internet
Organization 7
Send me anything with addresses beginning
199.31.0.0/16 or 200.23.18.0/23
ISPs-R-Us
Organization 1
35Routing table
4 billion possible entries ()
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
() true for IPv4 in IPv6 MUCH more
36Longest prefix matching
Network /K
Link Interface 11001000 00010111 00010000
00000000 /21 0 11001000 00010111 00011000
00000000 /24 1 11001000 00010111 00010100
00000000 /24 2 00000000 00000000 00000000
00000000 /0 3
Network Link
Interface 200.23.16.0 /21 0 200.23.24.0 /24
1 200.23.20.0 /24 2 otherwise 3
Routing table
Examples
Which interface will be used by this router for
following dest addresses?
(a) DA 11001000 00010111 00010110 10100001
(b) DA 11001000 00010111 00010100 10101010
(c) DA 11001000 00010111 00011100 10111110
(d) DA 11001000 00010111 00011000 11101010
37Getting a datagram from source to dest.
routing table in R
- datagram remains unchanged (), as it travels
source to destination - addr fields of interest here
- Main field dest. IP addr
-
() almost
38Getting a datagram from source to dest.
misc fields
As ARP Table 223.1.1.3 gt ? 223.1.1.4 gt ? Etc.
As IPConfig IP Addr 223.1.1.1 Subnet /K 24
() Dflt Gtwy 223.1.1.4
data
223.1.1.1
223.1.1.3
- Starting at A, given IP datagram addressed to B
- A looks up its /K() in IPConfig
- Compares first K bits in dest address with those
in its own - find B is on same net. as A
- same prefix ? sane subnet
- link layer will send datagram directly to B in
link-layer frame - using ARP table/protocol
- B and A are directly connected
- () in the form of subnet mask
-
() subnet mask 225.225.225.0
39Getting a datagram from source to dest.
Routing Table
- Starting at A, dest. E
- look up network address of E
- E on different network
- A sees this by comparing /K prefixes of A and E
- routing table next hop router to E is 223.1.5.2
- link layer sends datagram to router 223.1.5.2
inside link-layer frame - datagram arrives at 223.1.5.2
- cont. on next slide..
a
b
a
b
c
40Getting a datagram from source to dest.
misc fields
data
223.1.1.1
223.1.2.2
- Arrived at 223.1.5,2, continuing to 223.1.2.2
- look up network address of E
- E on subnet directly attached to routers
interface b - link layer sends datagram to 223.1.2.2 inside
link-layer frame via I/F b (223.1.2.9) - datagram arrives at 223.1.2.2!!! (hooray!)
- Qn What table consulted here?
a
b
a
b
c
41Network Address Translation (NAT) Outline
- A local network uses just one public IP address
as far as outside world is concerned - Each device on the local network is assigned a
private IP address
Datagrams with source or destination in this
network have 192.168.1/24 address for source
/destination (as usual)
All datagrams leaving local network have same
single source NAT IP address 138.76.29.7, differe
nt source port numbers
42NAT Implementation
- NAT router must
- for outgoing datagrams
- replace (source IP address, port ) of every
outgoing datagram by (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 - for 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
43NAT Network Address Translation
NAT translation table WAN side addr LAN
side addr
138.76.29.7, 5001 192.168.1.2, 3345
192.168.1.2
192.168.1.1
192.168.1.3
138.76.29.7
192.168.1.4
4 NAT router changes datagram dest addr
from 138.76.29.7, 5001 to 192.168.1.2, 3345
3 Reply arrives dest. address 138.76.29.7,
5001
44NAT Advantages
- No need to be allocated range of addresses from
ISP - just one public IP address is used for all
devices - 16-bit port-number field allows 60,000
simultaneous connections with a single LAN-side
address ! - can change ISP without changing addresses of
devices in local network - can change addresses of devices in local network
without notifying outside world - Devices inside local net not explicitly
addressable, visible by outside world (a security
plus)
45NAT Drawbacks
- If both hosts are behind distinct NATs, they will
have difficulty establishing connection - NAT is controversial
- violates layer modularity principle routers
should process up to only layer 3 - causes problem for some application protocols
- if application writes an explicit IP address
within the L5 header, the peer application will
get a useless internal IP address as an argument - proper address shortage solution IPv6 !
46IP datagram format
IP protocol version number
32 bits
total datagram length (bytes)
header length (bytes)
type of service
head. len
ver
length
for fragmentation/ reassembly
fragment offset
type of data
flgs
16-bit identifier
max number remaining hops (decremented at each
router)
upper layer
time to live
Internet checksum
32 bit source IP address
32 bit destination IP address
upper layer protocol to deliver payload to
E.g. timestamp, record route taken, specify list
of routers to visit.
Options (if any)
data (variable length, typically a TCP or UDP
segment)
47IPv6
- Initial motivation 32-bit address space soon to
be completely allocated. - Additional motivation
- IPv6 header format helps speed processing
- IPv6 datagram format
- 16-byte (128 bit) IP address
- fixed-length 40 byte header
- no options allowed inside the header
- each option gets its own header after the main IP
header - fragmentation discouraged
- allowed only using an options header
48Transition From IPv4 To IPv6
- Not all routers can be upgraded simultaneously
- How will the network operate with mixed IPv4
IPv6 routers? - Tunneling IPv6 datagrams are carried as payload
in IPv4 datagrams when travelling through IPv4
routers - source and destination network are IPv6, but need
to transitan existing IPv4 network - How is tunneling done?
- gateway router in source network takes the IPv6
datagram as payload and encapsulates it into an
IPv4 datagram - i.e. adds an IPv4 header in front of it
- the IPv4 destination is the gateway router of the
destination network, which removes the IPv4
header and routes by IPv6 - Gateway router must support IPv4, IPv6 and
tunneling
49Tunneling
tunnel
Logical view
IPv6
IPv6
IPv4
IPv4
Physical view
IPv6
IPv6
IPv4
IPv4
A-to-B IPv6
E-to-F IPv6
B-to-C IPv6 inside IPv4
B-to-C IPv6 inside IPv4
50Usage of Tunneling
- Tunneling is used to move a packet between
similar networks A, B through a network Cthat
is unable to understand its L3 header - Possible reasons
- C uses a different protocol (e.g. IPv6 vs IPv4)
- A wants to encipher the data and the header(VPN
application) - All networks use same protocol, but the
destination node is currently at a foreign
network(Mobile IP application)
51IPv6 Header (Cont)
Priority identify priority among datagrams in
flow Flow Label identify datagrams in same
flow. (concept offlow
not well defined). Next header identify upper
layer protocol for data
52Transition From IPv4 To IPv6
- Not all routers can be upgraded simultaneous
- no flag days
- How will the network operate with mixed IPv4 and
IPv6 routers? - Tunneling IPv6 carried as payload in IPv4
datagram among IPv4 routers
53IPv6 status report
- Operating systems
- wide support early 2000
- Windows (2000, XP, Vista), BSD, Linux, Apple
- Networking infrastructure
- Cisco
- Deployment
- Slow
- Penetration
- Host - minor (less than 1)
- Used in 2008 in China Olympic games
- Motivation CIDR NAT
54Extra
55IP Fragmentation Reassembly
- network links have MTU (max.transfer size) -
largest possible link-level frame. - different link types, different MTUs
- large IP datagram divided (fragmented) within
net - one datagram becomes several datagrams
- reassembled only at final destination
- IP header bits used to identify, order related
fragments
fragmentation in one large datagram out 3
smaller datagrams
reassembly
56IP Fragmentation and Reassembly
- Example
- 4000 byte datagram
- MTU 1500 bytes
1480 bytes in data field
offset 1480/8
57ICMP 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
Type Code description 0 0 echo
reply (ping) 3 0 dest. network
unreachable 3 1 dest host
unreachable 3 2 dest protocol
unreachable 3 3 dest port
unreachable 3 6 dest network
unknown 3 7 dest host unknown 4
0 source quench (congestion
control - not used) 8 0
echo request (ping) 9 0 route
advertisement 10 0 router
discovery 11 0 TTL expired 12 0
bad IP header
58Traceroute and ICMP
- Source sends series of UDP segments to dest
- First has TTL 1
- Second has TTL2, etc.
- Unlikely port number
- When nth datagram arrives to nth router
- Router discards datagram
- And sends to source an ICMP message (type 11,
code 0) - Message includes name of router IP address
- When ICMP message arrives, source calculates RTT
- Traceroute does this 3 times
- Stopping criterion
- UDP segment eventually arrives at destination
host - Destination returns ICMP host unreachable
packet (type 3, code 3) - When source gets this ICMP, stops.
59Exercise 1 Answers
11001000 00010111 00010001 10110101 /23
Ans 1 11001000 00010111 00010001 10110101
200.23.17.181128648 200 167 23 161
17 12832165 181
Ans 2 11111111 11111111 11111110 00000000
255.255.254.0 255-1 254
Ans 3 11001000 00010111 00010001 10110101
NETWORK HOST
60Exercise 2 Answers
11001000 00010111 00010001 10110101 /23
NETWORK
Ans 1 11001000 00010111 00010000 00000000
200.23.16.0
Ans 2 11001000 00010111 00010001 11111111
200.23.17.255
Ans 3 29-2 510 hosts
Ans 4 network 200.23.16.0/23 host
200.23.17.181/23
Ans 5 first host address 200.23.16.1/23 last
host address 200.23.17.254/23