Lecture 2
Lecture 2
Lecture 2
Ante Prodan
School of Computing Engineering and
Mathematics
1
Important Concepts
How Routers work – forwarding and Routing
Network Layer Services
Connection oriented and Connection less paths between hosts
IP Packet Structure, IP fragmentation and reassembly
IP Addresses, Class base and Classless
Subnets and Subnet masks
How Computer get an IP address – Static and DHCP
Connecting a computer to a network – Gateway, Subnet mask
and DNS
How Organisations get IP addresses
NAT ; Network Address Translation
ICMP – Internet Control Message Protocol – Traceroute and
ICMP
IPv6 – 128 bit address space
2
Network layer
application
transport
network
transport segments from data link
physical
4
Interplay between routing and forwarding
routing algorithm
value in arriving
packet’s header
0111 1
3 2
5
Network service model
Q: What service model for “channel” transporting
datagrams from sender to receiver?
guaranteed delivery
delivery
with less than 40 msec guaranteed minimum
in inter-packet spacing
6
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
implementation: in network core 7
Virtual circuits (VC)
“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)
8
Connection setup
3rd important function in some network
architectures:
ATM, frame relay, X.25
10
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
6. Receive data application
transport 5. Data flow begins
network 4. Call connected 3. Accept call transport
data link 1. Initiate call 2. incoming call network
data link
physical
physical
12
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
data link 1. Send data 2. Receive data network
data link
physical
physical
13
Question 1
What are the service model/s that network
layer can provide?
14
4 billion
Forwarding table possible entries
otherwise 3
15
Router Architecture Overview
16
Input Port Functions
Physical layer:
bit-level reception
Data link layer: Decentralized switching:
e.g., Ethernet given datagram dest., lookup output port
see chapter 5 using forwarding table in input port
memory
goal: complete input port processing at ‘line
speed’
queuing: if datagrams arrive faster than
forwarding rate into switch fabric
17
Three types of switching fabrics
18
Output Ports
21
The Internet Network layer
Host, router network layer functions:
Link layer
physical layer
22
IP datagram format
24
IP Fragmentation and Reassembly
length ID fragflag offset
=4000 =x =0 =0
Example
4000 byte One large datagram becomes
datagram several smaller datagrams
MTU = 1500
length ID fragflag offset
bytes =1500 =x =1 =0
1480 bytes in
data field length ID fragflag offset
=1500 =x =1 =185
offset =
1480/8 length ID fragflag offset
=1040 =x =0 =370
25
IP Addressing: introduction
223.1.1.1
IP address: 32-bit 223.1.2.1
identifier for host, 223.1.1.2
between host/router
and physical link
router’s typically have 223.1.3.1 223.1.3.2
multiple interfaces
host typically has one
interface
IP addresses associated 223.1.1.1 = 11011111 00000001 00000001 00000001
with each interface
223 1 1 1
26
Subnets
223.1.1.1
IP address:
223.1.2.1
subnet part (high order 223.1.1.2
bits) 223.1.1.4 223.1.2.9
host part (low order
223.1.2.2
bits) 223.1.1.3 223.1.3.27
What’s a subnet ? subnet
device interfaces with
same subnet part of IP 223.1.3.1 223.1.3.2
address
can physically reach
each other without network consisting of 3 subnets
intervening router
27
Subnets
223.1.1.0/24
223.1.2.0/24
Recipe
To determine the
223.1.3.0/24
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
29
IP addresses: how to get one?
>configuration->tcp/ip->properties
UNIX: /etc/rc.config
30
DHCP: Dynamic Host Configuration
Protocol
31
DHCP client-server scenario
32
DHCP client-server scenario
DHCP server: 223.1.2.5 arriving
DHCP discover
client
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
time Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
33
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
34
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”
35
Hierarchical addressing: more specific route
“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
36
NAT: Network Address Translation
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
37
NAT: Network Address Translation
in local network
devices inside local net not explicitly addressable, visible
38
NAT: Network Address Translation
Implementation: NAT router must:
40
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
41
ICMP: Internet Control Message Protocol
used by hosts & routers to
communicate network-level Type Code description
information 0 0 echo reply (ping)
3 0 dest. network unreachable
error reporting:
3 1 dest host unreachable
unreachable host, 3 2 dest protocol unreachable
network, port, protocol 3 3 dest port unreachable
echo request/reply (used
3 6 dest network unknown
by ping) 3 7 dest host unknown
4 0 source quench (congestion
network-layer “above” IP: control - not used)
ICMP msgs carried in IP 8 0 echo request (ping)
datagrams 9 0 route advertisement
10 0 router discovery
ICMP message: type, code
11 0 TTL expired
plus first 8 bytes of IP 12 0 bad IP header
datagram causing error
42
Traceroute and ICMP
Source sends series of UDP When ICMP message arrives,
segments to destination source calculates RTT
First has TTL =1 Traceroute does this 3 times
Second has TTL=2, etc. Stopping criterion
Unlikely port number UDP segment eventually
When n-th datagram arrives to arrives at destination host
n-th router: Destination returns ICMP
Router discards datagram “host unreachable” packet
And sends to source an ICMP (type 3, code 3)
message (type 11, code 0)
When source gets this ICMP,
Message includes name of
stops.
router& IP address
43
Question 3
Which of the following are network (Internet)
layer protocols?
44
IPv6
no fragmentation allowed
45
Other resources
Internet (IP) layer of TCP/IP
Wikipedia http://en.wikipedia.org/wiki/Internet_layer
Video
http://www.youtube.com/watch?v=STvq52WOIiw
DHCP (video)
http://www.youtube.com/watch?v=bv1itFPQ7O0&list
=PL547999D71DCAB1D0
ICMP (video)
http://www.youtube.com/watch?v=iWX1-QKG-
8Q&list=PL547999D71DCAB1D0
46
Other resources
An introduction to IPv6
https://www.youtube.com/watch?v=qLpxn
Hk6q50
47