ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)

Page created by Evelyn Strickland
 
CONTINUE READING
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
ELEC-E7320 Internet
Protocols, Spring 2020
Welcome!
Department of Communications and Networking
(COMNET)
Yu Xiao 23.1.2020
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
Learning Outcomes
After this lecture, you will be able to
• Describe the key features of 6LoWPAN, MQTT and CoAP
• Summarize the design criteria of networking protocols for
   constrained devices

                                                              22.1.2020
                                                                      2
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
Internet of Things (IoT)

                           22.1.2020
                                   3
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
IoT for Smart Cities

                       22.1.2020
                               4
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
Value is Created by Making Sense of
Data

 Source: http://www.slideshare.net/mazlan1/current-trends-in-internet-of-things-iot

                                                                                      22.1.2020
                                                                                              5
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
IoT from an Embedded Systems Point
of View

                                 22.1.2020
                                         6
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
How to connect sensors to the Internet?

                                          22.1.2020
                                                  7
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
IoT Protocols

   Source: http://www.cse.wustl.edu/~jain/cse570-15/ftp/iot_prot.pdf

                                                                       22.1.2020
                                                                               8
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
6LoWPAN: IPv6 over Low Power Wireless Personal Area
Network

                                                      22.1.2020
                                                              9
ELEC-E7320 Internet Protocols, Spring 2020 Welcome! - Department of Communications and Networking (COMNET)
6LoWPAN stack example

                        22.1.2020
                               10
What are the advantages of IP?

                                 22.1.2020
                                        11
Many Advantages of IP
• Extensive interoperability
  • Other wireless embedded 802.15.4 network devices
  • Devices on any other IP network link (Wi-Fi, Ethernet, …)
• Established naming, addressing, translation, lookup,
   discovery
• Established proxy architecture for higher-level services
  • NAT, load balancing, caching, mobility
• Established application level data model and services
  • HTTP/HTML/XML/SOAP/REST
• Established network management tools
                                                                22.1.2020
                                                                       12
Many Advantages of IP
• Transport protocols
  • End-to-end reliability in addition to link reliability
• Established security
  • Authentication, access control and firewall mechanisms
• Most “industrial” standards support IP option

             Source: http://voip.netlab.uky.edu/~fei/teaching/cs687_smartgrid/slides/4.6LoWPAN-tutorial.pdf

                                                                                                      22.1.2020
                                                                                                             13
TCP/IP is not one size fits all

                                  22.1.2020
                                         14
6LoWPAN
• Try to optimize the transmission of IPv6 packets over low
   power and lossy network such as 802.15.4
• RFC6282:
  • Header compression: compresses the 40-byte IPv6 and 8-byte
    UDP headers by assuming the usage of common fields
  • Fragmentation and reassembly: The data link of IEEE
    802.15.4 with a frame length of maximum 127 bytes does not match
    the MTU of IPv6, which is 1280 bytes.
  • Stateless auto configuration: the process where devices inside
    the 6LoWPAN network automatically generate their own IPv6
    address.
                                                                22.1.2020
                                                                       15
IPv6 Header Compression
• Defining some default values in IPv6 header
 •   Version==6, traffic class & flow-label == 0, hop-limit only well-known
     values (1, 64, 255)
 •   Remove the payload length (available in 6LoWPAN fragment header or
     data-link header)
 •   Addresses (link-local, global, multicast)

                                                                          22.1.2020
                                                                                 16
Header Compression

         Send data to direct neighbors

                                              In this example, assume that
                                              interface ID is derived from
                                              MAC address.

         http://www.ti.com/lit/wp/swry013/swry013.pdf            22.1.2020
                                                                        17
Header Dispatch

                  22.1.2020
                         18
6LoWPAN stacked headers

                          22.1.2020
                                 19
6LoWPAN
•   A 6LoWPAN system is a low-power wireless mesh network where every
    node has its own IPv6 address allowing it to connect directly to the
    Internet

                         The compressed IPv6 header needs an intermediary
                         device to provide a conversion between 6LoWPAN
                         and standard IP header.
                                                                        22.1.2020
                                                                               20
6LoWPAN stack example

                        22.1.2020
                               21
Design Principles of MQTT (MQ
Telemetry Transport)

• Minimize network bandwidth and device resource requirements
  whilst also attempting to ensure reliability and some degree of
  assurance of delivery.

                                                                22.1.2020
                                                                       22
MQTT (MQ Telemetry Transport)

• Publish/subscribe instead of request/response
• Many-to-Many communication
• Extremely simple and lightweight messaging protocol
• For constrained devices and low-bandwidth, high-
  latency or unreliable networks
• MQTT v3.1.1 is an OASIS Standard

                                                  22.1.2020
                                                         23
MQTT
• MQTT has a client/server model, where every sensor is a client
  and connects to a server, known as a broker, over TCP.
• Publish/Subscribe

