IOT Communication Models and Protocols
IOT Communication Models and Protocols
Chapter1:
IOT communication models and protocols
Presented by:
Mrs:Amruta .S. Mane
SIBIC institute of technology
• IOT communication models and protocols
•The application layer is the interface between the IoT device and the
network with which it will communicate. It handles data formatting and
presentation and serves as the bridge between what the IoT device is
doing and the network handoff of the data it produces.
The right protocol for a particular IoT application depends on a number
of factors based on the type of device involved and the function it
will perform:
• Data latency. How fast does data transport need to be? How much
time can reasonably pass for a data packet to move from one point
to another?
• Reliability. How consequential is data loss in the IoT application?
How redundant must device communication be?
• Bandwidth. What's the volume of data that needs to be
accommodated?
• Transport. What's the best transport protocol for the IoT
application? TCP, UDP and HTTP each offer features that can be
exploited by application layer protocols with which they're
compatible.
HTTP
• Hyper Text Transfer Protocol
• WWW is about communication between web clients and
servers
•NON (Non-confirmable)
•ACK (Acknowledgement)
•RST (Reset)
1. Confirmable(CON)
• Message
• Client
• Server or Broker
• TOPIC
• Message
The message is the data that is carried out by the protocol across the
network for the application. When the message is transmitted over
the network, then the message contains the following parameters:
1. Payload data
2. Quality of Service (QoS)
3. Collection of Properties
4. Topic Name
• Client
In MQTT, the subscriber and publisher are the two roles of a client. The
clients subscribe to the topics to publish and receive messages. In simple
words, we can say that if any program or device uses an MQTT, then that
device is referred to as a client. A device is a client if it opens the network
connection to the server, publishes messages that other clients want to
see, subscribes to the messages that it is interested in receiving,
unsubscribe to the messages that it is not interested in receiving, and
closes the network connection to the server.
•Support for unreliable networks: Many IoT devices are connected via
unreliable cellular networks. MQTT's support for persistent sessions
reduces the time to reconnect the client to the broker.
•Security: MQTT allows you to easily use TLS to encrypt messages and
use modern authentication protocols (such as OAuth) to authenticate the
client.
AMQP
• Message orientation,
• Queuing,
• Routing,
• Reliability and security,
• Targeted Qos (Quality of service),
• Standards compliance and safety,
• Persistence,
• Delivery of message to multiple consumers,
• High speed protocol, etc.
Components of AMQP
• Message Queue.
• Exchanges and Exchange Types.
• Binding.
• Message and Content.
• Connection.
• Channel.
• Virtual Hosts.
• AMQP Methods.
• Message Queue
A queue acts as a buffer that stores messages that are consumed later.
A queue can also be declared with a number of attributes during
creation. For instance, it can be marked as durable, auto-delete and
exclusive, where exclusive means that it can be used by only one
connection and this queue will be deleted when that connection closes.
• Exchanges and Exchange Types
A channel routes messages to a queue depending on the exchange
type and bindings between the exchange and the queue. For a queue to
receive messages, it must be bound to at least one exchange.
AMQP 0.9.1 brokers should provide four exchange types - direct
exchange, fanout exchange, topic exchange, and header exchange. A
deeper understanding of the different exchange types, bindings, routing
keys and how or when you should use them can be found in RabbitMQ
for beginners - Exchanges, routing keys and bindings.
An exchange can be declared with a number of attributes during
creation. For instance, it can be marked as durable so that it survives a
broker restart, or it can be marked as auto-delete meaning that it’s
automatically deleted when the last queue is unbound.
•Binding
A binding is a relation between a queue and an exchange consisting of a
set of rules that the exchange uses (among other things) to route
messages to queues.
•Connection
A connection in AMQP 0.9.1 is a network connection between your application
and the AMQP broker, e.g. a TCP/IP socket connection.
•Channel
A channel is a virtual connection inside a connection, between two AMQP
peers. Message publishing or consuming to or from a queue is performed over
a channel (AMQP). A channel is multiplexed, one single connection can have
multiple channels.
•Virtual Hosts
Virtual hosts (vhost) provide a way to segregate applications in the broker. Different
users can have different access privileges to different vhost. Queues and exchanges
is created so they only exist in one vhost.
•AMQP Methods
AMQP 0.9.1 provides a number of methods or operations that can be performed.
Some examples of AMQP methods are opening a channel, declaring a queue or
deleting an exchange (channel.open, queue.declare or exchange.delete-ok)
•Message Producers are the source of messages. It sends messages
to specific destinations such as Queue or Topics which is then
consumed by the subscribers.
•Message Consumers are the subscribers that receive/read the
published messages and processes it.
•Message Brokers are the servers like ActiveMQ, RabbitMQ which does
the heavy lifting such as routing the messages to the right destination,
ensuring its delivery and durabilities and so on. Brokers are the
middleware between producers and consumers. This is the reason why it
is often referred to as Message Oriented Middleware. A message broker
can have further components like Queues, Topics, Exchanges etc
depending on the vendors.
•Messages are the main reason why messaging architecture exists, it is
the actual content with headers and metadata. The message body
(content) can contain binary, JSON, XML, plain text type and etc data.
Communication APIs
• IPv4 is still the widely used network layer protocol used for
networking computers. IPv4 addresses are expressed as dotted
decimal numbers. The address consist of four octets (32-bit number)
divided into two parts – network address to uniquely identify a TCP-
IP or IOT network and host address to identify host within the
identified network.
• Parts of IPv4
• Network part:
The network part indicates the distinctive variety that’s
appointed to the network. The network part conjointly
identifies the category of the network that’s assigned.
• Host Part:
The host part uniquely identifies the machine on your
network. This part of the IPv4 address is assigned to every
host.
For each host on the network, the network part is the same,
however, the host half must vary.
• Subnet number:
This is the nonobligatory part of IPv4. Local networks that
have massive numbers of hosts are divided into subnets and
subnet numbers are appointed to that.
• Characteristics of IPv4
• IPv4 could be a 32-Bit IP Address.
• IPv4 could be a numeric address, and its bits are separated by a
dot.
• The number of header fields is twelve and the length of the header
field is twenty.
• It has Unicast, broadcast, and multicast style of addresses.
• IPv4 supports VLSM (Virtual Length Subnet Mask).
• IPv4 uses the Post Address Resolution Protocol to map to the MAC
address.
• RIP may be a routing protocol supported by the routed daemon.
• Networks ought to be designed either manually or with DHCP.
• Packet fragmentation permits from routers and causing host.
•IP (version 4) addresses are 32-bit integers that can be expressed in
hexadecimal notation. The more common format, known as dotted quad
or dotted decimal, is x.x.x.x, where each x can be any value between 0
and 255. For example, 192.0.2.146 is a valid IPv4 address.
•IPv4 still routes most of today’s internet traffic. A 32-bit address space
limits the number of unique hosts to 232, which is nearly 4.3 billion IPv4
addresses for the world to use (4,294,967,296, to be exact).
Header Format
•An IPv4 datagram consists of a header and a data field. The first
20 bytes in the header are mandatory for all IPv4 datagrams. The
Options field following the 20 bytes has a variable length.
IP header includes many relevant information including Version Number,
which, in this context, is 4. Other details are as follows −
• Version − Version no. of Internet Protocol used (e.g. IPv4).
• IHL − Internet Header Length; Length of entire IP header.
• DSCP − Differentiated Services Code Point; this is Type of Service.
• ECN − Explicit Congestion Notification; It carries information about the
congestion seen in the route.
• Total Length − Length of entire IP Packet (including IP header and IP
Payload).
• Identification − If IP packet is fragmented during the transmission, all
the fragments contain same identification number. to identify original IP
packet they belong to.
• Flags − As required by the network resources, if IP Packet is too large
to handle, these ‘flags’ tells if they can be fragmented or not. In this 3-bit
flag, the MSB is always set to ‘0’.
• Fragment Offset − This offset tells the exact position of the
fragment in the original IP Packet.
•Time to Live − To avoid looping in the network, every packet is sent
with some TTL value set, which tells the network how many routers
(hops) this packet can cross. At each hop, its value is decremented by
one and when the value reaches zero, the packet is discarded.
•Protocol − Tells the Network layer at the destination host, to which
Protocol this packet belongs to, i.e. the next level Protocol. For
example protocol number of ICMP is 1, TCP is 6 and UDP is 17.
•Header Checksum − This field is used to keep checksum value of
entire header which is then used to check if the packet is received
error-free.
•Source Address − 32-bit address of the Sender (or source) of the
packet.
•Destination Address − 32-bit address of the Receiver (or destination)
of the packet.
•Options − This is optional field, which is used if the value of IHL is
greater than 5. These options may contain values for options such as
Security, Record Route, Time Stamp, etc.
Advantages of IPv4
•IPv4 security permits encryption to keep up privacy and security.
Now that we know about what is IPv6 address let’s take a look at its
different types.
1. Unicast addresses
It identifies a unique node on a network and usually refers to a single
sender or a single receiver.
2. Multicast addresses
It represents a group of IP devices and can only be used as the
destination of a datagram.
3. Anycast addresses
It is assigned to a set of interfaces that typically belong to different
nodes.
IPV6 packet format
An IPv6 basic header is fixed as 40 bytes long and has eight fields.
Each IPv6 packet must have an IPv6 basic header that provides
basic packet forwarding information, and which all devices parse
on the forwarding path.
• Version: 4 bits long. In IPv6, the value of the Version field is set to
6.
• Traffic Class: 8 bits long. This field indicates the class or priority of
an IPv6 packet. The Traffic Class field is similar to the TOS field in
an IPv4 packet and is mainly used in QoS control.
• Flow Label: 20 bits long. This field was added in IPv6 to
differentiate traffic. A flow label and source IP address identify a data
flow. Intermediate network devices can effectively differentiate data
flows based on this field.
• Payload Length: 16 bits long. This field indicates the length of the
IPv6 payload in bytes. The payload is the part of the IPv6 packet
following the IPv6 basic header, including the extension header and
upper-layer PDU. This field has a maximum value of 65535. If the
payload length exceeds 65535 bytes, the field is set to 0, and the
Jumbo Payload option in the Hop-by-Hop Options header is used to
express the actual payload length.
• Next Header: 8 bits long. This field identifies the type of the first
extension header that follows the IPv6 basic header or the protocol
type in the upper-layer PDU.
•Hop Limit: 8 bits long. This field is similar to the Time to Live field in an
IPv4 packet, defining the maximum number of hops that an IP packet can
pass through. Each device that forwards the packet decrements the field
value by 1. If the field value is reduced to 0, the packet is discarded.
•Source Address: 128 bits long. This field indicates the address of the
packet originator.
•Destination Address: 128 bits long. This field indicates the address of the
packet recipient.
Unlike the IPv4 packet header, the IPv6 packet header does not carry IHL,
identifier, flag, fragment offset, header checksum, option, or padding fields,
but it carries the flow label field. This facilitates IPv6 packet processing and
improves processing efficiency. To support various options without
changing the existing packet format, the Extension Header information field
is added to the IPv6 packet header, improving flexibility. The following
paragraphs describe IPv6 extension headers.
Advantages of IPv6
1. Reliability
2. Faster Speeds: IPv6 supports multicast rather than broadcast
in IPv4.This feature allows bandwidth-intensive packet flows
(like multimedia streams) to be sent to multiple destinations all
at once.
3. Stringer Security: IP Security, which provides confidentiality,
and data integrity, is embedded into IPv6.
4. Routing efficiency
5. Most importantly it’s the final solution for growing nodes in
Global-network.
IPv4(Internet Protocol version 4) IPv6(Internet Protocol version 6)
1. Dispatch header :Dispatch header is 8 bits long (Figure 2a). First two bits
are 00 or 01 to indicate dispatch header while the next 6 bits are user to
distinguished between the header type to follow next in this packet. “000001”
for uncompressed IPv6 and “000010” for HCI IPv6 compressed encoding.
2. Mesh header :Mesh header is identified by “10” (Figure 2b). Mesh header is
4 bytes long and deals with the encoding of hop count and link layer source
and destination of packets.
3. Fragmentation headers :Size of fragmentation header in 4 bytes if it is a
first fragment header while 5 bytes for each subsequent fragment header
(Figure 2c and 2d). Fragmentation header is mostly used when a large
packet is come to a node because 802.15.4 can support the payload up to
102 bytes for a frame.
Applications