KEMBAR78
3 - Protocols For IoT | PDF | I Pv6 | Internet Protocols
0% found this document useful (0 votes)
97 views67 pages

3 - Protocols For IoT

Chapter 3 discusses various protocols for the Internet of Things (IoT), focusing on messaging protocols like MQTT and CoAP, as well as transport protocols including Bluetooth Low Energy (BLE), Wi-Fi, and Li-Fi. MQTT is a lightweight publish-subscribe protocol ideal for resource-constrained environments, while CoAP is designed for one-to-one communication in constrained settings, utilizing a request-response model. The chapter also highlights the differences between MQTT and CoAP, and provides an overview of BLE's architecture and communication methods.

Uploaded by

kashparekh40
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views67 pages

3 - Protocols For IoT

Chapter 3 discusses various protocols for the Internet of Things (IoT), focusing on messaging protocols like MQTT and CoAP, as well as transport protocols including Bluetooth Low Energy (BLE), Wi-Fi, and Li-Fi. MQTT is a lightweight publish-subscribe protocol ideal for resource-constrained environments, while CoAP is designed for one-to-one communication in constrained settings, utilizing a request-response model. The chapter also highlights the differences between MQTT and CoAP, and provides an overview of BLE's architecture and communication methods.

Uploaded by

kashparekh40
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

CHAPTER 3

Protocols for IoT

HEMIL PATEL
1
CKPCET, SURAT
Outline
Messaging protocols
Transport protocols
IPv4
IPv6
URI

HEMIL PATEL
2
CKPCET, SURAT
Messaging protocols
• Internet of Things (IoT) messaging protocols are used to transmit telemetry (messages) from IoT devices
to an IoT Messaging Hub. These protocols can operate over TCP, or even a higher level abstraction such as
HTTPS.

• Messaging protocols play a vital role to send and receive the data/message to/from the cloud for any IoT
application.

• We will cover two significant protocols: MQTT (Message Queue Telemetry Transport) and CoAP
(Constrained Application Protocol).

HEMIL PATEL
CKPCET, SURAT 3
MQTT (Message Queue Telemetry Transport)
• Message Queue Telemetry Transport is a lightweight protocol, lightweight means that it demands minimal
recourses for its functioning and does not require additional resources from its working environment.

• IoT prefers lightweight protocol due to resource constraints.

• MQTT follows the publish-subscribe pattern.

• A component called central broker plays a key role in the entire system, message broker helps to dispatch
messages to the nodes that have subscribed for the same.

• The publisher (node) sends the message to the broker and the broker takes the responsibility of
dispatching the message to the subscribed destinations.

HEMIL PATEL
4
CKPCET, SURAT
Cont..
• From the figure we can see that a publisher
(node) can send the data (message) to the
MQTT broker.

• Based on the subscriptions from the nodes


connected, the broker sends the messages
accordingly.

HEMIL PATEL
5
CKPCET, SURAT
Cont..

• MQTT Client:

◦ Collects information from sensors (telemetry devices).

◦ Connects it to the messaging server(broker).

◦ Topics is used to publish this message to let other clients understand.

◦ Can also be a subscriber.


• MQTT also supports Quality of Service (QoS) levels.

• MQTT Broker: 1. 0= At Most once (Best effort., No Ack)

2. 1= At least once (Acked, retransmitted if ack not received)


• Protocol is implemented in this case.
3. 2= Exactly once (Request to send (Publish), clear to send)
• Mediates and facilitates the data based on interest of the subscriber.

HEMIL• PATEL
6
CKPCET, SURAT
Implementation of MQTT
• One can publish or subscribe to the data feeds based on the
requirement. Publishing/Subscription process can be carried out
with the below connection diagram.

• The sensor sense the gas data and pushes it to the cloud through
NodeMCU, which is one of the nodes. Node is referred as
publisher.

•Process of transmission is taken care by MQTT protocol.

•Adafruit cloud service provider acts as the broker and takes care
of the subscribers provided with appropriate message.

HEMIL PATEL
7
CKPCET, SURAT
CoAP(Constrained Application Protocol)
• The basic of IoT is collecting data from various modules and recording it in cloud for analysis
whenever required.

• CoAP is designed by IEFT to work in constrained environments. It is used to enable the smart
devices to connect to the Internet.

