IOT Notes Unit-3 Part-B
IOT Notes Unit-3 Part-B
IOT Notes Unit-3 Part-B
The application support layer in Figure 2.1 interfaces the lower portion of the
stack dealing with the networking of ZigBee devices with the higher-layer
applications. ZigBee predefines many application profiles for certain
industries, and vendors can optionally create their own custom ones at this
layer.
ZigBee IP is a critical part of the Smart Energy (SE) Profile 2.0 specification
from the ZigBee Alliance. SE 2.0 is aimed at smart metering and residential
energy management systems. In fact, ZigBee IP was designed specifically
for SE 2.0 but it is not limited to this use case. Any other applications that
need a standards based IoT stack can utilize Zigbee IP. The ZigBee IP stack
is shown in Figure 2.2
ZigBee smart energy is designed for a large range of IoT applications including
smart homes, remote controls and healthcare systems. It supports a wide range of
network topologies including star, peer-to-peer, or cluster-tree. A coordinator
controls the network and is the central node in a star topology, the root in a tree or
cluster topology and may be located anywhere in peer-to-peer. ZigBee standard
defines two stack profiles: ZigBee and ZigBee Pro. These stack profiles support
full mesh networking and work with different applications allowing
implementations with low memory and processing power. ZigBee Pro offers more
features including security using symmetric-key exchange, scalability using
stochastic address assignment, and better performance using efficient many-to-one
routing mechanisms
Features:
• low cost, low power and short range typically about 10 meters
• It can exchange information with other Bluetooth device over a radio.
• It creating a small network of devices that are close to one another.
• Support IEEE802.15.4
• 2.4GHz frequency range
Advantages :
• It is cheap
• Easy to install
• It makes connecting to different devices convenient
• It is wireless
• It is free to use if the device is installed with it
Disadvantages:
• Wireless networking between laptops and desktop computers, or desktops that are
in a confined space and little bandwidth is needed.
• The transfer of files, images and MP3, between mobile phones.
• Bluetooth technology headsets for smart phones and cell phones.
• Data logging equipment that transmits data to a computer via Bluetooth
technology.
IPv4 Header vs IPv6 Header
IPv6 is using two main types of headers: Main IPv6 Header and the new IPv6 Extension
Headers. The main IPv6 header is equivalent to the IPv4 one with some field differences
introduced for better efficiency. Figure 1 compares both headers.
Figure 1. Comparing IPv4 and IPv6 headers
Note that the IPv6 header has fewer fields which makes it more efficient and faster to
process. Another big advantage is that the header length is fixed size 40 bytes, comparing to
the variable length size of the IPv4 header.
Version
The Version field is a 4-bit long identifier of the IP protocol version. Needles to say, it is set
to 4 in IPv4 and 6 in IPv6.
Figure 2. IPv6 Version field
Traffic Class
The Traffic Class field is an 8-bit long identifier of the packet’s class or priority. It is the
same concept as the Type of Service field in the IPv4 header. The first 6 bits of the Traffic
Class field represents the DSCP field as defined in RFC 2474, and the last 2 bits are used for
ECN as defined in RFC 3168.
Figure 4. IPv6 Traffic Class Field
Originally, in IPv4 only the first 3 bits were used as QoS value called IP Precedence. Later it
was superseded by the Diffserv technology that uses the first 6 bits and the value is
called Differentiated Services Code Point or just DSCP.
Flow Label
The Flow Label is a 20-bit long field that indicates to intermediate devices that a packet
belongs to a specific sequence of packets between a source and a destination. IPv6 routers
use this field to distinguish different traffic flow between the same source and destination, for
example, different TCP sessions between the same endpoints. When the Flow label value is
set to 0 means that the packet is not associated with any specific flow.
Figure 5. IPv6 Flow Label field
Payload Length
The IPv6 Payload field is a 16-bit identifier of the length in bytes of the data portion of a
packet including any IPv6 Extension headers. The length does not include the main IPv6
header. As you can see in Figure 3, any extension headers are considered part of the payload
portion. In contrast, the IPv4 Total Length field measures the length of the entire IP packet
including the IPv4 header.
Figure 6. IPv6 Payload-Length Field
Both the IPv4 Total-Length and IPv6 Payload-length fields are 16-bit long, therefore
allowing for up to 65,355 byte-long packets. In reality, most IP packets (both v4 and v6) are
1500 byte-long due to a technology called Maximum Transmission Unit (MTU), which
defines the maximum size of a packet that can pass through the link. However, IPv6 can
carry larger payloads than 65,355 bytes using the Jumbo Payload option in the Hop-by-hop
extension header. These larger packets are called jumbograms and are defined in RFC 2675.
Jumbograms IPv6 packets can carry payloads between 65,536 and 4,294,967,295 bytes. They
are used inside very-high-speed datacenters and supercomputers.
Next Header
The Next Header is an 8-bit field that specifies either the type of the first extension header (if
any) or the upper-layer protocol in the payload such as TCP, UDP, or ICMPv6. The field is
similar to the IPv4 Protocol field but with some additional options. When indicating an
upper-layer protocol, the IPv6 Next Header field uses the same values that are used in the
IPv4 Protocol.
Figure 7. IPv6 Next Header Field
Some of the most common values are shown in the table below.
In UDP, the checksum field is optional, but since there is no checksum field in the IPv6
header when UDP is carried by IPv6, the checksum field is mandatory.
In IPv6, the Hop Limit field is basically the same thing, just the name has been changed to
more precisely describe the function of the field.
In IPv4, all network layer devices are allowed to fragment packets if the DF-bit (don't
fragment) is not set. For example, if a router receives a packet that is larger than the MTU of
the outgoing interface, the router divides the packet into multiple packets and send them out.
The final destination is then responsible to reassemble the fragments into the original IP
packet. Such an example is shown in figure 9.
The three IPv4 fields Identification, Flags, and Fragmentation Offset are used in this
fragmentation handling process.
In IPv6, routers do not fragment packets. When an IPv6 router receives a packet larger than
the MTU of the outgoing interface, the router discards the packet and sends an ICMPv6
"Packet Too Big" message back to the sender. The message includes the MTU value of the
egress link, so the source can adjust the packet size and retransmit. This process is called
Path MTU Discovery and is described in RFC 1981, Path MTU Discovery for IP Version 6.
An example is shown in figure 10.
Example
Here is an example of an ICMPv6 Echo Request packet that uses the default Traffic Class,
Flow Label, and a Hop Limit of 128. It is sent between two nodes using link-local addresses.
Frame:
+ Ethernet: Etype = IPv6
- Ipv6: Next Protocol = ICMPv6, Payload Length = 40
- Versions: IPv6, Internet Protocol, DSCP 0
Version: (0110............................) IPv6, Internet Protocol, 6(0x6)
DSCP: (....000000......................) DSCP 0
ECT: (..........0.....................) ECN-Capable Transport not set
CE: (...........0....................) ECN-CE not set
FlowLabel: (............00000000000000000000) 0
PayloadLength: 40 (0x28)
NextProtocol: ICMPv6, 58(0x3a)
HopLimit: 128 (0x80)
SourceAddress: FE80:0:0:0:0:0:11FA:3BF1
DestinationAddress: FE80:0:0:0:135A:BFFF:D313:D427
+ Icmpv6: Echo request, ID = 0x0, Seq = 0x18
Summary
Let's quickly summarize what we have learned in this lesson in the following table:
Fields that have the same functionality and the same name in IPv4 and IPv6
Source Address Source The network layer identifier of the sender of the packet. 32-bit in IPv4 and is
Address increased to 128-bit in IPv6.
Table 2. Comparing IPv4 and IPv6 Header fields
Destination Address Destination The network layer identifier of the receiver of the packet. 32-bit in IPv4 and is
Address increased to 128-bit in IPv6.
Fields that have the same functionality but their names were changed
Type of Service Traffic Class Used for traffic classification and marking. Nowadays, both protocols use the 6-
bit Differentiated Services technique (DSCP).
Total Length Payload Indicates the length of the IP packet. In IPv4 the length includes both the IP
Length header and the data. In IPv6, the length includes the data plus any extension
headers but does not include the main IP header.
Time to Live Hop Limit Both fields have the same function. They ensure that packets do not loop around
the network indefinitely.
Protocol Next Header Indicates the protocol being transported in the payload portion. In IPv6, it could
also indicate the existence of an extension header.
Fields that exist in IPv4 and have been removed from IPv6
Internet Header In IPv4, this field is used in cases when the header is variable length. It is not
Length needed in IPv6, because the v6 header is a fixed-length - 40 bytes.
Identification, Flags, In IPv4, these fields are used when doing fragmentation. In IPv6, only the source
Fragment Offset of the packet is performing fragmentation using the Fragmentation extension
header.
Header Checksum After many years of experience, the designers of IPv6 decided that this field is
redundant and not necessary anymore because there are checksum fields in the
upper layer protocols.
Options Options are now handled using the extension headers in IPv6, so this field is not
necessary.
Flow Label A new field in IPv6 that is used for identifying that a packet is part of a sequence
and has to be handled the same way as the entire traffic flow.
6LoWPAN
Header Compression
IPv6 header compression for 6LoWPAN was defined initially in RFC
4944 and subsequently updated by RFC 6282. This capability shrinks the
size of IPv6’s 40-byte headers and User Datagram Protocol’s (UDP’s) 8-byte
headers down as low as 6 bytes combined in some cases. Note that header
compression for 6LoWPAN is only defined for an IPv6 header and not IPv4.
The 6LoWPAN protocol does not support IPv4, and, in fact, there is
no standardized IPv4 adaptation layer for IEEE 802.15.4. 6LoWPAN header
compression is stateless, and conceptually it is not too complicated.
However, a number of factors affect the amount of compression, such as
implementation of RFC 4944 versus RFC 6922, whether UDP is included,
and various IPv6 addressing scenarios.
At the top of Figure 2.15, you see a 6LoWPAN frame without any
header compression enabled: The full 40- byte IPv6 header and 8-byte UDP
header are visible. The 6LoWPAN header is only a single byte in this case.
Notice that uncompressed IPv6 and UDP headers leave only 53 bytes of data
payload out of the 127- byte maximum frame size in the case of IEEE
802.15.4.
Fragmentation
The maximum transmission unit (MTU) for an IPv6 network must be at least
1280 bytes. The term MTU defines the size of the largest protocol data unit
that can be passed. For IEEE 802.15.4, 127 bytes is the MTU. This is a
problem because IPv6, with a much larger MTU, is carried inside the
802.15.4 frame with a much smaller one. To remedy this situation, large
IPv6 packets must be fragmented across multiple 802.15.4 frames at Layer 2.
Mesh Addressing
The purpose of the 6LoWPAN mesh addressing function is to
forward packets over multiple hops. Three fields are defined for this header:
Hop Limit, Source Address, and Destination Address. Analogous to the IPv6
hop limit field, the hop limit for mesh addressing also provides an upper
limit on how many times the frame can be forwarded. Each hop decrements
this value by 1 as it is forwarded. Once the value hits 0, it is dropped and no
longer forwarded.
The Source Address and Destination Address fields for mesh addressing are
IEEE
802.15.4 addresses indicating the endpoints of an IP hop. Figure 2.17
details the 6LoWPAN mesh addressing header fields.
Note that the mesh addressing header is used in a single IP subnet and
is a Layer 2 type of routing known as mesh-under. RFC 4944 only provisions
the function in this case as the definition of Layer 2 mesh routing
specifications was outside the scope of the 6LoWPAN working group, and
the IETF doesn’t define “Layer 2 routing.” An implementation performing
Layer 3 IP routing does not need to implement a mesh addressing header
unless required by a given technology profile.