0% found this document useful (0 votes)
17 views31 pages

Chapter 4

Uploaded by

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

Chapter 4

Uploaded by

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

Chapter 4

Protocols for IoT –


Addressing and
Identification

All these are taught @ link -


https://www.youtube.com/playlist?list=PL3uLubnzL2Tm5PAw88N1jR9MLTJpuPEnX

“Internet of Things, 2nd Edition”


Shriram K Vasudevan, Abhishek S Nagarajan, & RMD Sundaram
Copyright  2020 Wiley India Pvt. Ltd. All rights reserved.
Agenda

 Infrastructure Protocols
 IPV4
 IPV6
 Identification
 URIs
 Data Protocols
 MQTT / CoAP
IP V4 – A Quick Recap

 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.
Contd.,
Class A

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.
Contd.,

• 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.
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.
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.
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.
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)
Contd.,

 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
Reliability - ‘0’ normal delay and ‘1’
indicates the normal indicates high throughput.
reliability and ‘1’
indicates the high
reliability.
Contd.,

 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.
Contd.,

 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
Contd.,

 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.
Contd.,

 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.
Contd.,

 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.

LET US GO TO ------ IPv6


Some Questions….

How can someone get to know the MAC address in a windows machine?

How can someone get to know the details of IP addresses configured, in a


windows machine?
Contd.,

 How can someone get to know the details of IP addresses configured, in a


Linux / Unix machine?
 ifconfig - a
IP V6

 Let us go to IP V6 Now!
 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.
Contd.,

 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.
So…

 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.
Contd.,
 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)
Contd.,

 1. 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.

 2. 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

 3. 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.
Contd.,

 4. 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.
 5. 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.
 6. 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.
 7. Source Address - As in IPV4, this specifies the sender's IP 128 bit address.
 8. Destination Address - Again it is similar to IPV4. The destination's IP address is
denoted here.
Contd.,

 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.
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.

 Let us make this understanding clearer! URI Has URN / URL in it . Means, URL / URN are babies of the mother
URI.
 URIs tries this: identifying a resource through a name and to provide a means of locating the
resource by describing its primary access mechanism.
 Also, this is a cute definition: URN defines an item’s identity, whereas URL renders a method for finding it.
Lets get deeper – URL first.

 All what I talk is based on ”RFC 3986 - Uniform Resource Identifier (URI)”
 What is RFC? Folks, you must know it!
 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.
 An example follows:
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:.
Let us summarize… With the
identification

 URL: ftp://ftp.is.co.za/rfc/rfc1808.txt
 URL: http://www.ietf.org/rfc/rfc2396.txt
 URL: ldap://[2001:db8::7]/c=GB?objectClass?one
 URL: mailto:[email protected]
 URL: news:comp.infosystems.www.servers.unix
 URL: telnet://192.0.2.16:80/
 URN (not URL): urn:oasis:names:specification:docbook:dtd:xml:4.1.2
Ref: Stack overflow
Lets learn more!

You might also like