• CoAP is a one-to-one communication protocol

• Similar to MQTT, CoAP is s lightweight protocol. CoAP uses lesser resources then HTTP.

•CoAP is specifically designed for environments with constraints. HTTP runs over TCP and is
connection-oriented, while CoAP runs over UDP and its connectionless.

HEMIL PATEL
8
CKPCET, SURAT
Cont..
• The fundamental client-server model is
popular, and it is the idea behind CoAP. As per
the model followed by client-server
connection, the client will send a request
followed by server’s response to the request
with an appropriate reply or an error
message.
• Figure shows the architecture of CoAP.

HEMIL PATEL
CKPCET, SURAT 9
Cont.,
• CoAP is based on the REST API model, known as RESTful. Few protocols depends on SOAP and can be
referred to as SOAPful.

• REST is short for Representational State Transfer.

• REST approach ensure a secure, fault-tolerant and scalable system.

• One key feature of CoAP is that it optimizes the datagram length. CoAP also renders support to IP
Multicast.

• CoAP is based on UDP and its connectionless protocol, it requires retransmission support.

• Retransmission features are supported in CoAP to address User Datagram Protocol (UDP) weakness.

HEMIL PATEL
10
CKPCET, SURAT
Layers of CoAP
• CoAP is a two-layered protocol. The lower layer is the message layer and the upper owns
the request-response process. The upper layer is dependent on UDP.

Application

Request-Response

Messages

UDP

HEMIL PATEL 11
CKPCET, SURAT
Cont.,
• CoAP supports four types of messages:

1. Confirmable (CON) – Reliable Messaging: This is a reliable approach. In this procedure,


retransmission happens until the acknowledgement is received, with the same message ID as sent in
the request. When there is a timeout or fail, there would be a RST message sent from the server as a
response. Since retransmission is taken care, this approach is referred to as reliable messaging
approach.

HEMIL PATEL
12
CKPCET, SURAT
Cont.,
2. Non-Confirmable (NON) − Non-Reliable Messaging: There is no reliability ensured in this message
transmission style. No acknowledgement will be issued in the message. Message ID is also be part of
the transaction and this enables supervision possible. In case, no processing is carried out by the
receiver, RST shall be sent. One can refer Fig. for understanding NON.

HEMIL PATEL
13
CKPCET, SURAT
Cont.,
3. Acknowledgement (ACK) – This is a traditional acknowledgement message sent in any sort of
protocols the reader has come across. One can connect it to the regular handshaking scheme.

4. Reset (RST) – If no processing has happened at the receiver end, even after a specific amount of time,
there should be a mechanism to let the sender know that things did not go correct. For that purpose,
there is a message option called RST, Reset. It will let the sender know there is a problem or trouble in
the transmission.

HEMIL PATEL
14
CKPCET, SURAT
CoAP Request-Response Layer Messages

1. Piggy-Backed: In this mode of request/response approach, the client sends request with a
CON/NON-messaging method. ACK is received immediately with corresponding token number
and message (here, humidity) as one can refer from Fig. If it is not available, the failure code is
embedded as a part of the ACK.

HEMIL PATEL
15
CKPCET, SURAT
Cont.,
2. Separate Response: When a CON type message is sent to the server from the client and in case, the
server is unable to respond immediately, an Empty ACK shall be reverted. After some time, when the
server is able to send the response, it sends a CON message with data. ACK is sent back from the client.
One can refer Fig. to understand the same.

HEMIL PATEL
16
CKPCET, SURAT
Cont.,
3. Non-Confirmable Request and Response: Here, NON type message is sent from the client to the server.
The server need not give ACK. Server can send a NON type response in turn.

HEMIL PATEL
17
CKPCET, SURAT
CoAP Message Format

1. Ver: It is a 2-bit unsigned integer and refers to CoAP version. Here it is one.
2. T: It is a 2-bit unsigned integer and refers to the message type. Message can be one of the
following:
a. Confirmable (0)
b. Non-confirmable (1)
c. ACK (2)
d. RESET (3)

HEMIL PATEL
18
CKPCET, SURAT
Cont.,
3. TKL: It is a 4-bit unsigned integer and refers to the token length. It normally ranges from 0 to 8 bytes.

