Network - Layer Part-I
Network - Layer Part-I
Network - Layer Part-I
(CS F303)
BITS Pilani Virendra Singh Shekhawat
Department of Computer Science and Information Systems
Pilani Campus
BITS Pilani
Pilani Campus
• Network Layer
– Network layer service models
– Forwarding versus routing
– How a router works
– IPv4 Datagram and Fragmentation
– IPv4 Addressing
• NAT
• Sub Netting
• IPv4 to IPv6 translation
• ICMP
– Routing (path selection) [BGP, RIP, OSPF]
– Multicast Routing
3
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Network layer
network
network
all IP datagrams passing through it data link
data link
physical
physical
network
data link application
physical transport
network
data link
physical
4
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Two Key Network-Layer
Functions
Forwarding: Move packets from input link to
output link within a router
routing algorithm
value in arriving
packet’s header
0111 1
3 2
5
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Network Service Models
Example services for individual datagrams:
• Guaranteed delivery
• Security
6
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Network Layer Service Models
Guarantees ?
Network Service Congestion
Architecture Model Bandwidth Loss Order Timing feedback
7
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Network Layer Connection and
Connection-less Service
• Datagram network
– Network-layer connectionless service
• VC Network
– Network-layer connection service
• Analogous to the transport-layer services, but
– Service: host-to-host
– No choice: network provides one or the other
– Implementation: in network core
8
Computer Networks (CS F303) BITS Pilani, Pilani Campus
What is VC ?
• VC consists of:
– Path from source to destination
– VC numbers (no destination address), one number
for each link along path
– Entries in forwarding tables in routers along path
9
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Forwarding table
VC number
12 22 32
1 3
2
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
application
application
transport
transport
network
data link 1. Send data 2. Receive data network
data link
physical
physical
11
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Forwarding Table
Destination Address Range Link Interface
otherwise 3
12
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Longest Prefix Matching
13
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Router Architecture Overview
[.1]
14
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Router Architecture Overview
[..2]
15
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Input Port Functions
Physical layer:
bit-level reception
Decentralized switching:
Data link layer:
• Given datagram dest., lookup output port using
e.g., Ethernet forwarding table in input port memory
• Goal: complete input port processing at ‘line speed’
16
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Input Ports
17
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Switching Fabric
• Switching rate: rate at which packets can
be transferred from inputs to outputs
• N inputs: switching rate N times line
rate desirable
18
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Output Ports
switch
switch
fabric
fabric
20
Computer Networks (CS F303) BITS Pilani, Pilani Campus
IP Datagram Format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum Detect bit errors
(decremented at
32 bit source IP address In Datagram headers
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
(variable length, list of routers
20 bytes of TCP
typically a TCP to visit.
20 bytes of IP
or UDP segment)
= 40 bytes + app
layer overhead
21
Computer Networks (CS F303) BITS Pilani, Pilani Campus
IPv4 Addressing
22
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Class full Addressing
23
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Number of Blocks and Block Size
24
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Private Addresses
25
Computer Networks (CS F303) BITS Pilani, Pilani Campus
IP Addressing: Subnets [1]
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9
223.1.3.27
223.1.1.3
223.1.2.2
223.1.3.1 223.1.3.2
26
Computer Networks (CS F303) BITS Pilani, Pilani Campus
IP Addressing: Subnets [2] 223.1.1.2
223.1.1.1 223.1.1.4
223.1.1.3
223.1.9.2 223.1.7.0
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0
223.1.2.6 223.1.3.27
27
Computer Networks (CS F303) BITS Pilani, Pilani Campus
CIDR: Block of IP Addresses
28
Computer Networks (CS F303) BITS Pilani, Pilani Campus
IPv4 Address Allocation
29
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Hierarchical Addressing: Route
Aggregation
Hierarchical addressing allows efficient advertisement of routing
information
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
beginning
199.31.0.0/16”
30
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Hierarchical Addressing
Organization 0
200.23.16.0/23
“Send me anything
with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning 199.31.0.0/16
or 200.23.18.0/23”
200.23.18.0/23
31
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Exercise: Subnets
32
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Example: Different Size Subnets
33
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Three Subnets
34
Computer Networks (CS F303) BITS Pilani, Pilani Campus
Thank You!
35
Computer Networks (CS F303) BITS Pilani, Pilani Campus