Beruflich Dokumente
Kultur Dokumente
or
Network Layer
What we understand
Concepts of networking
How computers are internconnected
Bridge/Switch approach
Next
lets different networks work
together
Ethernet
Frame Relay
FDDI
Basics of Internetworking
What is an internetwork?
Illusion of a single (direct link) network
Built on a set of distributed, heterogeneous networks
Properties
Supports heterogeneity: independent of architecture,
operating system, network type and topology
Scales to global connectivity
HTTP
NV
TFTP
UDP
TCP
IP
FDDI
Ethernet
ATM
6
Internet
Concatenation of networks
H6
H7
H1
R1
Network
Network
11
Ethernet
Ethernet
Network 2
Point
-topoint
H3
H2
R3
Network
Network
33
FDDI
FDDI
R2
Network
Network
44
Ethernet
Ethernet
H5
H8
H4
Protocol stack
H1
H8
TCP
R1
IP
IP
ETH
R2
ETH
R3
IP
PPP
PPP
IP
FDDI
FDDI
TCP
IP
ETH
ETH
Global Addresses
Data link layer address
Address formats can be different in different networks
No hierarchy
Network Address
Globally unique
hierarchical
Network Addresses
Internet uses IPv4 addresses
10
Example
Change the following IPv4 addresses from binary notation to
dotted-decimal notation.
Solution
We replace each group of 8 bits with its equivalent decimal number
and add dots for separation.
11
Example
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.
Solution
We replace each decimal number with its binary
equivalent (see Appendix B).
12
Example
Find the error, if any, in the following IPv4 addresses.
221.34.7.8.20
75.45.301.14
13
IP Address allocation
IP addresses are allocated to organizations in
blocks
Three kinds of blocks are designed
Class A blocks for large organizations
Class B blocks for medium size organizations
Class C blocks for small organizations
14
15
IP Addresses - Class A
start with binary 0
Network addresses with first octet 00000000 are
reserved
01111111 (127) reserved for loopback
range 1.x.x.x to 126.x.x.x
all allocated
16
IP Addresses - Class B
17
IP Addresses - Class C
18
Classes
Traditional 3-class model; out of 4 billion
addresses
1/2 are class A
1/4 are class B
1/8 are class C
19
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
20
IP Address Summary
7 bits (126 nets)
Class A:
Network
Host
Network
Host
Network
8 bits (256)
Host
Example IP addresses
18.10.5.22
host in class A network (MIT)
130.126.143.254 host in class B network (UIUC)
192.12.70.111
host in class C network
IPv4
The Internet Protocol version 4 (IPv4) is the Network
layer protocol used in Internet.
22
23
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
24
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
25
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
26
Total length of IP datagram (including header) in bytes. It is a 16 bit field. Largest size of an IP
datagram thus is 65,535 bytes. Maximum header size is 60 bytes.
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
27
Identification field uniquely identifies each datagram sent by a host. It is normally incremented
by one each time a host sends a datagram. Very useful for fragmentation and reassembly.
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
28
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
29
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
30
Time-to-live or TTL field sets an upper limit on how many routers a datagram can go through.
Every router decrements TTL by 1 before sending it forward. If TTL reaches 0 the datagram is
dropped.
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
31
Identifies the protocol that sent the datagram. The protocol (today) can be TCP,
UDP, ICMP, IGMP etc.
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
32
The header checksum is calculated over the IP header only. TCP, UDP etc protect
their own data and header by a checksum.
0
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
33
Example
34
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
e.g.,
record route (each router on the way adds its address),
time stamp (each router on the way adds its address and time stamp),
loose source routing, strict source routing.
35
4
Version
16
TOS
HLen
Identification
TTL
19
Protocol
31
Length
Flags
Fragment
Offset
IP Header Checksum
Source IP Address
Destination IP Address
Options (variable)
Pad (variable)
36
Example
An IPv4 packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet. Why?
Solution
Thereisanerrorinthispacket.The4leftmostbits(0100)
showtheversion,whichiscorrect.Thenext4bits(0010)
showaninvalidheaderlength(24=8).Theminimum
numberofbytesintheheadermustbe20.Thepackethas
beencorruptedintransmission.
37
Example
In an IPv4 packet, the value of HLEN is 1000 in binary.
How many bytes of options are being carried by this
packet?
Solution
The HLEN value is 8, which means the total number of
bytesintheheaderis84,or32bytes.Thefirst20bytes
arethebaseheader,thenext12bytesaretheoptions.
38
1,500
39
Fragmentation and
Re-assembly
Different networks specify different max packet
size (MTU: max transmission unit)
Thus routers may need to fragment incoming datagram
into smaller pieces, called segment or fragments
Supposed MTUs:
Ethernet: 1500
FDDI: 4500
PPP: 532
40
Re-assembly
Issue of when to re-assemble
At intermediate nodes
need large buffers at routers
buffers may fill with fragments
all fragments must go through same router
may have to fragment again
At destination
41
IP Fragmentation
IP re-assembles at destination
only
uses fields in header
Data Unit Identifier (ID)
identifies original datagram
Data length
length of user data in octets
(bytes)
Offset
position of fragment of user
data in original datagram
in multiples of 64 bits (8
octets)
More flag
indicates that this is not the
last fragment
42
IP Fragmentation Example
43
Datagram Lifetime
Datagrams could loop indefinitely especially in
dynamic routing
consumes resources
Solution
Place upper bound on lifetime of a datagram
How?
Time To Live (TTL) field in IP
when lifetime expires, datagram discarded
simplest is hop count
44
Router
46
Routing Table
What information is stored in routing table??
47
Routing Table
Luckily we just need to have the entries for the
Networks in the routing table
thanks to the hierarchy in IP addresses
48
Datagram Forwarding
Every datagram contains destinations address
Network portion of address is compared with
pairs in the forwarding table
If directly connected to destination network, then
forward to host
If not directly connected to destination network,
then forward to some (default) router
49
Delivery
50
next-hop method
51
Routing Table
As there are around 2 million networks in the
world, looking them up every time a packet comes
in, can be very hectic
We can simplify it more by the use of default
entry in the routing table
52
Default method
53
An Example
a simple internet
54
Address Translation
Translate IP addresses to physical (link-layer /
subnetwork) addresses
55
Network layer
- example -
56
ARP Details
Table entries are discarded if not refreshed ( more
on it after one slide)
ARP packet format
HardwareType: type of physical network (e.g. ethernet)
ProtocolType: type of higher layer protocol (e.g., IP)
HLEN & PLEN: length of physical and protocol
addresses
Operation: request or response
Addresses
58
16
Hardware type = 1
HLen = 48
PLen = 32
31
Protocol
Type = 0x0800
SourceHardwareAddr (bytes 0
3)
SourceHardwareAddr (bytes 4
5) SourceProtocolAddr (bytes 0
1)
SourceProtocolAddr (bytes 2
3) TargetHardwareAddr (bytes 0
1)
TargetHardwareAddr (bytes 2
TargetProtocolAddr (bytes 0
5)
3)
59
60
Example
62
Routing Protocols
63
Routing Protocols
A routing table can be either static or dynamic.
A static table is one with manual entries.
A dynamic table is one that is updated automatically
when there is a change somewhere in the Internet.
64
65
RIP
Routing Table
Destination
Next Node/hop
Distance or Cost
dest next
dist
Table updation
Neighbors exchange table
entries
Determine current best next
hop based on distance
Directly connected network
has a cost of 1
Inform neighbors
Periodically
After changes
66
67
Note
68
69
RIP Operation
Router sends update message to neighbors every 30 sec
A router expects to receive an update message from each of its
neighbors within 180 seconds in the worst case
If router does not receive update message from neighbor X
within this limit, it assumes the link to X has failed and sets the
corresponding minimum cost to 16 (infinity)
Uses split horizon
Convergence speeded up by triggered updates
neighbors notified immediately of changes in distance vector
table
70
IP Address wastage
Inefficient address allocation (by class system)
Class A is too large for almost any organization
Class B is also too large for majority of the organizations
Class C is too small for many organizations
Questions
What network(s) should you allocate to a company with 1000
machines ?
What about a company with 200 machines ?
What about a company with 2 machines that plans to grow rapidly ?
71
IP Address wastage
Pressure primarily on class B networks
Most companies plan to grow beyond 255 machines
Renumbering is a hassle and can interrupt service
Only around 16,000 class B networks available (14 bits)
73
74
Example
A mask allows you to identify the network and
host parts of the address
75
Classless Addressing
(Supernetting, Subnetting)
Example
Suppose an organization needs 1000 IP addresses
It has two options
Purchase a class B address
Or purchase 4 class C addressess
Supernetting
Several networks are combined to form a supernet
Internet part
Network ID
Host ID
78
Supernet : an example
Four class C networks were put together to form the supernet:
192.230.80. 0
11000000 11100110 01010000 00000000
192.230.81. 0
192.230.82. 0
192.230.83. 0
79
11110000 00000000
Restrictions
To simplify the handling of addresses, the Internet
authorities impose some restrictions on classless
address blocks:
The addresses in a block must be contiguous, one after
another
The number of addresses in a block must be a power of
2 (1, 2, 4, 8, ... )
The first address must be evenly divisible by the
number of addresses
81
Subnetting
Subnet addressing allows the division of large block into
smaller blocks
Example:
An ISP is assigned a class B network.
Subnetting allows it to divide the class B network into smaller
networks to be issued to its clients
Original
address
1 0
Net ID
Subnetted
address
1 0
Net ID
Host ID
Subnet ID
Host ID
82
Subnetting
For example, a company is assigned with the class-C address
201.222.5.0
If 20 subnets are needed and each subnet is accessed with five
computers, how can the subnet be divided?
255.255.255.0
201.222.5.8
255.255.255.248
201.222.5.0
201.222.5.16
255.255.255.248
201.222.5.24
255.255.255.248
201.222.5.32
255.255.255.248
201.222.5.9
255.255.255.248
201.222.5.17
255.255.255.248
201.222.5.25
255.255.255.248
201.222.5.33
255.255.255.248
83
Example
Example (continued)
Solution
Group 1
For this group, each organization needs 256 addresses. This
means that 8 bits are needed for host part. The prefix
length is then 32 8 = 24. The addresses are
86
Example (continued)
Group 2
For this group, each organization needs 128 addresses. This
means that 7 (log2 128) bits are needed for host part. The
prefix length is then 32 7 = 25. The addresses are
87
Example (continued)
Group 3
For this group, each organization needs 64 addresses. This
means that 6 (log264) bits are needed for host part. The
prefix length is then 32 6 = 26. The addresses are
Summary
89
90
Example
Make a routing table for router R1, using the configuration
in Figure below.
Solution
91
Example
Show the forwarding process if a packet arrives at R1 in Figure on
last slide 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.
92
Address aggregation
93
Datagram Forwarding
Network #
Netmask
18.0.0.0
255.0.0.0
1
128.32.0.0
255.255.0.0
0.0.0.0
0.0.0.0
3
dest: 18.26.10.0