4. Code: It refers to the response code.

5. Message ID: It is the identifier of the message.


Difference between MQTT and CoAP
MQTT CoAP
Underlying Protocol TCP(Connection oriented) UDP(Connectionless)
Communication M:N (Many-to-one) 1:1 (One-to-one)
Power Higher then CoAP Lowest. Consumes less power
Lesser then other protocol then MQTT
Model Publisher/Subscriber Request-response (RESTful and
not SOAPful)
HEMIL PATEL
19
CKPCET, SURAT
Transport Protocols
• Three protocols that enable transport are the

1. Bluetooth Low Energy (BLE)

2. Wi-Fi (Wireless Fidelity)

3. Li-Fi (Light Fidelity)

HEMIL PATEL
20
CKPCET, SURAT
Bluetooth Low Energy (BLE)
• BLE is an open low-energy short-range radio communication technology. It is also called
Bluetooth Smart. Designed by Bluetooth SIG (Special interest group)
• It is a wireless Personal Ares Network (PAN) technology similar to Bluetooth protocol.
• BLE has reduced power consumption, as compared to classic Bluetooth.
• Application focus in
• Healthcare

• Entertainment

• Fitness

• Proximity (Car lock, Children in Mall)

HEMIL PATEL
21
CKPCET, SURAT
Cont.,
• BLE is superior to classic Bluetooth because it has the advantage of saving power.

• BLE supported by Android, IOS, Blackberry, etc. BLE is supported by macOS, Windows 8/10 and
Linux variants.

Features of BLE:

1. It is license free and hence does not add any costing related overhead to the system.

2. There is no restriction with respect to manufacturers.

3. BLE modules are inexpensive and much affordable.

4. The size of BLE chips are small, hence not occupy much space on board.

5. Power consumption is also very minimal and hence is very suitable to IoT applications.

6. Range offer by BLE is much higher and better then the previous versions.

HEMIL PATEL
22
CKPCET, SURAT
Components of BLE
• BLE has three components from its architectural perspective.
BLE
1. Application Block: User application is situated here. It interacts
directly with the Bluetooth stack. Controller
Application
2. Host Block: This is the upper layer of the Bluetooth stack.

3. Controller Block: This is the lower layer of the Bluetooth stack. Host

4. Host Controller Interface: It is used to interface the controller with


the host.

HEMIL PATEL
23
CKPCET, SURAT
BLE Protocol Stack

HEMIL PATEL
24
CKPCET, SURAT
Cont.,
1. Controller: Controller has the HCI, link layer and physical layer under its umbrella, wherein

a. Host Controller Interface (HCI) (for the controller side) is used to enable interoperability
between hosts and controllers assembled by different manufacturers (increased
heterogeneity). The same kind of interface is also available for host side.

b. Link Layer (LL) defines packet structure.

c. Physical Layer (PHY) takes care of the transmission/reception. Recollecting the OSI layer and
physical layer’s functionalities, same is applied here. Physical layer takes care of modulation/
demodulation. Physical layer is responsible for analog to digital conversion.

HEMIL PATEL
25
CKPCET, SURAT
Cont.,
2. Host: Now we describe the components of the host and their functionalities.
a. Generic Access Profile (GAP) takes care of the device discovery, connection establishment, connection management and
security. This layer is “MANDATORY” for all BLE devices.
b. Generic Attribute Profile (GATT) oversees the data exchange process. Whenever there is need to push data and to read or to
write the data, the generic guidelines with respect to the process re governed by GATT.
c. Attribute Protocol (ATT) is the protocol for accessing data.
d. L2CAP, expanded as Logical Link Control and Adaptation Protocol, is responsible for fragmentation and de-fragmentation of
the application data. Also, it administers the multiplexing and de-multiplexing of channels over the shared logical link. (Many
regard this layer as Mux Layer.)
e. Security Manager (SM) handles pairing, authentication, and encryption. Everything related to the security aspect is taken care
here.
f. Host Controller Interface (HCI): As in controller side, there is HCI for host side as well. The functionality remains the same as
that in the controller.

HEMIL PATEL
26
CKPCET, SURAT
Cont.,
3. Application Layer: One should again connect the application layer in the Open System
Interconnection (OSI) model. Same is the scenario here with BLE. This layer is responsible for
user interface, logic and data handling.

