Computer Network Module 3
Computer Network Module 3
Computer Network Module 3
(BCSE 3306)
Lecture Notes
Module III
Ajit K Nayak
[email protected]
Department of Computer Science Engineering &
Application
Out Line of Module III
Network Layer, Network Layer Protocols
Transport Layer, Congestion control
Quality of service
123.0.0.0
Class A
Computer Networking / Module III/ AKN / 10
Network Address
...
221.45.71.255
221.45.71.0 R
Class C network
Computer Networking / Module III/ AKN / 13
Special Addresses contd.
This Host Addresses All 0s All 0s
Used by a DHCP client at bootstrap as a source address to
address
It is always a Class A address regardless of the network
?.?.?.? 221.45.71.64 221.45.71.99
255
.25
5.2
55. ...
0.0 255
.0.0 Bootstrap server
221.45.71.0 B
221.45.71.1
Class C network
Computer Networking / Module III/ AKN / 14
Special Addresses contd.
Loop Back Addresses
Used by a host to communicate with itself without
a special network interface
This is the address with first byte as 127 and the
packet never goes out of the machine
P1 Host P2
127 Any
127.0.0.1
...
R 141.14.0.0
.2.20
Without subnet
.7.96
141.14.0.0
.2 141.14.2.0
R .7 141.14.0.0
.22
141.14.7.0
With subnet
141.14.0.0
.22.90
141.14.22.0
Computer Networking / Module III/ AKN / 20
Subnetting
Rest of the Internet still fills as if one
network. i.e packet destinated at 141.14.2.21
still reach at router R and it is aware of three
subnets.
Last two octets define two things
1. subnetid 2. hostid
Delivery of packets now involve three steps
1. Delivery to the network
2. Delivery to the subnet
3. Delivery to the host
Computer Networking / Module III/ AKN / 21
Example 1
Q. Design 8 subnets from 211.77.20.0
Ans. Taking 3 bits for subnet in last byte, remaining 5 bits are
used for hostid
Addressing Authorities
IANA: Internet Assigned Number Authority upto 1998
ICANN: Internet Corporation for Assigned Names and Numbers
Computer Networking / Module III/ AKN / 26
Dynamic Address configuration
Each computer that is connected to Internet must have
following information
Its IP address
Subnet mask
Router/gateway’s IP address
Name server’s IP address
These information are maintained in operating system and
stored in disk
These information may be acquired by assigning static values
or can also be obtained dynamically when needed
DHCP is designed to assign these information dynamically (on
demand)
It is a client/server program, when client sends a request to
server, server selects an IP address from the pool of unused IP
address for a negotiable period of time (lease time)
Computer Networking / Module III/ AKN / 27
Dynamic Host Configuration Protocol
TRANSITION STATES
Initializing state
Client broadcasts a
DHCPDISCOVER message
Selecting state
All the DHCP servers
replies with a
DHCPOFFER message,
which contains IP
address, lease time etc.
client chooses on of the
offers. Client now sends a
DHCPREQUEST message
Requesting state
Remains in this state till it gets the DHCPACK, which creates a binding of
physical and logical address
Computer Networking / Module III/ AKN / 28
DHCP contd.
Bound state
After using 50% of the time, client requests for renewal by
sending another DHCPREQUEST, or client can cancel the
lease and go back to the initializing state
Renewing state
If it receives the DHCPACK then the timer is reset or client
goes again for rebinding. If not received till 87.5% of lease
time then goes to rebinding state
Rebinding state
It remains in this state till it receives a DHCPNAK or lease
expires, client goes to initializing state for a fresh process or
goes to bound state if DHCPACK is received
Computer Networking / Module III/ AKN / 29
Network Address Translation
Home users and small business can be connected to Internet
via an ADSL or cable modem and every body needs one or
more IP addresses
Due to shortage of IP addresses, the demand may be full filled
by using the private network address through Network address
translation method (NAT)
NAT enables a user to have large set of addresses (private)
internally and one or a small set of addresses externally
(global)
Address translation
Computer Networking / Module III/ AKN / 30
NAT contd.
Address translation
All out going packets go through
the NAT router, which replaces
destination address in the packet
with global NAT address.
Similarly all incoming packets
also pass through the NAT
router, which replaces the
destination address with
appropriate private address
using Translation table
Private Private External External Transport
Address Port Address Port Protocol
172.18.3.1 1400 25.8.3.2 80 TCP
172.18.3.2 1401 25.8.3.2 80 TCP
... ... ... ... ...
Computer Networking / Module III/ AKN / 31
Routing techniques
Usually routing uses an Internet routing table on each
machine that stores information about possible
destinations and how to reach them
Next Hop Routing
20.0.0.5 30.0.0.6
network network network
10.0.0.0 Q 20.0.0.0 R 30.0.0.0
10.0.0.5 20.0.0.6
Dest Next hop 30.0.0.7
S
10.0.0.0 20.0.0.5 40.0.0.7
20.0.0.0 Direct network
30.0.0.0 Direct 40.0.0.0
40.0.0.0 30.0.0.7
Computer Networking / Module III/ AKN / 32
Network-Specific Routing
Instead of one entry for each destination host,
we maintain one entry for total network
B
Computer Networking / Module III/ AKN / 34
Default Routing
Default Routes
In this type of routing , it looks in the routing table for the
destination network. If no route appears in the table, the
routing routines send the datagram to a default router
It is useful when the network has a small set of local
addresses and only one connection to the rest of internet
network network
Q
10.0.0.0 20.0.0.0
• Routing table Destination Next hop
S for a host on
20.0.0.0 Q
network 10.0.0.0
Rest of Default S
Internet
Computer Networking / Module III/ AKN / 35
Static versus Dynamic Routing Tables
Routing tables may be constructed statically or
dynamically. The success of routing depends on the
consistency of routing table information
Static Routing table
Information entered manually, can be used for small intranet
that does not change very often. It is not a good choice in
Internet where information changes very often
Dynamic Routing table
Updated periodically using the dynamic routing protocols like
RIP, OSPF, or BGP etc.
Dynamic routing is preferred over static routing as the
updation of routing table is done dynamically thus providing
a consistent routing mechanism.
Computer Networking / Module III/ AKN / 36
Hierarchical Routing
It is not possible to keep information about each host and or
each network in the routing table of each Internet router
To solve this problem we maintain hierarchical routing.
According to this technique the we maintain partial information
in routers
e.g. if the block assigned to one ISP is a.b.c.d/n and it may
create many subnets of e.f.g.h/m for each of its customers, the
rest of the Internet does not have to be aware of this division.
i.e. all customer of that ISP are defined as a.b.c.d/n to the rest
of Internet
There is only one entry needed for this ISP
The router inside ISP recognizes the sub-blocks and routes the
packets to the destination
To reduce the size of table further the hierarchical routing may
be included. i.e. The routers of ISPs outside Europe will have
only one entry for packets to Europe in their routing tables.
Computer Networking / Module III/ AKN / 37
Internet Protocol (IPV4:RFC-791)
Connection less delivery system
Internet service consists of an unreliable, best-effort,
connection less packet delivery system.
Unreliable because delivery is not guaranteed.
i.e.The packet may be lost, duplicated, delayed or delivered
out of order but the service will not detect such conditions,
nor will it inform the sender or receiver.
A sequence of sent from one computer to another may
travel over different paths, or some may be lost while others
are delivered.
It is best-effort delivery because the internet software
makes an earnest attempt to delivery packets
i.e. the internet does not discard packets always.
Unreliability arises only when resources are exhausted or
underlying networks fail.
Computer Networking / Module III/ AKN / 38
Internet Protocol (contd.)
The Internet protocol defines unreliable, connection less
delivery mechanism ( IP )
It defines the basic unit of data transfer used throughout the
ARP Packet
Refinements
If the target machine is down or too busy to
accept the request? i.e sender may not receive a
reply (1) or it is delayed(2)
Retransmit the request for (1) or it restores the
original outgoing packet till it resolves the address
Computer Networking / Module III/ AKN / 63
ARP Implementation
ARP Cache
After receiving an ARP reply, it saves the IP address and
corresponding hardware address in its cache for successive
lookups
But problem occurs if receiver crashes in between and
source gets no information but keep on sending
To resolve above problem a timer is used, when it expires
the information in the cache is erased and normal procedure
starts again
Another refinement possible is, senders IP-Physical address
binding can also be updated in receivers cache before
processing the ARP request
• 128 bits are divided into eight sections of hexadecimal nos, each 2
byte long sections separated by colons
• The address may be abbreviated, i.e the leading zeros can be
omitted (not trailing zeros)
Unspecified address is used when a host does not know its own
address
Loopback address is used by a host to test itself
Compatible address is used during the transition from IPv4 to
IPv6. i.e. when passing from IPv6 to IPv6 via IPv4 network
Mapped address is also used during transition when sending
from Ipv6 to IPv4 computer
Computer Networking / Module III/ AKN / 88
Local addresses
Used when an organization wants to use IPv6
without being connected to Internet
IP IP
• At sending side UDP accepts messages from different processes,
differentiated by their port nos.Then it is passed to IP layer
• At receiving side UDP receives datagrams from IP. After error
checking drops the header and delivers to the appropriate processes
Computer Networking / Module III/ AKN / 126
Well known ports used for UDP
Read bytes
i.e. It describes the service
Write bytes
provided to appl. process.
TCP Send TCP Recv ¾The pkts exchanged between
buffer buffer TCP peers are called segments
segment segment
TCP has three mechanisms to trigger the transmission of a
segment
1. TCP maintains a variable, maximum segment Size (MSS), and it sends a
segment as soon as it has collected MSS bytes from sending process
2. Sending process invokes push operation to effectively flush the buffer of
unsent bytes
3. A timer that periodically fires; the resulting segment contains as many
bytes as are currently in buffer
Computer Networking / Module III/ AKN / 135
TCP Segment Header Format
0 4 10 16 19 24 31
Src Port Dst Port
Sequence Number
Acknowledgement
HLen unused Flags Advertised window
Checksum Urgent pointer
Options (variable length) Padding
Data
...
Sender Receiver
Ack+advWin
Computer Networking / Module III/ AKN / 137
TCP Header Format Explanation
Flags: 6 bits, when set it is understood as follows
5. SYN: Synchronize seq. nos during connection
6. FIN: Terminate the connection
4. RESET: reset the connection
3. PUSH: request for push
1. URG: urgent pointer is valid
2. ACK:
Urgent pointer specifies the position, where the urgent
data ends.
Options: TCP header can have 40 bytes of optional
information
Computer Networking / Module III/ AKN / 138
TCP Header Options
Max Seg Size(MSS): 4bytes determined at the
time of connection establishment
Window Scale factor:3bytes
Used to increase the window size
New window size=window size × 2scaleFactor
Largest value possible for scale factor is 16
i.e. 216 × 216 = 232 max size of seq. number
Time Stamp: 10 bytes
Used to calculate round trip time
Retransmiss SampleRTT
ion AC K
Retran
A CK smissio
n
Bursty:
The datarate changes suddenly in a
very short period of time. This type of traffic
creates congestion in a network.
Leaky Bucket
The idea is to have a constant bit rate traffic in the
network in spite of bursty data coming from source.
Reservation merging
Resources are not reserved for each receiver in a
flow.
Reservation is merged to larger of the two (or
more) requests
As different qualities for multimedia is required by
different receivers, thus different requirements for
the same flow Computer Networking / Module III/ AKN / 183
Reservation Styles
When there are more than one flow, the router needs
to make a reservation to accommodate all of them
RSVP defines three types of reservation styles
Wild card Filter: router creates a single reservation
for all senders based on largest request. This is
used when flow from different receivers do not
occur at the same time
Fixed Filter: router creates a distinct reservation for
each flow. It is used when there is a high
probability that from different receivers occurs at
the same time
Shared Explicit: creates a single reservation which
can be shared by a set of flows
Computer Networking / Module III/ AKN / 184
Differtiated services
Problems with integrated services
Scalability
This model requires that each router keep information for
each flow, which is impractical as load on routers will
increase
Service type limitation
It provides two services 1. Guaranteed and control load
Solutions
The routers do not have to store information about flows.
i.e. The applications, or hosts, define the type of service
they need each time they send a packet
The per-flow service is changed to per class service.
The router routes the packet based on the class of service
This is called DifferentiatedComputer
services
Networking / Module III/ AKN / 185
Differentiated service features
Each packet contains a field called DS field.
The value of this field is set by the first router
designated as the boundary router.
contains two sub-fields:
Differentiated services code point: defines per hop behavior
(PHB) and an unused field
DE PHB(default PHB) same as TOS.
EF PHB (expedited forwarding) provides following services
like Low loss, Low latency, Ensured bandwidth.
AF PHB (Assured forwarding) delivers the packet with a high
assurance as long as the class traffic does not exceed the
traffic profile of the node. The users of the network need to
be aware that some packets may be discarded
Computer Networking / Module III/ AKN / 186
Traffic conditioner
The DS node uses traffic conditioners like
Meters: checks to see if the incoming flow matches the
negotiated traffic profile
Marker: can remark a packet that is using best-effort delivery
or down-mark a packet based on information received from
the meter.
Shaper: reshapes the traffic if not compliant with negotiated
traffic
Dropper: discards a packet if flow severely violates the
negotiated profile
Thank You
Computer Networking / Module III/ AKN / 188