MQTT broker is in charge of dispatching all messages
between the senders and the rightful receivers.

                                                               22.1.2020
                                                                      24
Topic
• The topic is the routing information for the broker
• Clients don’t have to know each other, they only communicate
  over the topic

                https://www.hivemq.com/blog/how-to-get-   22.1.2020
                started-with-mqtt/                               25
Topic
• A topic is a simple string that can have more hierarchy levels,
   which are separated by a slash
• Examples:
  • House/living-room/temperature
  • House/+/temperature
  • House/#

                                                             22.1.2020
                                                                    26
MQTT Packets

               22.1.2020
                      27
MQTT Quality of Service
• The Quality of Service (QoS) level is an agreement between the
   sender of a message and the receiver of a message that defines
   the guarantee of delivery for a specific message.
  ü At most once (0)
  ü At least once (1)
  ü Exactly once (2)
• Two sides of message delivery
  ü Message delivery from the publishing client to the broker
  ü Message delivery from the broker to the subscribing client

                                                              22.1.2020
                                                                     28
QoS 0, 1

 QoS 0 (fire and forget)

 QoS 1 – at least once

                https://www.hivemq.com/blog/mqtt-essentials-part-6-   22.1.2020
                mqtt-quality-of-service-levels/                              29
QoS 2

QoS 2 –exactly once

(four-way handshake)

                       22.1.2020
                              30
Packet Identifiers
• The packet identifier that MQTT uses for QoS 1 and QoS 2 is
  unique between a specific client and a broker within an interaction.
• This identifier is not unique between all clients.
• Once the flow is complete, the packet identifier is available for
  reuse. This reuse is the reason why the packet identifier does not
  need to exceed 65535

                                                                 22.1.2020
                                                                        31
Open Source Software
•   Mosquitto https://www.eclipse.org/mosquitto/noteworthy/
•   EMQtt: http://emqtt.io/
•   Vernemq: https://vernemq.com/
•   …

                                                          22.1.2020
                                                                 32
• Is TCP too expensive for a small device?

• How about TCP-less protocols?
  • MQTT-SN (MQTT for Sensor Networks): UDP mapping of MQTT
    and broker support for indexing topic names
  • CoAP (Constrained Application Protocol)
   •   Inspired by HTTP, but use UDP

                                                        22.1.2020
                                                               33
CoAP (Constrained Application
Protocol)

                                22.1.2020
                                       34
CoAP
• CoAP is a specialized web transfer protocol for use with
  constrained nodes and constrained networks in the Internet of
  Things
• The protocol is designed for machine-to-machine (M2M)
  applications such as smart energy and building automation
• One-to-one communication protocol (RFC 7252)
• Based on REST model, like HTTP
• CoAP can carry different types of payloads, and can identify which
  payload type is being used. CoAP integrates with XML, JSON, or
  any data format of your choice.

                                                                22.1.2020
                                                                       35
CoAP Design Requirements

                                 Source: ARM

          https://tools.ietf.org/html/draft-shelby-core-coap-22.1.2020
          req-04#page-3                                             36
CoAP
•   Embedded web transfer protocol (coap://)
•   Asynchronous transaction model
•   UDP binding with reliability and multicast support
•   Built-in discovery
•   Optional observation and block transfer
•   Caching
•   …

                                                         22.1.2020
                                                                37
CoAP Messages
Each CoAP message has a unique id, this is useful to detect
message duplicates. A CoAP message is built by 3 parts:
  ü a binary header
  ü a compact options
  ü payload
• Message types
  ü Confirmable: a reliable message which is retransmitted until ACKed
  ü Non-confirmable
  ü Acknowledgement
  ü Reset
                                                                 22.1.2020
                                                                        38
CoAP Messages: Examples

https://www.survivingwithandroid.com/2018
/11/coap-protocol-tutorial.html

                                            22.1.2020
                                                   39
CoAP Request/Response

        Tokens are chosen by the client and help to
        identify request/response pairs that span several   22.1.2020
                                                                   40
        message exchanges
MQTT vs. CoAP ?

                  22.1.2020
                         41
22.1.2020
       42
Design criteria of network protocols for constrained devices

                                                               22.1.2020
                                                                      43
Designing Networking Protocols for
Constrained Devices
•   Low cost, low speed, low power communication
•   Limited transmit range -> multi-hop
•   Compressed header -> compatibility
•   Short message -> how to avoid message fragmentation
•   Lossy network -> reliability?
•   …

                                                          22.1.2020
                                                                 44
Challenges
• There are many competing technologies and standards
  ü One size does not fit all!
  ü Interoperability? How can devices be seamlessly connected?
• Connectivity
  ü E.g. in industrial contexts (hot, humid environments with no
    cell or Wi-Fi connectivity and/or far away from urban centers)
• Huge amount of data à local processing
• Security and privacy
• Regulations and laws

                                                                     22.1.2020
                                                                            45
Questions?

             22.1.2020
                    46
You can also read