HEMIL PATEL
27
CKPCET, SURAT
BLE Topology
• A BLE device communicates with outside world by broadcasting and
connections.
• Broadcasting: It means sending out a message to more than one recipient.
The same concept is followed in BLE.
• With the broadcast, “data” is sent out “one-way”. Whichever device is capable
of picking the data, will receive the data.
• There are two parts of broadcasting- broadcaster and observer.

HEMIL PATEL
28
CKPCET, SURAT
Cont.,
• The broadcaster sends out the “non-connectable” Observer Observer
advertising packets in frequent intervals to all those
who are willing to collect it.
Bluetooth
• The observer will keep scanning at the pre-set Observer Broadcaster (it Observer
is device)
frequency to receive any non-connectable packets
that are being broadcasted
• It should be noted that broadcasting is the only way
Observer Observer
a device can transmit data to more than one
receiver at a time.

HEMIL PATEL
29
CKPCET, SURAT
Cont.,
• Connections:
• This is second possible way of communication. A connection is permanent and enables periodical data
transfer between two devices.
• The term master-slave configuration comes into picture in this case.
• The master will try to find out the connectable advertising packets. If found the connection will be
initiated.
• After the connection is established, the central device will take care of the periodic data exchange.
• The slave will keep periodically sending the connectable advertising packets. When there is an incoming
request, it would be accepted by the slave to whom it is addressed.
• When two devices are connected, it is called connection event. This is ideal for power saving.

HEMIL PATEL
30
CKPCET, SURAT
Cont.,
Slave Slave
(Peripheral) (Peripheral)

Slave Master (Could Slave


(Peripheral) be your mobile) (Peripheral)

Slave Slave
(Peripheral) (Peripheral)

HEMIL PATEL
31
CKPCET, SURAT
Classic Bluetooth versus BLE
Specifications Classic Bluetooth Bluetooth Low Energy (BLE)
Range 100m Greater than 100m
Data rate 1-3 Mbps 1 Mbps
Application throughput 0.7-2.1 Mbps 0.27 Mbps
Frequency 2.4 GHz 2.4 GHz
Robustness Adaptive fast frequency 24-bit CRC, 32-bit message
hopping, FEC, fast ASK integrity check
Latency 100 ms 6 ms
Voice capable Yes No
Network topology Star Star
Power consumption 1W 0.01 to 0.5 W
Perk current consumption Less than 30 mA Less than 30 mA

HEMIL PATEL
32
CKPCET, SURAT
Wi-Fi
• Wi-Fi => Wireless Fidelity.

• Data rate Approx. 54 Mb/Sec.

• Based on IEEE 802.11 Specification.

• LAN – For in-building network connectivity.

• Support for Wi-Fi is now available in everything (Laptop, Phone, Kettle, Navigation systems
etc.)

HEMIL PATEL
33
CKPCET, SURAT
Cont.,
• Wi-Fi (wireless fidelity) is a term for certain types of wireless local area network (WLAN) that use specifications in
the 802.11 family.

• The 802.11 specifications are part of an evolving set of wireless network standards known as the 802.11 family.

• The term Wi-Fi was created by an organization called the Wi-Fi Alliance, which oversees tests that certify product
interoperability.

• The Wi-Fi Alliance defines Wi-Fi as any "wireless local area network (WLAN)” products that are based on the
Institute of Electrical and Electronics Engineers (IEEE) 802.11 standards.

• The Wi-Fi Alliance is a trade association that promotes Wireless LAN technology and certifies products if they
conform to certain standards of interoperability.

• Originally, Wi-Fi certification was applicable only to products using the 802.11b standard. Today, Wi-Fi can apply to
products that use any 802.11 standard.
HEMIL PATEL
34
CKPCET, SURAT
Cont.,
• It is a technology that permits an electronic device to transfer data using radio waves (type of
electromagnetic radiation) over a computer network, including high-speed Internet connections.

• It works up to about 250-300 feet away from the access point indoors, and about 1,000 feet away
outdoors.

• With more distance between your computer/laptop and the access point, the speed and the quality falter
tremendously

