Strict Source Routing

Download Report

Transcript Strict Source Routing

TDC 365
Network Interconnections
Technologies
Lecture #4 Notes
Spring, 2009
TDC365-03
1
Lecture 4 Topics

IP Protocol and Operations (Chapter 8)
IP Header and packet format
 Packet Fragmentation
 options
 checksum


Internet Control Message Protocol (ICMP)
(Chapter 9)
TDC365-03
2
Internet Protocol





Network layer protocol (layer 3)
The Internet is named after this protocol
“Unreliable” best effort service
Connectionless
Packets in IP layer are called “Datagrams”


a variable-length packet consisting of two parts: header
and data.
The header is 20 to 60 bytes in length and contains
information essential to routing and delivery.


Header has a fixed part (20 bytes) and variable part of options
(maximum 40 bytes)
Each datagram is handled independently and can follow
different paths to the destination
TDC365-03
3
3
Position of IP
in TCP/IP protocol suite
TDC365-03
4
4
IP Field Format
TDC365-03
5
5
IP Header Fields

Version: IP protocol version.
We are currently on IP version 4. Soon the
Internet may be moved to IP version 6.
 4 bit field – value 0100


IP Header Length(HLEN)
4 bit field
 Length of IP header in 32-bit words.

Min. value = 5 (20 bytes)
 Max. value = 15 (60 bytes)

TDC365-03
6
Total Length Field

Total Length field: Length of IP packet in bytes (including header)


maximum 65535 (216 -1) bytes
Why do we need the Total Length Field?


For Ethernet to work properly, this portion must be at least 46 bytes long.
We need the Total Length field in IP to know the actual length of data, since
IP datagram can be less than 46 bytes, and would require padding.
TDC365-03
7
Protocol Field

Protocol field


IP carries PDUs of multiple protocols (e.g. TCP, UDP,
ICMP)
The Protocol field contains a code that tells them apart
TDC365-03
8
Service Type
or Differentiated Services
Not all finalized, Read
yourself (pg 183)
TDC365-03
9
Type of Service

Indicates packet
precedence and path
optimization type (currently
ignored by ALL routers):

Default Type of Service
3 bit precedence - 0 normal,
7 control packet (has never
been used in v4)
1000 D bit – Minimize Delay
0100 T bit – Maximize
Throughput
0010 R bit – Maximize
Reliability
0001 C bit – Minimize Cost
TDC365-03
10
Packet Size Calculation
example 1

Question:
In an IP 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
bytes in the header is 8 × 4 or 32 bytes. The first 20
bytes are the base header, the next 12 bytes are the
options.
TDC365-03
11
Packet Size Calculation
Example 3
example 2

Question:


In an IP packet, the value of HLEN is 516
and the value of the total length field is 002816 . How
many bytes of data are being carried by this packet?
Solution

The HLEN value is 5, which means the total number of
bytes in the header is 5 × 4 or 20 bytes (no options). The
total length is 40 bytes, which means the packet is carrying
20 bytes of data (40 − 20).
TDC365-03
12
IP Header Fields (con’t)

Identification / Fragment Offset:


Time to Live:


Allows error checking of IP packets
Source Address:


Max. number of routers this IP packet may pass through. This field
is decremented by each router the packet passes through. If it
reaches zero, packet will be discarded.
Header Checksum:


used to identify fragments that are formed when an IP packet needs
to be broken up into smaller packets
4-byte IP source address for this packet
Destination Address:

4-byte IP destination address for this packet
TDC365-03
13
Example 4
An IP packet has arrived with the first few hexadecimal digits as
shown below:
45000028000100000102 . . .
How many hops can this packet travel before being dropped? The data
belong to what upper layer protocol?
Solution
To find the time-to-live field, we skip 8 bytes (16 hexadecimal digits).
The time-to-live field is the ninth byte, which is 01. This means the
packet can travel only one hop. The protocol field is the next byte
(02), which means that the upper layer protocol is IGMP (see slide 7).
TDC365-03
14
IP Packet Fragmentation



The format and size of a frame
depends on the protocol used by the
physical network. Each layer 2
protocol has a maximum
transmission unit (MTU) size (max.
frame data size)
If a router determines that an IP
packet length exceeds the MTU for
an outgoing port, it will fragment the
packet (that is, break it into smaller
packets)
Fragments are reassembled by IP
software at destination host.
TDC365-03
15
IP Header Fields Used for
Fragmentation

Identification:


Flags:



This is a random value chosen by the sender. If a packet is fragmented, the
same ID value is copied into all fragments.
Don’t Fragment (DF) bit - Set to 1 if this packet should not be fragmented, 0
otherwise
More Fragments (MF) bit – Set to 1 if packet has been fragmented and this is
not the last fragment, 0 otherwise.
Fragment Offset:





13 bit field shows relative position of this fragment with respect to the whole
datagram
Highest value can be 213-1 = 8191
If this is a fragment packet, this is set to (byte offset of this packet data in the
original packet data) / 8
Note that this means that all fragments (except possibly last) must contain an
exact multiple of 8 bytes of data.
This means that we can fragment a datagram of maximum length of 65535
(8192 * 8)
TDC365-03
16
MTU (Maximum Transfer Unit)
L2
Flags field
(Mainly for diagnostic purpose)
= 0  this is the last fragment
= 1  more fragments to follow
TDC365-03
17
IP Fragmentation Example

Question:


Assume a router receives an IP packet containing 4000
bytes of data (not including IP header). The Routing table
indicates this should be forwarded onto a subnet with MTU
of 1420 bytes. How should this this packet be fragmented
to enable L2 subnet transmission?
Solution:

