3 TCP-IP Basic
3 TCP-IP Basic
3 TCP-IP Basic
Shyamalendu Kandar
internet vs Internet
internet (small ‘i’):
Connecting many computer
network together.
use of gateways that provide a
common method of routing
information packets between
the networks.
is a logical network, which is
built out of a collection of
physical networks.
Internet:
global internetwork to which a large percentage of networks
are now connected.
is one of internets, and is the largest one.
In some of the first printed mentions of the Internet, like
many other US government projects of the period, it was
referred to in all caps as INTERNET.
----Some guides specify -----capitalized as a noun but not
capitalized as an adjective, e.g., "internet resources"
TCP/IP basic
• designed in 1970s by 2 DARPA scientists—Vint Cerf and Bob Kahn
basic communication protocol of the
Internet.
higher layer, Transmission Control Protocol.
manages the assembling of a message or file
into smaller packets that are transmitted over
the Internet and received by a TCP layer that
reassembles the packets into the original
message.
The lower layer, Internet Protocol.
It handles the address part of each packet so
Cerf (left) and Kahn being awarded the Presidential Medal Of Freedom
that it gets to the right destination. by Former President Bush in 2005
Or
Manufacturer
1 2 3 4 5 6
7 6 5 4 3 2 1 0
0: Unicast
1: Multicast
0: Unique globally
1: Locally administered
Logical Address
• first deployed in 1983 in the ARPANET.
• universal address , known as IP address
• independent of the underlying network infrastructure.
• 32 bit address (four decimal numbers separated by period ‘.’ characters for IPV4)
• a network-layer address that is interpreted by a protocol handler.
• assigned to it for the purpose of routing between networks.
Service type:
allow different types of IP datagrams (for example, datagrams particularly requiring low delay, high
throughput, or reliability) to be distinguished from each other.
[it might be useful to distinguish real-time datagrams such as those used by an IP telephony application)
is a policy issue determined by the router’s administrator.
first 3 bits are called precedence bits. The next 4 bits are called type of service (TOS)
bits and the last bit is not used.
is now used by Differentiated Services and is called the Diff Serv Code Point (DSCP).
Precedence:
used for QOS (Quality of Service) Purposes.
defines the priority of the datagram in issues such as congestion
some data has higher importance than other.
Higher priority data should be processed first because it could contain packets which are
important to run network communication such as routing protocols data.
• Precedence value, higher has more priority
• 000 (0) - Routine
• 001 (1) - Priority
• 010 (2) - Immediate
• 011 (3) - Flash
• 100 (4) - Flash Override
• 101 (5) - Critical
• 110 (6) - Internetwork Control
• 111 (7) - Network Control
If a router is congested and needs to discard some datagrams, those datagrams with
lowest precedence are discarded first
Type of service:
Bits 0-2: Precedence.
Bit 3: Delay (0 = Normal Delay, 1 = Low Delay)
Bit 4: Throughput (0 = Normal Throughput, 1 = High Throughput)
Bit 5: Reliability (0 = Normal Reliability, 1 = High Reliability)
Bits 6: Reserved
Bit 7 : Not used
IP Datagram
Total length:
denotes total length of the IP datagram.
theoretical maximum size of the IP datagram is 65,535 bytes.
However, datagrams are rarely larger than 1,500 bytes.
if that packet goes into an interface that has a less than 1500 byte MTU?
Identification:
incremented by 1 each time a datagram is sent.
Used in a situation when datagram is fragmented
assigned to manage fragmentation and reassembly.
• Uniquely identifies the datagram.
• All fragments of a datagram contain the same identification value.
• allows the destination host to determine which fragment belongs to which datagram.
[Datagram passes through different n/w s. May need to be fragmented to sub-datagram to match the
physical frame size of the underlying n/w]
Flag:
has three bits: one unused bit (always 0), one “don’t fragment”(DF) bit, and one
“more fragment”(MF) bit.
DF bit is 1, it forces the router not to fragment the packet.
DF bit is 1---packet length > maximum transmission unit (MTU) -- the router will
have to discard the packet and send an error message to the source host.
If there are more, the MF bit is set to 1; otherwise it is set to 0.
whether the datagram is the last fragment, or there are more fragments.
Fragmentation offset:
datagram is fragmented,
it is necessary to reassemble the
fragments in the correct order.
The fragment offset numbers the
fragments in such a way that they can be
reassembled correctly.
fragment offset field is measured in units
of eight-byte blocks.
allows a maximum offset of (213 – 1) × 8 =
65,528 bytes, which would exceed the
maximum IP packet length of 65,535
bytes with the header length included
(65,528 + 20 = 65,548 bytes). [Seems
odd? If header is 60? ]
For example, for an MTU of 1,500 bytes with a header size of 20 bytes, the fragment
offsets would be multiples of (1500–20)/8 = 185. These multiples are 0, 185, 370,
555, 740, ..
Answer…
• a packet of 4,520 bytes, including the 20 bytes of the IP header (without
options) is fragmented to two packets on a link with an MTU of 2,500
bytes. What will be the Flag and fragmentation offset?
Let this fragmented datagram again encountered with a link with an MTU of
1,500 bytes. What will be the Flag and fragmentation offset?
IP Datagrams
Time to live:
A datagram has a limited lifetime in its travel through an
internet.
originally designed to hold a timestamp, which was
decremented by each visited router.
datagram discarded when the value became zero.
now all the machines must have synchronized clocks .
Today, this field is used mostly to control the maximum number of hops (routers) visited
When a source host sends the datagram, it stores a number in this field.
value is approximately 2 times the maximum number of routes between any two hosts.
Each router that processes the datagram decrements this number by 1.
after being decremented, is zero, the router discards the datagram.
may travel between two or more routers for a long time without ever getting delivered to
the destination host. This field limits the lifetime of a datagram.
[Avoids congestion]
IP Datagram
Protocol:
8-bit field defines the higher-level protocol that
uses the services of the IPv4 layer.
IPv4 datagram can encapsulate data from
several higher-level protocols such as TCP, UDP,
ICMP, and IGMP.
This field specifies the final destination protocol
to which the IPv4 datagram is delivered.
value of this field helps the receiving network
layer know to which protocol the data belong
When a router receives a packet destined for
itself, it examines this Protocol field to learn
how to interpret data which are encapsulated
in the IP packet.
Maintains by Internet Assigned Numbers
Authority (IANA).
Checksum:
to protect the header of IPv4 data packets against data corruption.
has to be calculated on each hop(router) and if it does not matches then packet
has to be discarded.
First, the value of the checksum field is set to 0.
Then the entire header is divided into 16-bit sections and added together.
The result (sum) is complemented and inserted into the checksum field.
The checksum in the IPv4 packet covers only the header, not the data.
Checksum calculation
I. 16 bit block formation:
version(4), Header length(20) ToS(0) [all default] is a one block of 16 bit fields ----
hex turns to 4500.
Total length and Identification are two 16 bit field
Flags(001) and fragment offset(2560) make another 16 bit field---2140 in hex.
In the same way all the fields are arranged to make blocks of 16 bits each. Hence
complete IP packet header can be represented as(hex):
4500 0514 42A2 2140 8001 50B2(Header Checksum) C0A8 0003 C0A8 0001
II. Calculating Checksum
First calculate the sum of each 16 bit value within the header, skipping only the
checksum field itself. [Taking it zero]
4500+0514+42A2+2140+8001+0000+C0A8+0003+C0A8+0001 = 2AF4B
The packet
4500 0514 42A2 2140 8001 50B2(Header Checksum) C0A8 0003 C0A8 0001
Options:
made of two parts: a fixed part and a variable part.
The fixed part is 20 bytes long and the variable part comprises the options that can
be a maximum of 40 bytes.
Options, as the name implies, are not required for a datagram.
They can be used for network testing and debugging.
contains routing details, timing, management
Classful: 5 classes
IP address
Class Address Range
Class A 1.0.0.1 to 126.255.255.254
Class B 128.1.0.1 to 191.255.255.254
Class C 192.0.1.1 to 223.255.254.254
Class D 224.0.0.0 to 239.255.255.255
Class E 240.0.0.0 to 254.255.255.254
Who issue?
Who issues IP address?
Internet assigned number authority (ISNA) issues the prefix
or network portion and give it to Internet service provider.
Organization approaches to ISP.
IP datagram
• If it cannot pass the datagram through any available physical network, it discards
the datagram and sends an ICMP error message to the source host
• last bit is 1, it means the datagram is not the last fragment; there are more
fragments after this one.
• If its value is 0, it means this is the last or only fragment
• Fragmentation offset: shows the relative position of this fragment with respect to
the whole datagram.
• It is the offset of the data in the original datagram measured in units of 8 bytes.
Because the M bit is 1, it is either the first fragment or a middle one. Because the
offset value is 0, it is the first fragment.
Q. A packet has arrived in which the offset value is 100. What is the number of the
first byte? Do we know the number of the last byte?
Multiply the offset value by 8. This means that the first byte number is 801.(800 is
already been sent.) We cannot determine the number of the last byte unless we
know the length of the data.
Q. A packet has arrived in which the offset value is 100, the value of HLEN is 5
and the value of the total length field is 1000. What is the number of the first
byte and the last byte?
Question
• An IP packet has arrived with the first 8 bits as shown: 01000010. The receiver
discards the packet. Why?
Error in this packet. The 4 left-most bits (0100) show the version, which is correct. The
next 4 bits (0010) show the wrong header length (2 × 4= 8). The minimum number of
bytes in the header must be 20. The packet has been corrupted in transmission.
Q. In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are
being carried by this packet?
Total number of bytes in the header is 8
1000
× 4 or 32 bytes.
The first 20 bytes are the base header, the
next 12 bytes are the options.
Option 12 bit
Q. 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?
Length of data = total length-header length
Question
• 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?
TTL
Protocol
Discard 16 hexadecimal digit
45000028000100000102 . . .
M = 0 indicates that this packet is the last packet among all fragments of original packet.
So the answer is either A or C.
It is given that HLEN field is 10. Header length is number of 32 bit words. So header
length = 10 * 4 = 40
Also, given that total length = 400.
Total length indicates total length of the packet including header.
So, packet length excluding header = 400 – 40 = 360
Last byte address = 2400 + 360 – 1 = 2759 (Because numbering starts from 0)
(C)
GATE
• An IP router with a Maximum Transmission Unit (MTU) of 1500 bytes has received
an IP packet of size 4404 bytes with an IP header of length 20 bytes. The values of
the relevant fields in the header of the third IP fragment generated by the router
for this packet are
(A)MF bit: 0, Datagram Length: 1444; Offset: 370
(B) MF bit: 1, Datagram Length: 1424; Offset: 185
(C) MF bit: 1, Datagram Length: 1500; Offset: 37
(D) MF bit: 0, Datagram Length: 1424; Offset: 2960
Number of packet fragments = ⌈ (total size of packet)/(MTU) ⌉
= ⌈ 4404/1500 ⌉
= ⌈ 2.936 ⌉
=3
So Datagram with data 4404 byte fragmented into 3 fragments.
The first frame carries bytes 0 to 1479 (because MTU is 1500 bytes and HLEN is 20
byte so the total bytes in fragments is maximum 1500-20=1480). the offset for this
datagram is 0/8 = 0.
The second fragment carries byte 1480 to 2959. The offset for this datagram is 1480/8
= 185.finally the third fragment carries byte 2960 to 4404.the offset is 370.and for all
fragments except last one the M bit is 1.so in the third bit M is 0..
• An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet
on a link whose MTU (maximum transmission unit) is 100 bytes. Assume that the size of the
IP header is 20 bytes. The number of fragments that the IP datagram will be divided into for
transmission is :
(A) 10
(B) 50
(C) 12
(D) 13
Copy:
1-bit subfield controls the presence of the option in fragmentation.
value is 0, ---option must be copied only to the first fragment.
value is 1--- option must be copied to all fragments
Class:
2-bit subfield defines the general purpose of the option.
00 used for datagram control.
10 used for debugging and management.
01 and 11 Reserved
Number
5-bit subfield defines the type of option.
currently only 6 types are in use.
Format of Option
Length
• Defines the total length of the option including the type field and the length field itself.
• This field is not present in all of the option types.
Value
• Contains the data that specific options require.
• This field is also not present in all option types.
Option type (5 bit number field)
• options are currently being used.
• Two of these are 1-byte options, and they do not require the length or the data
fields.
• Four of them are multiple-byte options; they require the length and the data fields.
No-Operation Option:
1-byte option used as a
filler between options.
used as “internal padding”
to align certain options on a
16 or 32-bit boundary when
Value Type required.
00001 No option
00000 End of option
00111 Record route
01001 Strict source to route
00011 Loose source route
00100 Time stamp
Option type (5 bit number field)
End of option:
used for padding at the end of the option field.
It, however, can only be used as the last option.
Only one end-of-option option can be used.
After this option, the receiver looks for the payload data
if more than 1 byte is needed to align the option field, some no-operation options
must be used, followed by an end-of-option option
Option type (5 bit number field)
Record-Route Option: record the routers that handle the datagram
Used to record the Internet routers that handle the datagram.
Can list up to nine router IP addresses. [In header 15 * 4 =60 . Option is max 40
byte. IP 9 * 4=36 + 3 (Type, length and pointer)].
Source creates placeholder fields in the option to be filled by the visited routers.
pointer field (1 byte)offset integer field containing the byte number of the first
empty entry. In other words, it points to the first available entry.
• Datagram from source, all of the fields are empty. Pointer field has a value of 4,
pointing to the first empty field.
• passing a router that processes the datagram finds the value of the pointer with the
value of the length. If pointer value >value of the length, the option is full and no
changes are made.
• If not router adds the IP address of its interface from which the datagram is leaving.
• Increase the pointer value by 4.
Option type (5 bit number field)
Strict-Source-Route Option:
• Used by the source to predetermine a route for the datagram as it travels through
the Internet.
• Advantages:
For specific type of service minimum delay or maximum throughput.
May choose a route that is safer or more reliable. for the sender’s purpose.
[For example, a sender can choose a route so that its datagram does not travel
through a competitor’s network.]
• all of the routers defined in the option must be visited by the datagram.
• A router must not be visited if its IP address is not listed. If the it visits a router not
listed the datagram is discarded and an error message is issued.
• If the datagram arrives at the destination and some of the entries were not visited,
it will also be discarded and an error message issued. ----Problem
• General users, however, are not usually aware of the physical topology of the
Internet. Thus strict source routing is not the choice of most users.
• Similar to record route, but the entry are done by sender
router that processes the datagram compares value of the pointer with the value of
the length.
If the value of the pointer > value of the length, the datagram has visited all of the
predefined routers. cannot travel anymore discarded and an error message is
created
If not router compares the destination IP address with its incoming IP address: If
they are equal, process the datagram swaps the IP address pointed by the
pointer with the destination addressincrements the pointer by 4 forwards the
datagram. If they are not equal, it discards the datagram and issues an error message.
Option type (5 bit number field)
Loose-Source-Route Option:
Similar to the strict source route, but more relaxed.
Each router in the list must be visited, but the datagram can visit other routers as
well.
Time stamp:
• Used to record the time of datagram processing by a router.
• Time is expressed in milliseconds from midnight, universal time.
• All routers may use Universal Time (Network time protocol), their local clocks may
not be synchronized.
• Time stamp help users and managers track the behavior of the routers in the
Internet.
• Timestamp option is not a choice for most users. [Not aware of physical topology]
Option type (5 bit number field)
• Overflow field records the number of routers that could not add their timestamp.
(because no more fields were available.)
• The flags field specifies the visited router responsibilities.
0 each router adds only the timestamp in the provided field.
1 each router add its outgoing IP address and the timestamp.
3 IP addresses are given, and each router check the given IP address with its
own incoming IP address. If match, the router overwrites the IP address with its
outgoing IP address and adds the timestamp.
To add
timestamp
Question
• For a datagram HLEN field is 1001 in binary. Type bit is 111. How many IP address
it can record?
• For a datagram HLEN is 1011 in binary. Option type is 137. Pointer value after
released by a router is 20. Whether it will be accepted by the next router?
11*4=44-20=24
24-3=21 left to record IP
Entry of 5 IP addresses. Pointer is initialized by 4 when released by source.
Maximum possible value is 4+20=24.
20 means will be accept.
Question
• Value of HLEN is 1110. Option type value is 137. Pointer value 36 or 40 , which is
possible?
56-20=36-3=33
33/4=8
Pointer value max = 4+32=36.
a) 0 only timestamp so 8
b) 1 IP+ timestamp so 4
c) 3 same as b
Checksum
• Error detection method used by most TCP/IP protocols
• Protects against the corruption that may occur during the transmission of a packet.
• Redundant information added to the packet.
• Calculated at the sender and the value is sent with the packet.
• Receiver recalculates on the whole packet including the checksum. If satisfactory
the packet is accepted; otherwise, rejected.
192.168.123.0
Network ID Host ID
Subnet mask determines the network part and host part by the
presence of consecutive ‘1’ s.
Subnetting
breaking a large network into smaller networks by adding ones to the
subnet mask.
Host's formula: how many hosts will be allowed on a network that has a
certain subnet mask.
2h - 2. h : number of zeros in the subnet mask converted to binary.
(The first and last addresses are reserved. First: to identify the network
and the last to be used as the broadcast address)
Example: IP address space 192.168.0.0. Number of node is 100.
Use 255.255.255.0 as subnet mask. (28 – 2= 254 ) 254>100
We would have 192.168.0.1 through 192.168.0.254 for your hosts. (2
addresses are reserved)
Next year node become 300. Make subnet mask 255.255.254.0.(29 – 2 )
Adding ones to the subnet mask means you get fewer hosts per
network subnet but more network subnets. If you remove ones from
the subnet mask, you get more hosts per network but fewer networks.
Subnetting
• Subnet formula : 2S where S denotes number of ‘1’ added to
the subnet mask.
• As we add subnet bits, the number of subnets increases by a
factor of two, and the number of hosts per subnet decreases
by a factor of two.
Classless Inter-Domain Routing (CIDR) representation: appends
the number of subnet mask bits to the network address.
we append a forward slash (/) and the number of ‘1’ bits in the
subnet mask.
192.168.0.1/23 means
IP : 192.168.0.1 Subnet mask: 255.255.254.0
Subnetting
• IP address 192.168.10.44
• Subnet Mask 255.255.255.248
Binary 11111111.11111111.11111111.11111000
Bitwise AND
Subnet Address 192.168.10.40
Binary 11000000. 10101000.00001010.00101000
192.168.20.1/24
10.10.10.1/24
R
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.11/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
Communication in Same network
• Let node A wants to communicate with C
• Bitwise AND with IP of A with A’s subnet mask and IP of C and A’s subnet
mask. The two results are same. Thus A and C are in same network.
• If A does not know the MAC address of C it broadcast a ARP request packet
with the MAC address of A in the same network. It reaches to all nodes
including Router interface to the n/w
• All except C will reject but C will accept with a ARP reply packet (unicast)
with its MAC address.
[ARP cache is a table maintained by ARP which contains IP address with its associated MAC
address and type. If MAC address is learned dynamically then the type will be dynamic and
if MAC address is added manually then type will be static.]
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
C will unicast an ARP reply to A via switch. In the traversal process S also updates
its ARP cache. A also updates its ARP cache and from further communication A
does not need to generate ARP request.
10.10.10.1/24 192.168.20.1/24
9b-fc-5g-56-f3- R
45
S S
A B C D E F
10.10.10.10/24 10.10.10.11/24 10.10.10.12/24 192.168.20.10/24 192.168.20.11/24 192.168.20.12/24
8b-9c-fg-cc-f3- 9a-8c-ff-ab-3f- 9d-6f-7d-af-f7-
94 67 89
Types:
Static NAT: Used in web hosting. private IP are
mapped to public IP in 1:1 basic
Connection oriented:
Connection provided by TCP is called virtual connection
connection must be established between two ends of a transmission before either
can transmit data.
Regarding virtual connection sender and receiver are aware but intermediate
router do not have any clue.
Relationship between TCP and IP
Communication using TCP/IP
TCP features
I. Numbering System:
In TCP there is no field for segment number in header.
There are two fields called the sequence number and the acknowledgment number.
These fields refer to a byte number and not a segment number.
a) Byte Number:
TCP numbers all data bytes (octets) that are
transmitted in a connection.
Numbering is independent in each direction.
TCP
TCP receives bytes from a process and stores
them in the sending buffer and numbers them.
TCP chooses an arbitrary number between 0
and 232− 1 for the number of the first byte.
c) Acknowledgment Number:
• Communication in TCP is full duplex; when a connection is established, both parties can
send and receive data at the same time.
• sequence number in each direction shows the number of the first byte carried by the
segment.
• Each party uses an acknowledgment number to confirm the bytes it has received.
• Acknowledgment number defines the number of the next byte that the party expects
to receive.
• Acknowledgment number is cumulative, ---party takes the number of the last byte that
it has received, safe and sound, adds 1 to it, and announces this sum as the
acknowledgment number.
TCP features
II. Flow Control:
• TCP controls how much data can be accepted from the sending process; the
receiving TCP controls how much data can to be sent by the sending TCP.
• Done to prevent the receiver from being overwhelmed with data.
• Numbering system allows TCP to use a byte oriented flow control.
III.b.
TCP uses acknowledgments to confirm the receipt of data segments.
Control segments that carry no data but consume a sequence number are also
acknowledged.
ACK segments are never acknowledged.
III.c.
Retransmission of segments.
When a segment is corrupted, lost, or delayed, it is retransmitted.
A segment is retransmitted when a retransmission timer expires.
TCP segment format
• Has header of size 20 to 60 byte followed
by actual data.
• TCP segment without option –20 byte else
60 byte
Source port number: port number of the
source computer corresponding to the
application that is sending this TCP
segment FLAG
i)
Three way handshaking: TCP at client receives a close command from
the client process.
Send FIN segment in which the FIN flag is set.
it consumes only one sequence number and
contains last chunk of data if exist.
ii)
Server receives the FIN segment
informs its process of the situation
and sends the second segment, a FIN+ACK
segment.
it consumes only one sequence number and
contains last chunk of data if exist.
TCP connection
iii)
Client TCP sends the last segment, an ACK segment.
Confirm the receipt of the FIN segment from the TCP server. Contains the
acknowledgment number, which is one plus the sequence number received in the
FIN segment from the server.
This segment cannot carry data and consumes no sequence numbers.
Half close operation
• Here one end can stop sending data while still receiving data.
• Server or the client both can issue a half-close request.
• occur when the server needs all the data before processing can begin.
[Example: Sorting at server. Server needs to receive all the data before sorting starts. Client, after
sending all data, can close the connection in the client-to-server direction. However, the
server-to-client direction must remain open to return the sorted data. The server, after
receiving the data, still needs time for sorting; its outbound direction must remain open.]
UDP
• User datagram protocol.
• far simpler but less reliable than TCP
• connectionless protocol.
• No error checking involved
• Does not provide any acknowledgement
• Do not have any sequence or reordering mechanism
• is a connectionless, unreliable transport protocol
• provides process-to-process communication
• Left on application program that uses UDP to accept full responsibility to handle
issues as reliability, data loss, duplication, delay, loss of connection.
• UDP is a better choice for voice or video communication as lost of few bit does not
effect so much on QoS.
• For data transmission TCP is the best.
• UDP is faster than TCP
UDP datagram
Source port number: Port number used by the process running on the source host. It is 16
bits long.
Destination port number: Port number used by the process running on the destination
host. It is also 16 bits long.
Till why?
However, the designers of the UDP protocol felt
that it was more efficient for the destination
UDP to calculate the length of the data from
the information provided in the UDP user
datagram rather than ask the IP software to
supply this information.
We should remember that when the IP
software delivers the UDP user datagram to the
Checksum: For error detection. UDP layer, it has already dropped the IP header.
Question
UDP header in hexadecimal format
CB84000D001C001C
Function As a message makes its way across one program can send a load of packets
the internet from one computer to to another and that would be the end of
another. This is connection based. the relationship.
Usage suited for applications that require suitable for applications that need fast,
high reliability, and transmission efficient transmission, such as games.
time is relatively less critical. useful for servers that answer small
queries from huge numbers of clients.
Use by other HTTP, HTTPs, FTP, SMTP, Telnet DNS, DHCP, TFTP, SNMP, RIP, VOIP.
protocols
Ordering of rearranges data packets in the order no inherent order as all packets are
data packets specified. independent of each other. If ordering is
required, it has to be managed by the
application layer.
Speed of slower than UDP faster because error recovery is not
transfer attempted.
Reliability absolute guarantee that the data There is no guarantee that the messages
transferred remains intact and or packets sent would reach at all.
arrives in the same order in which it
was sent.
TCP UDP
Header Size 20 bytes 8 bytes.
Common Source port, Destination port, Source port, Destination port, Check Sum
Header Fields Check Sum
Weight heavy-weight. requires three lightweight. no ordering of messages, no
packets to set up a socket tracking connections, etc. small transport
connection, before any user data layer designed on top of IP.
can be sent. handles reliability and
congestion control.
Data Flow does Flow Control. requires three UDP does not have an option for flow
Control packets to set up a socket control
connection, before any user data
can be sent. TCP handles reliability
and congestion control.
Error Checking does error checking and error UDP does error checking but simply
recovery. Erroneous packets are discards erroneous packets. Error
retransmitted from the source to recovery is not attempted.
the destination.
Acknowledge Acknowledgement segments No Acknowledgment
ment
Handshake SYN, SYN-ACK, ACK No handshake (connectionless
protocol)
ARP
• Logical address is usually implemented in software.
• Every protocol that deals with interconnecting networks requires logical addresses.
• The logical addresses in the TCP/IP protocol suite are called IP addresses.
• Packets pass through physical networks to reach these hosts and routers.
• Hosts and routers are recognized by their physical addresses----the local address.
• Delivery of a packet to a host or a router requires two levels of addressing: logical and
physical.
• Must be able to map a logical address to its corresponding physical address and vice
versa.
• Done using either static or dynamic mapping
ARP
Static mapping:
• Creating a table that associates a logical address with a physical address.
• Table is stored in each machine on the network.
• Machine knowing the IP address of another machine but not its physical address
can look it up in the table.
Have some limitations
• A machine could change its NIC, resulting in a new physical address.
• Some LANs, like LocalTalk, the physical address changes every time the computer is
turned on. (by MAC spoofing)
• A mobile computer can move from one physical network to another, resulting in a
change in its physical address.
• Static table must be updated periodically.
ARP
Dynamic Mapping:
• Each time a machine knows the logical address of another machine.
• Use two protocols to find the physical address. Address Resolution Protocol (ARP)
and Reverse Address Resolution Protocol (RARP).
• ARP maps a logical address to a physical address; RARP maps a physical address to
a logical address.
ARP
The Protocol:
• Anytime a host, or a router, needs to find the physical address of another host or
router on its network.
• Sends an ARP query packet.
• The packet includes the physical and IP addresses of the sender and the IP address
of the receiver.
• Sender does not know the physical address of the receiver, the query is broadcast
over the network.
• Every host or router on the network receives and processes the ARP query packet,
but only the intended recipient recognizes its IP address and sends back an ARP
response packet.
• It contains the recipient’s IP and physical addresses.
• The packet is unicasted directly to the inquirer using the physical address received
in the query packet.
ARP
ARP Packet format
Hardware type:
Sender IP Address:
Target IP Address:
ARP
Searching operation:
1. The sender knows the IP address of the target.
2. IP asks ARP to create an ARP request message, filling in the sender physical address, the
sender IP address, and the target IP address. The target physical address field is filled
with 0s.
3. The message is passed to the data link layer where it is encapsulated in a frame using
the physical address of the sender as the source address and the physical broadcast
address as the destination address.
4. Every host or router receives the frame. Because the frame contains a broadcast
destination address, all stations remove the message and pass it to ARP. All machines
except the one targeted drop the packet. The target machine recognizes the IP address.
5. The target machine replies with an ARP reply message that contains its physical
address. The message is unicast.
6. The sender receives the reply message. It now knows the physical address of the target
machine.
7. The IP datagram, which carries data for the target machine, is now encapsulated in a
frame and is unicast to the destination.
ARP
Four different cases:
four different cases in which the services of ARP can be used
Case 1: The sender is a host and wants to send a packet to another host on the same
network. In this case, the logical address that must be mapped to a physical
address is the destination IP address in the datagram header.
Case 2: The sender is a host and wants to send a packet to another host on another
network. In this case, the host looks at its routing table and finds the IP address of
the next hop (router) for this destination. If it does not have a routing table, it
looks for the IP address of the default router. The IP address of the router becomes
the logical address that must be mapped to a physical address.
Case 3: The sender is a router that has received a datagram destined for a host on
another network. It checks its routing table and finds the IP address of the next
router. The IP address of the next router becomes the logical address that must be
mapped to a physical address.
Case 4: The sender is a router that has received a datagram destined for a host in
the same network. The destination IP address of the datagram becomes the logical
address that must be mapped to a physical address.
RARP
• Finds IP address from physical address.
• Used when a new host is connected. Or a hard disk less
workstation
• RARP query datagram send to all nodes including
server.
• Server recognizes the kind of datagram
ICMP
• Internet control message protocol.
• IP does not guarantee datagram delivery correctly while TCP does.
• IP does not have error detection/retransmission/ acknowledgement mechanism. (TCP
has)
• The issues of connection management between source to destination, correct
delivery are handled by ICMP.
• Let a router receiving datagrams too fast to handle, or may be one host is down,
without knowing another host try to send datagram to the host repetedly.
• If this occur to a number of nodes the server may crash.
• ICMP serves as an error reporting mechanism.
• Does not play any role in correction of the problems.
• can be used to show when a particular End System (ES) is not responding, when an IP
network is not reachable, when a node is overloaded, when an error occurs in the IP
header information, etc. to verify correct operations of End Systems (ES) and to
check that routers are correctly routing packets to the specified destination address.
ICMP datagram
• ICMP message:
Type Code Checksum
Error Code Error message
8bit (error) 16bit
8bit
3 Destination unreachable
4 Source quench
5 Redirect
11 Time exceed
ping
• helps to verify IP-level connectivity.
• use ping to send an ICMP echo request to a target host name
or IP address.
• Use ping whenever you need to verify that a host computer
can connect to the TCP/IP network and network resources.
SMTP
• Simple mail transfer protocol
• defined in 1982
• specified for outgoing mail uses
• uses TCP port 25
Shortage of IPV4 address…
IPV4
IPV6
• Version:
size 4 bits.
shows the version of IP and is set to 6.
• Traffic Class:
size 8 bits.
similar to the IPv4 Type of Service (ToS) field.
field indicates the IPv6 packet’s class or priority.
• Flow Label:
size is 20 bits.
provide additional support for real-time datagram delivery and quality of service
features.
The purpose is to indicate that this packet belongs to a specific sequence of packets
between a source and destination and can be used to prioritized delivery of packets
for services like voice.
• Payload Length:
size is 16 bits.
shows the length of the IPv6 payload, including the extension headers and the upper layer
protocol data
IPV6
• Next Header:
size is 8 bits.
shows either the type of the first extension (if any extension header is available) or
the protocol in the upper layer such as TCP, UDP, or ICMPv6.
• Hop Limit:
size is 8 bits
shows the maximum number of routers the IPv6 packet can travel.
similar to IPv4 Time to Live (TTL) field.
typically used by distance vector routing protocols, like Routing Information
Protocol (RIP) to prevent layer 3 loops (routing loops).
• Source Address:
size is 128 bits.
field shows the IPv6 address of the source of the packet.
• Destination Address:
size is 128 bits.
shows the IPv6 address of the destination of the packet.
Thank You