HEMIL PATEL
35
CKPCET, SURAT
What is hotspot ?
• Wi-Fi is widely used in many businesses, agencies, schools, and homes as an alternative to a wired LAN.
Many airports, hotels, and fast-food amenities offer communal access to Wi-Fi networks.
• These locations are known as hotspots. Many Wi-Fi providers charge a daily or hourly rate for access, but
some are free. An interconnected area of hot spots and network access points is known as a hot zone.
• Unless sufficiently protected, a Wi-Fi network can be vulnerable to access by illegal users who use the
access as a gratis Internet connection.
• The action of locating and exploiting security-exposed wireless LANs is called war driving.
• Any entity that has a wireless LAN should use security safeguards such as the Wired Equivalent Privacy
(WEP) encryption standard, the more recent Wi-Fi Protected Access (WPA), Internet Protocol Security
(IPSec), or a virtual private network (VPN).

HEMIL PATEL
36
CKPCET, SURAT
Advantages: Disadvantages:
• Wire free • Designed for medium range data transfers
• Easy access • Operates with in a particular range
• Automatic allowance of use • Signal quality falters when user moves away
• Ability for 802.11b and 802.11g to frequency from the access points
hop • Wired Equivalent Privacy easily broken even
• Supports roaming, the user can walk around when configured accurately
a building from one access point to another

HEMIL PATEL
37
CKPCET, SURAT
Li-Fi
• We are now using too many devices connected to internet.

• Everything and anything, from watches to the water heater is connected. There are some concerns
related to consumption of internet, which are follows:
1. Is the Internet through Wi-Fi safe?

2. How much bandwidth availability would be sufficient for devices/equipment?

3. How safe is your data?

4. Increase in umber of devices will lead to congestion. How is this handled?

• Light Fidelity (Li-Fi) is one of the solution to the above concerns.

•Li-Fi has a speed of 224 GBPS and is the fastest.

HEMIL PATEL
38
CKPCET, SURAT
Cont.,
• In Li-Fi, light is used as a medium to transfer/transport data. It does not require any special
equipment that would make it expensive to achieve the target.

• The light (bulbs) which is used in the offices/homes is sufficient, but with some minor
modifications to facilitate data transfer.

HEMIL PATEL
39
CKPCET, SURAT
Features of Li-Fi
• It has high speed and is bi-directional.

• It is used for communication of data.

• Light is the source, that is, data transfer happens through light.

• Light is generated through light bulbs, which makes the use of Li-Fi inexpensive.

• Unlike Wi-Fi, data is transferred through the light spectrum using Li-Fi.

• Unlike all the challenges in Wi-Fi with respect to security, bandwidth, etc., can be avoided using
Li-Fi.

HEMIL PATEL
40
CKPCET, SURAT
How Li-Fi Work?
• With Li-Fi, we need is a light source to transfer data. Basically, if we have a light bulb, we can have
the possibility of high-speed data transfer.

• For Li-Fi to work, we need modified LED bulbs/lights which can transmit data.

•LED is preferred as it is a semiconductor device and hence will have switching characteristics,
which are important for data transmission.

HEMIL PATEL
41
CKPCET, SURAT
HEMIL PATEL CKPCET, SURAT 42
Functioning of Li-Fi
1. Data is transmitted over Li-FI by modulating the intensity of light; that is, essentially dimming the light or
turning it on and off at a very high speed.

2. The modulation happens real quick and human eyes cannot really feel or capture it.

3. The light is received by the photodetector and demodulation (processing) happens to generate the data stream
sent by the transmitter.

4. All the LED lamps (shown in Fig.) need an LED lamp driver.

5. The lamp driver gets information from the server and encoding occurs here.

6. After this, LED illumination (flicker) takes place.

7. The photodetector (shown in Fig.) will be able to read this and convert it into data(after
amplification/processing).

HEMIL PATEL
43
CKPCET, SURAT
Advantages: Disadvantages:
• Light cannot penetrate through walls, it is • It could be short range due to the presence of
extremely safe and no data hijacking will walls.
happen. • The Infrastructure set up could take a bit
• Efficient more time to make it practically viable.
• Li-Fi is the fastest. • There is no clarity on how the receiving
• It is an effective alternate to RF. device will transmit data back to the
transmitter.