The 4000 bytes is broken into fragments as follows (IP
header size not included):



Fragment #1: 1400 bytes of data
Fragment #2: 1400 bytes of data
Fragment #3: 1200 bytes of data
TDC365-03
18
Fragmentation Example
TDC365-03
19 19
IP Fragmentation Example

Further assume that Fragment #2 (containing
1400 data bytes) is later sent over an L2
subnet with MTU of 820 bytes.
Fragment #2.1 contains 800 data bytes
 Fragment #2.2 contains 600 data bytes

TDC365-03
20
Detailed
fragmentation
example
Identification
Flag
More Fragment
Total length
Fragment Offset
TDC365-03
21 21
Categories of Options
TDC365-03
22 22
IP Options Format
Used for testing and debugging

Record Route


Strict Source Routing


Traverse the list of routers
in order
Timestamp

TDC365-03
Gives complete path
Loose Source Routing


Add router address to the
header
Add time stamp as well as
router address
23 23
No-Op and End-Op
End of option
TDC365-03
24 24
Record Route
Byte number
of the first
empty entry
Determines
how many
addresses to
be recorded
1st 3 bytes of overhead
1st entry starts at 4
Total 15 bytes
TDC365-03
25
Source Routing



Normally IP routing is dynamic where each router
makes its own decision about the next hop router
Applications have no control, nor are concerned
In source routing, on the other hand, the sender
specifies the route

Strict source routing


Loose source routing


Sender specifies exact path – ICMP error if unspecified router is
visited
Sender specifies a list of IP addresses that the datagram must
traverse, but the datagram can also pass thru other routers
The destination address changes at each hop!!
TDC365-03
26 26
Strict Source Routing




When an application receives
data that was source routed, it
should supply a reversed route
by fetching the value of the
received route
STEP 1 Router compares
destination IP withits incoming
IP
STEP 2: Router swaps IP
address withoutgoing IP and
forwards packet
STEP 3: Router also changes
dest addrin IP header
TDC365-03
27
Timestamp
•To record the time at each router, expressed in ms from midnight, Universal time
•Estimate, since router clocks may not be synchronized
Figure 8-21
TDC365-03
28 28
IP Header Checksum

Sender IP Checksum calculation:
Split IP header into 16-bit fields
 Add fields together (set Checksum to 0)
 Truncate result to 16 bits
 1-s Complement result
 Put into Checksum field, send packet


Receiver Checksum check:
Perform same calculation (with nonzero
checksum)
 If result is not zero, discard IP packet

TDC365-03
29
Checksum Concept
TDC365-03
30
Checksum Example
1’s complement
TDC365-03
31
Read Yourself..

Section 8.5 – IP Package

Especially the algorithms
Processing Module
 Fragmentation Module
 Reassembly Module

TDC365-03
32 32
ICMP
(Internet Control Message Protocol)

Companion to IP


What happens when errors occur in delivering
IP packets?


Network layer protocol, but encapsulated in IP
datagrams
ICMP messages are used for Error Reporting
What if a host needs more information about
the network?

ICMP messages are used for Status Queries
TDC365-03
33
ICMP Design
TDC365-03
34
ICMP
Encapsulation
General format of ICMP messages
TDC365-03
35
Error Report Encapsulation

First 8 bytes of data are
added


contains the port
information from transport
layer (TCP or UDP)
So that source can inform
the transport protocols
about the error
TDC365-03
36
ICMP Messages
Error-reporting messages
Query messages
TDC365-03
37
ICMP messages
ICMP messages
TDC365-03
38
ICMP Error Reports


Read more yourself –pgs 214-216
Sent by router (typically) or host back to the Source Address on data
packet when error occurs – includes header of error-causing packet.

Destination Unreachable




Source Quench




Whenever a router decrements a datagram with a time-to-live (no. of hops) value to
zero, it discards the datagram and sends a time-exceeded message
All fragments did not arrive before fragment reassembly timeout
Parameter Problem


informs the source that a datagram has been discarded due to congestion in a
router or the destination host
Used for limited flow control
Time Exceeded


IP packet destination does not exist or cannot be reached
One case is Fragmentation required, but DF bit is set
Another is source routing cannot be accomplished
Error in header parameters in datagram
Redirection

A better route to destination is known
TDC365-03
39
Redirection



Hosts do not take part in routing update process (ch. 14)
used by routers
The static routing table of the host might not be efficient
‘Wrong’ router forwards datagram to correct router and
sends a redirection message to host in the local network
‘Wrong’ router
‘Correct’ router
TDC365-03
40
ICMP Query Messages

Sent by host (typically) to diagnose network

Echo Request / Reply


Time Stamp Request / Reply


“ping” with timestamps (ping –s)
Address Mask Request / Reply


Used for “ping”
Asks for IP Subnet Mask for current subnet
Router Solicitation / Advertisement

To find local router
TDC365-03
41
Ping and Traceroute

Ping
To find if a host is alive and responding
 -R for record route


Traceroute
Trace route from source to destination
 -g for loose source routing, -G for strict source
routing

TDC365-03
42
Traceroute Operation
A sends to B a UDP msg with TTL=1
R1 decrements TTL to 0, discards the packet,
sends ‘time exceeded’ ICMP msg to A with its own IP
R2 decrements TTL to 0, discards the packet,
sends ‘time exceeded’ msg to A with its own IP
A then sends to B
a UDP msg with TTL=2
A sends to B
a UDP msg with TTL = n and
unsupported port
B decrements TTL to 0,
sends ‘destination unreachable’ msg to A
with its own IP
TDC365-03
43