Unit V
Unit V
...
6.Avoid static options and parameters
7.Look for good design (not perfect)
8.Strict sending, tolerant receiving
9.Think about scalability
10.Consider performance and cost
The Network Layer in the
Internet
1. Make sure it works: Do not finalize the design or standard
until multiple prototypes have successfully communicated
with each other.
2. Keep it simple: When in doubt, use the simplest solution. If a
feature is not absolutely essential, leave it out, especially if
the same effect can be achieved by combining other features.
3. Make clear choices: If there are several ways of doing the
same thing, choose one.
4 . Exploit modularity: This principle leads directly to the idea
of having protocol stacks, each of whose layers is
independent of all the other ones. In this way, if
circumstances that require one module or layer to be changed,
the other ones will not be affected.
5. Expect heterogeneity: Different types of hardware,
transmission facilities, and applications will occur on any
large network. To handle them, the network design must be
simple, general, and flexible.
6. Avoid static options and parameters: If parameters are
unavoidable (e.g., maximum packet size), it is best to have the
sender and receiver negotiate a value than defining fixed
choices.
7. Look for a good design; it need not be perfect: Often the
designers have a good design but it cannot handle some weird
special case. Rather than messing up the design, the designers
should go with the good design and put the burden of working
around it on the people with the strange requirements.
8. Be strict when sending and tolerant when receiving: In other
words, only send packets that rigorously comply with the
standards, but expect incoming packets that may not be fully
conformant and try to deal with them.
9. Think about scalability: If the system is to handle millions of
hosts and billions of users effectively, no centralized databases
of any kind are tolerable and load must be spread as evenly as
possible over the available resources.
10.Consider performance and cost: If a network has poor
performance or outrageous costs, nobody will use it.
• Let us now leave the general principles and start looking at the
details of the Internet's network layer. At the network layer,
the Internet can be viewed as a collection of sub networks or
Autonomous Systems (ASes) that are interconnected.
• There is no real structure, but several major backbones exist.
These are constructed from high-bandwidth lines and fast
routers. Attached to the backbones are regional (midlevel)
networks, and attached to these regional networks are the
LANs at many universities, companies, and Internet service
providers.
The Network Layer in the Internet (2)
Computer 20-15
Networks
• IP Destination Address (32 bits): The IP Destination
Address field contains a 32-bit binary value that represents the
packet destination Network layer host address.
• IP Source Address (32 bits): The IP Source Address field
contains a 32-bit binary value that represents the packet source
Network layer host address.
• Options (variable): The Options field is padded out to a
multiple of four bytes. Originally, five options were defined
The current complete list is now maintained on-line at
www.iana.org/assignments/ip-parameters.
• The Security option tells how secret the information is.
• The Strict source routing option gives the complete path
from source to destination as a sequence of IP
addresses. The datagram is required to follow that exact
route.
• The Loose source routing option requires the packet to
traverse the list of routers specified, and in the order specified,
but it is allowed to pass through other routers on the way.
• The Record route option tells the routers along the path to
append their IP address to the option field. This allows system
managers to track down bugs in the routing algorithms.
• Finally, the Timestamp option is like the Record route option,
except that in addition to recording its 32-bit IP address, each
router also records a 32-bit timestamp. This option, too, is
mostly for debugging routing algorithms.
What is an IP Address?
128.143.137.144
Example
• Example:
128.143 137.144
IP address formats.
IP Addresses (2)
Special IP addresses.
IPv4 Addresses
• An IP address is a 32-bits long
• The IP addresses are unique and universal
• The address space of IPv4 is 232 or 4,294,967,296
• Binary notation: 01110101 10010101 00011101 00000010
• Dotted-decimal notation: 117.149.29.2
Example
• Change the following IP addresses from binary notation to dotted-decimal
notation.
a. 10000001 00001011 00001011 11101111
b. 11111001 10011011 11111011 00001111
We replace each group of 8 bits with its equivalent decimal number and add
dots for separation:
a. 129.11.11.239
b. 249.155.251.15
Classful addressing
• In classful addressing, the address space is divided into five classes: A, B, C, D, E
• A new architecture, called classless addressing was introduced in the mid-1990s
Classful Addressing:
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.
Classes and Blocks
• In classful addressing, a large part of the available addresses were wasted
Netid and Hostid
• IP address in classes A, B, and C is divided into netid and hostid
Mask: Default Mask
• The length of the netid and hostid is predetermined in classful addressing
• Default masking
• CIDR (Classless Interdomain Routing) notation
Subnetting
• Divide a large block of addresses into several contiguous groups and assign
each group to smaller networks called subnets
• Increase the number of 1s in the mask
Supernetting
• Combine several class C blocks to create a larger range of addresses
• Decrease the number of 1s in the mask (/24 /22 for C addresses)
Computer 19-33
Networks
Subnets
Computer 19-37
Networks
Mask and Address Blocks
• In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n in which x.y.z.t
defines one of the addresses and the /n defines the mask.
• The first address in the block can be found by setting the rightmost 32 − n bits to 0s
• The last address in the block can be found by setting the rightmost 32 − n bits to 1s
• The number of addresses in the block can be found by using the formula 2 32−n
• Example: 205.16.37.39/28
– The binary representation is 1100110 00010000 00100101 00100111
– If we set 32 − 28 rightmost bits to 0, we get 11001101 00010000 00100101 00100000
205.16.37.32 (First address)
– If we set 32 − 28 rightmost bits to 1, we get 11001101 00010000 00100101 00101111
205.16.37.47 (Last address)
– The value of n is 28, which means that number of addresses is 2 32−28 or 16
Computer 19-40
Networks
How to determine the number of subnets and the number
of hosts per subnet?
• From 8 bits if 3 is allocated for subnet and 5 for host.
For example if you borrow three bits from the host portion
of the address use the number of subnets formula to
determine the total number of subnets gained by
borrowing the three bits. This would be 2^3 or 2 x 2 x 2 =
8 subnets.
• The first address in a block is normally not assigned to any device; it is used as
the network address that represents the organization to the rest of the world
Hierarchy
Two-Level Hierarchy: No Subnetting
Computer 20-52
Networks
IPv6 Datagram
• IPv6 defines three types of addresses: unicast, anycast (a group of
computers with the same prefix address), and multicast
• IPv6 datagram header and payload
Computer 20-53
Networks
IPv6 Datagram Format
Computer 20-54
Networks
IPv6 Header
• Version: IPv6
• Priority (4 bits): the priority of the packet with respect to traffic congestion
• Flow label (3 bytes): to provide special handling for a particular flow of data
• Payload length
• Next header (8 bits): to define the header that follows the base header in the
datagram
• Hop limit: TTL in IPv4
• Source address (16 bytes) and destination address (16 bytes): if source
routing is used, the destination address field contains the address of the
next router
Computer 20-55
Networks
Priority
• IPv6 divides traffic into two broad categories: congestion-controlled and
noncongestion-controlled
• Congestion-controlled traffic
• Noncongestion-controlled traffic
Computer 20-56
Networks
Extension Headers
5-69
IPv4 addresses are 32 bit length. IPv6 addresses are 128 bit length.
IPv4 addresses are binary numbers represented in IPv6 addresses are binary numbers represented in
decimals. hexadecimals.
IPSec support is only optional. Inbuilt IPSec support.
Fragmentation is done by sender and forwarding
Fragmentation is done only by sender.
routers.
Packet flow identification is available within the IPv6
No packet flow identification.
header using the Flow Label field.
Checksum field is available in IPv4 header. No checksum field in IPv6 header .
No option fields, but IPv6 Extension headers are
Options fields are available in IPv4 header .
available
Internet Protocols
1. ICMP
2. ARP
3. RARP
4. BOOTP
5. DHCP
Internet Control Message
Protocol
• The operation of the internet is monitored by the
routers.
• When something unexpected occurs, the event is
reported by ICMP, which is also used to test the
internet.
Internet Control Message
Protocol
5-61
Operation of DHCP.
Congestion Control
• When one part of the subnet (e.g. one or
more routers in an area) becomes
overloaded, congestion results.
• Because routers are receiving packets faster
than they can forward them, one of two things
must happen:
– The subnet must prevent additional packets from
entering the congested region until those already
present can be processed.
– The congested routers can discard queued
packets to make room for those that are arriving.
Factors that Cause
Congestion
• Packet arrival rate exceeds the outgoing
link capacity.
• Insufficient memory to store arriving
packets
• Bursty traffic
• Slow processor
Congestion Control vs Flow
Control
• Congestion control is a global issue –
involves every router and host within
the subnet
• Flow control – scope is point-to-point;
involves just sender and receiver.
Congestion Control
• Algorithms
General Principles of Congestion Control
• Congestion Prevention Policies
• Congestion Control in Virtual-Circuit
Subnets
• Congestion Control in Datagram Subnets
Congestion
5-26
• Warning Bit
• Choke packet
• Hop-by-Hop Choke packet
• Load Shedding
• Jitter Control
Warning bit
• The old DECNET architecture signaled the warning state by
setting a special bit in the packet’s header.
• When the packet arrived at its destination, the transport entity
copied the bit into the next acknowledgement sent back to the
source. The source then cut back on the traffic.
• As long as the router was in the warning state, it continued to set
the warning bit, which meant that source continued to get
acknowledgements with it set.
• The source monitored the fraction of acknowledgements with
the bit set and adjusted its transmission rate accordingly.
• As long as warning bits continued to flow in, the source
continued to decrease its transmission rate.
Warning Bit
80
Source based approach
• Warning bit
– Output line in warning state
• Warning bit set in header
• Destination copies bit into next ack
• Source cuts back traffic
– Algorithm at source
• As long as warning bits arrive: reduce traffic
• Less warning bits: increase traffic
– Problems
• voluntary action of host!
• correct source selected?
– Used in
• DecNet
• Frame relay
Network layer - 81
Choke Packet
• A more direct way of telling the source to slow down.
• A choke packet is a control packet generated at a
congested node and transmitted to restrict traffic flow.
• The source, on receiving the choke packet must
reduce its transmission rate by a certain percentage.
• An example of a choke packet is the ICMP Source
Quench Packet.
Source based approach
• Choke packet
– In case of overload: router sends choke packet to host causing
the overload
– Host receiving choke packet
• reduces traffic to the specified destination
• ignores choke packets for a fixed interval
• new choke packets during next listening interval?
– Yes: reduce traffic
– No: increase traffic
– Problems:
• voluntary action of host!
• correct host selected?
Network layer - 83
Source based approach
• Choke packets:
– Example showing slow
reaction
– Solution: Hop-by-Hop
choke packets
Network layer - 84
Source based approach
• Hop-by-Hop choke
packets
– Have choke packet take
effect at every hop
– Problem: more buffers
needed in routers
Network layer - 85
Hop-by-Hop Choke Packets
• Over long distances or at high speeds choke
packets are not very effective.
• A more efficient method is to send to choke
packets hop-by-hop.
• This requires each hop to reduce its
transmission even before the choke packet
arrive at the source.
Hop-by-Hop
Choke
Packets
(a) A choke packet that
affects only the
source.
88
Load shedding
• Throw away packets that cannot be handled!!
• Packet selection?
– Random
– Based on application
• File transfer: discard new packet
• Multimedia: discard old packet
– Let sender indicate importance of packets
• Low, high priority
• Incentive to mark a packet with low priority
– Price
– Allow hosts to exceed agreed upon limits
• Random early detection …
Network layer - 89
Load shedding
• Throw away packets that cannot be handled!!
• Packet selection?
• Random early detection
– Discard packets before all buffer space is exhausted
– Routers maintain running average of queue lengths
– Select at random a packet
– Inform source?
• Send choke packet? more load!!
• No reporting
– When does it work?
• Source slows down when packets are lost
Network layer - 90
Random Early Discard
(RED)
• This is a proactive approach in which the
router discards one or more packets
before the buffer becomes completely full.
• Each time a packet arrives, the RED
algorithm computes the average queue
length, avg.
• If avg is lower than some lower threshold,
congestion is assumed to be minimal or
non-existent and the packet is queued.
91
RED, cont.
• If avg is greater than some upper
threshold, congestion is assumed to be
serious and the packet is discarded.
• If avg is between the two thresholds, this
might indicate the onset of congestion.
The probability of congestion is then
calculated.
92
Congestion: jitter control
Network layer - 93
Congestion: jitter control
• Jitter = variation in packet delay
• Compute feasible mean value for delay
– compute expected transit time for each hop
– router checks to see if packet is
• behind
• ahead schedule
– behind: forward packet asap
– ahead: hold back packet to get it on schedule again
• Buffering? Depends on characteristics:
– Video on demand: ok
– Videoconferencing: nok
Network layer - 94
Traffic Shaping
• Another method of congestion control is to “shape” the
traffic before it enters the network.
• Traffic shaping controls the rate at which packets are sent
(not just how many). Used in ATM and Integrated
Services networks.
• At connection set-up time, the sender and carrier negotiate
a traffic pattern (shape).
• Two traffic shaping algorithms are:
Leaky Bucket
Token Bucket
The Leaky Bucket Algorithm
• The host injects one packet per clock tick onto the network.
This results in a uniform flow of packets, smoothing out
bursts and reducing congestion.
• When packets are the same size (as in ATM cells), the one
packet per tick is okay. For variable length packets though, it
is better to allow a fixed number of bytes per tick. E.g. 1024
bytes per tick will allow one 1024-byte packet or two 512-
byte packets or four 256-byte packets on 1 tick.
Leaky Bucket
Implementation
1. n>front of queue
1000>200(true)
Therefore n=1000-200=800
Packet size of 200 is sent to the network.
2. Now the Queue is 200 700 500 450 400
800>400(front of queue) so 800-400=400
Packet size of 400 is sent
3. Now the queue becomes 200 700 500 450
400< 450 i.e the front of queue is greater than current ‘n’ value
Therefore packet size 450 can not sent. The procedure is stopped and we
initialize n=1000 on another tick of clock.
This procedure is repeated until all the packets are sent to the network.
Token Bucket Algorithm
• In contrast to the LB, the Token Bucket
Algorithm, allows the output rate to vary,
depending on the size of the burst.
• In the TB algorithm, the bucket holds tokens. To
transmit a packet, the host must capture and
destroy one token.
• Tokens are generated by a clock at the rate of one
token every t sec.
• Idle hosts can capture and save up tokens (up to
the max. size of the bucket) in order to send larger
bursts later.
The Token Bucket Algorithm
5-34