HEMIL PATEL
44
CKPCET, SURAT
Internet Protocol Version 4 (IPv4)
• An IP address is a unique identification for a node which is connected on a network.
• Networks using TCP/IP protocol route messages based on this unique IP address only.
Typically IP address will look like 10.10.127.220.
• This is called as IP-Version 4 and IP Version6 is also being used globally these days. (We shall
see that too…)
• IP addresses are 4 bytes or 32 bits long.
• They can be represented as binary or decimal format.
• Since decimal formats are much easier to remember many stay with decimal way of writing
IP.

HEMIL PATEL
45
CKPCET, SURAT
Cont.,

HEMIL PATEL
46
CKPCET, SURAT
Class A
• This class is meant for a very huge network.
• In this IP address class, first octet can be from 1 to 126.
• It means there can be 126 networks possible with Class A. The first bit of first octet will
always be set to zero.
• The Remaining 24 bits (3 octets) represent the host ID. With this class there can be (2 ^ 24)-
2)) IP addresses.
• It is close to 17 million hosts per network.
• So, it is overt that this class IP will be used by large networks.

HEMIL PATEL
47
CKPCET, SURAT
Cont.,
• 127 is used as a loop back address which is used for trouble shooting purpose. This means that
it is used by the host computer to send a message back to itself. It is commonly used for
troubleshooting and network testing. The ping has been done with 127.0.0.1.
• Here in the calculation (2 ^ 24)-2)), -2 is done as 1st and 255th are meant for network id and
broadcast id respectively.

HEMIL PATEL
48
CKPCET, SURAT
Class B
• It is meant for medium sized networks. An instance would be a school or a college campus.
• it was finished with 127 there in class A, so here it will start with 128. It ends with 191.
• Class B addresses will have second octet included as Net ID and so only 2 octets will be part
of host id.
• The first two bits of the first octet are fixed to 1 0. Hence in this case (2 ^ 14) - 2, i.e. 16,384
networks are possible each with 65,534 hosts.
• Class B addresses can be identified on a glance with looking at the first byte. If it is from 128
to 191, one can confirm it as class B IP.

HEMIL PATEL
49
CKPCET, SURAT
Class C
• Class C IP addresses are used in small networks.
• First 3 octets are representing the net id and last octet is representing the net id.
• Since class B ended with 191, here it starts with 192 and goes till 223.
• First three bits of first octet are fixed as 1 1 0 for class C address. So 21 bits will form the net
id. It allows 2,097,152 networks and 254 ((2 ^ 8)- 2 ) hosts per network.

HEMIL PATEL
50
CKPCET, SURAT
Class D and Class E
• Class D: This class is used for multicasting. Class D, in first its first octet has first bit as 1,
second bit as 1, third too is 1 and the 4th bit is 0. The addresses start with 224 and ends
with 239.
• Class E: Class E IP addresses are used for experimental purposes only. Like Class D, it is
different from the first three classes. It has a first bit value of 1, second bit value of 1, third
bit value of 1 and fourth bit value of 1.

HEMIL PATEL
51
CKPCET, SURAT
Protocol Format
• IP Version Number: It is half a byte field (4 bits)
which indicates which version of IP is being
utilized. Here the discussion is fully on Version 4.
So this field has the value 4 in binary (0100). The
basic idea of using this version field is to ensure
the compatibility between the versions of IP that
might be used in network.
• Internet Header Length: This length specifies
internet header length in 32 bit words, and points
to the beginning of the data. Minimum value for a
correct header is 5. (0101)

HEMIL PATEL
52
CKPCET, SURAT
Cont.,
• Type of service: This is an eight bit field which indicates on the quality of service. QoS can be
precedence, delay and reliability.
Delay - This is the 4th bit
and it indicates the delay. If it
is ‘0’ then it indicates the
normal delay and ‘1’
indicates a lower delay.
Throughput – ‘0’ indicates
normal delay and ‘1’
indicates high throughput.
Reliability - ‘0’ indicates
the normal reliability
and ‘1’ indicates the high
reliability.

HEMIL PATEL
53
CKPCET, SURAT
Cont.,
• Total Length – This is a 16 bit field which defines the length of the IPV4 datagram. Thus length
includes header and data. Minimum length of the IP datagram is 20 bytes and the maximum can be
65,535 bytes (2 ^ 16 = 65535).
• Identification – This is an identification aid added by sender to help in assembling the fragments.
• This is a 16 bits field.
• Helps in organizing data.
• If the message sent is too large to fit in one packet, it will be then spilt to multiple child packets.
• To identify them all there will be a unique identifier for all the spilt packets. This makes the receiver’s
job easier to rebuild the received data.

HEMIL PATEL
54
CKPCET, SURAT
Cont.,
• Flags– Flags field is composed of three bits.
• First bit of that will be always zero and it is
kept unused. Second bit is called as DF (Don’t
Fragment) flag, DF if set to ‘0’ IP datagram can
be fragmented.
• And if set to ‘1’ it cannot be fragmented. Next
bit is called as More Fragments (MF) which if
set will indicate that more fragments are
coming on the way

HEMIL PATEL
55
CKPCET, SURAT
Cont.,
• Fragment offset - When fragmentation of a message occurs, this field
specifies the offset, or position, in the overall message where the data in
this fragment goes. It is specified in units of 8 bytes (64 bits). The first
fragment has an offset of 0.
• Time to Live- This is an 8 bit field and this indicates the time that IP
datagram should survive. There will be a time set and that will be
decremented by 1 and router will be having an eye on it. When it reaches
zero the datagram can be discarded.
• Protocol – This will serve as an identifier for the higher layer protocol
carried in the IP datagram. The protocols can be ICMP, IGMP, TCP or UDP.
Figure 5.8 reveals few of the protocols used for this field along with Hex
code.
HEMIL PATEL
56
CKPCET, SURAT
Cont.,
• Header checksum - A checksum computed over the header to provide basic protection against
corruption in transmission. It is just a 16-bit checksum. It is calculated by dividing the header bytes into
words and then adding them together. The data is not check summed, only the header. At each hop the
device receiving the datagram does the same checksum calculation and on a mismatch, discards the
datagram as damaged.
• Source address -The 32-bit IP address of the source (originator) of the datagram.
• Destination address - The 32-bit IP address of the destination which will have to receive the IP
datagram.
• Options – There are lot of optional header settings available and they are used for the debugging/testing
and security purposes.
• Padding - Internet Protocol Options field may vary in length. So the Padding field provides additional
zero bits so that the total header length is an exact multiple of 32 bits.

HEMIL PATEL
57
CKPCET, SURAT
Internet Protocol Version 6 (IPv6)
• It has come to overcome the difficulties faced with IPV4.
• IP V6 - version 6, is also named as the next generation protocol for the internet
• It also works in Layer 3 (No different from the V4)
• Has more addresses and multiple features to appreciate.
• As conveyed a little earlier, IP addresses are the main problem with IPV4. It is just 4 bytes
wide and it provides room for 2^32 unique IP addresses which are getting exhausted now
due to extensive usage of them.
• IPV6 provides support for 2^128 unique IP addresses, a substantial increase in number of
computers that can be addressed with the help this scheme.

HEMIL PATEL
58
CKPCET, SURAT
Cont.,
1. More number of IP address is the primary benefit.
2. Much better and efficient routing.
3. IPsec framework is made mandatory in IPV6, which is not so in IPV4. This increases the security.(Now,
this is optional)
4. An additional flow label is added in header of IPV6, which can improve the Quality of Service.
5. IPV6 supports new applications such as IP telephony, video/audio, interactive games etc., with a
ensured QoS where IPV4 is not so as it is a best effort service. So QoS is one of the most important
benefits with IPV6.
6. Plug and play abilities have been improved in IPV6.
7. IPV6 has eliminated the need for Network Address Translation due to the huge availability of IP
addresses.

HEMIL PATEL
59
CKPCET, SURAT
Cont.,
• IPv6 cuts down some IPv4 header fields or move them to IPv6 extension headers to reduce the load of
basic IPv6 headers, thus making IPv6 packet handling simple and improving the forwarding efficiency.
• Although the IPv6 address size is four times that of IPv4 addresses, the size of basic IPv6 headers is 40
bytes and is only twice that of IPv4 headers (excluding the Options field)

HEMIL PATEL
60
CKPCET, SURAT
Cont.,
• Version - 4 bits - It is used to represent the version of IP being used. In IPV4 it is 4 and here in IPV6 it is 6.
• Traffic Class - 8 bits - An 8-bit field that provides the means of identifying different classes or priorities of
IPv6 packets. It replaces the TOS field of IPV4.
• MSB 6 bits are used for Type of Service to let the Router Known what services should be provided to this packet.

• LSB 2 bits are used for Explicit Congestion Notification

• Flow Label - 20 bits - Used to identify the sequence of packets. It helps in prioritizing the packet delivery. It
helps in providing real time service. The vital packets can be delivered ahead of the lower priority packets.
• Payload length -16 bits - Identifies the length of the IPv6 payload (the rest of the packet following the IPv6
header). It is used in the place of Total Length of IPV4.
• Next header - 8 bits - This is similar to the protocol field in IPV4 header. It represents the type of extension
header that follows the primary IPV6 header.

HEMIL PATEL
61
CKPCET, SURAT
Cont.,
• Hop limit - 8 bits - TTL (Time To Live) is being replaced by Hop Limit in IPV6 header. The value in this field is
decremented by one every time the packet passes through a host that forwards the packet. When the value
reaches zero, the packet will be discarded.
• Source Address - As in IPV4, this specifies the sender's IP 128 bit address.
• Destination Address - Again it is similar to IPV4. The destination's IP address is denoted here.

HEMIL PATEL
62
CKPCET, SURAT
Cont.,
• IPv4 addresses are simple which are composed of 32 bits, and represented as 133.78.21.56 where decimal representation is
used and period (.) is used as a separator. This is different with IPV6.

• IPv6 addresses are 128 bits long, written in hexadecimal, and separated by colons. An example would be:
3ffe:1900:4545:3:200:f8ff:fe21:67cf

• Colons separate 16-bit fields. Leading zeros can be omitted in each field as can be seen above where the field :0003: is written
:3:.

• In addition, a double colon (::) can be used once in an address to replace multiple fields of zeros.

• For example:

• fe80:0:0:0:200:f8ff:fe21:67cf can be written as fe80::200:f8ff:fe21:67cf.

• Rather than simply suppressing the leading zeros, you can get rid of all of the sequential zeros and replace them with two
colons. The two colons tell the operating system that everything in between them is a zero.

• IPV6 can also be written in IPV4 format. An instance would be 10.122.132.10 can be represented as ::ffff:10.122.132.10.

HEMIL PATEL
63
CKPCET, SURAT
URI (Universal Resource Identifier) / URL / URN
• URI – Sequence of characters – used to identify
resources.
• Resources can be Logical or Physical.

• Guidelines issued by IETF – Internet Engineering Task Force.

• URI Has URN / URL in it that Means, URL / URN are


drive from URI.

• URIs tries to identifying a resource through a name and


to provide a means of locating the resource by
describing its primary access mechanism.

• URN defines an item’s identity, whereas URL renders a


method for finding it.
HEMIL PATEL
64
CKPCET, SURAT
URL (Uniform Resource Locator)
• URL Has information about how to fetch / acquire a resource from its location.

• Note the following:

• URLs always begin with a protocol. (Most obvious, HTTP)

• It will have the details about the host name

• It will have the path.

• A URL is used when a client is raising a request to the server for the service.

HEMIL PATEL
65
CKPCET, SURAT
URN (Uniform Resource Name)
• A resource is identified through a name. But, remember this, it will not tell you how to spot it / locate it
on the internet.

• There is a prefix URN for all the URNs.

• When you specify "access mechanism, location" and URI becomes URL.

• urn:vehiclenumber:0451450523 to identify a vehicle by its vehicle number

• Summary:

• URIs are identifiers, and that can mean name, location, or both.

• URNs and URLs are URIs, Vice versa is not correct.

• URL is the combination of the name and an access method, such as https://, or mailto:.

HEMIL PATEL
66
CKPCET, SURAT
Assignment Questions
1. Explain the importance of MQTT protocol with respect to IoT infrastructure. And Explain how MQTT can
be used for subscribe/publish process.

2. Discuss the CoAP message types with relevant examples.

3. Draw the BLE stack and explain the components.

4. What are the possible topological options with BLE? Draw the necessary diagrams and explain the same.

5. What is Internet Protocol all about? How many classes are there in IPv4?

HEMIL PATEL
67
CKPCET, SURAT

You might also like