Professional Documents
Culture Documents
Lecture 4: Network
− Network Module
− Routing Technologies
− Performance Issues
2
Network Module
3
Network Module
4
Network Module
5
Network Module: Roles
− Management:
− Packet: Adapting the packet sizes and formats
− Address: Adapting and/or resolving addresses
− Device: Joining/leaving of nodes
− Service: Providing adds-on services such as security
− Operational:
− Route discovery & maintenance
− Packet forwarding
6
Routing Technologies
7
Common Routing Techniques
− Flooding
− When receiving a packet, each node rebroadcasts the
packet
− No memory is kept in a node
− Very wasteful in bandwidth usage
− Source Routing
− A source node partially or completely specifies the route
that a packet should be forwarded
− Source node is responsible for finding the route to the
destination
− Implementation: DSR
8
Common Routing Techniques
− Distance Vector
− Exchange distance vectors only with neighbours to
establish routing tables
− Less traffic for table maintenance makes it suitable for
wireless networks
− Implementation: RIP, AODV, etc
− Link State
− Flood link information in the network and use Dijkstra’s
algorithm to compute routing tables
− Popular solution in wired network. Not adequate for
wireless, as it requires network-wide flooding
− Implementation: OSPF, OLSR, etc
9
Common Routing Techniques
− Path Vector
− Based on distance vector, path information is used
instead of distance
− Permit implementation of some policy to take control of
the route
− Used in inter-domain routing
− Implementation: BGP
10
Route Establishment & Maintenance
− Proactive (table-driven):
− Nodes maintain a table describing how a packet should
be forwarded to destinations
− It is more suitable for networks with static topology
− Reactive (on-demand):
− Upon a request, nodes flood the network to find the
destination
− It is more suitable for networks with changing topology
− Mixed:
− Hybrid: Operate both proactive and reactive routing
− Hierarchical: Separate nodes into different levels and
use different routing techniques in different levels 11
Routing in IoT
12
Flooding
Broadcast
the packet
Source
Destination
A first received
G
the packet
B D from D
(ABDF)
E Destination
F H
13
Source Routing
14
Source Routing: Example
A
A-B A-B-D RREQ
Source RREP
A-B-D-H A-B-D
A G
B D
A-B-D-G
A
A-B-D-H C A-B-D-H
A-C
A-B E Destination
F H
15
Distance Vector
I 24 36 18 27 7 20 31 20 0 10 22 33
E F G H
H 20 31 19 8 30 19 6 0 14 12 22 9
10+18
K 21 28 36 24 22 40 31 19 22 6 0 9
8 12
17
AODV: RREQ
Source
A G
B D
A G
B D
− Enhancements
− Intermediate nodes with information to the destination
can reply RREP
− Add sequence numbers to packets to avoid duplicate
rebroadcasting
− Use “time to live” to limit the rebroadcasting of RREQ
20
IPv6 Routing Protocol for Low-Power
and Lossy Networks (RPL)
− Background:
− Need for Low power and Lossy Networks (LLN)
− IETF formed a Working Group called Routing Over Low
power and Lossy Networks (ROLL) in 2008
− ROLL developed “Ripple” routing protocol (RPL)
21
RPL
22
RPL: DOGAG Building Process
− Procedure:
− The root starts broadcasting DIO
− Upon receiving DIO, each node
− computes its rank based on the OF
− chooses a neighbour with a rank lower than itself as
preferred parent
− broadcasts DIO message
Preferred parent
Root
DIO
A G
DIO B D
DIO
C
B received 2 DIO E
messages & set A as F H
23
preferred parent
RPL: DOGAG Building Process
− Procedure (cont’d):
− The broadcasting of DIO continues until all nodes have
seen the DIO
− By now, each node should have nominated one of its
neighbours to be its preferred parent
− A tree is built for UPWARD routing (or MP2P traffic)
Preferred parent
Root
A G
B D
E
F H
24
RPL: P2MP & P2P
− Topology maintenance
− A Trickle timer to control the sending rate of DIO
− When routing inconsistencies are detected (e.g. loops,
loss of a parent, etc), Trickle timer is reset to the
minimum value to get the problems fixed quickly
26
Mesh-under versus Route-over
27
Performance Issues
28
Network Performance
− Power Supply:
− limited power supply
− Power Consumption:
− Power consumption of communications is relatively high
− Network establishment and maintenance need
communications
− Departure of some nodes may cause the network to fail
partially or totally (e.g. nodes connecting to the
gateway, nodes connecting two islands of networks, etc)
29
Performance:
− Deployment of nodes:
− Bottleneck: When all flows aggregate at a particular
node, the node may represent the bottleneck of the
network
− Possible solutions: add more nodes to create other
paths; add gateways to divert traffic flows
This node needs to When all nodes transmit a packet,
forward packet for a large this node needs to transmit its
group of nodes packet and relay 7 others!
30
Performance:
− Deployment of nodes:
− Network lifetime: Nodes nearer to the gateway perform
more packet forwarding tasks. Their departures (due to
flat battery) may cause the network to fail.
− Possible solutions: add more nodes around the gateway;
use higher capacity battery
When this node fails, a group
of nodes will be disconnected
from the gateway
31
Performance:
− Position of a gateway:
− Bottleneck: Gateway may become bottleneck of traffic
flows if not adequately positioned in the network
− Possible solutions: reposition the gateway or nodes
around it and/or add more gateways to ease the
congestion
32
Performance:
− Position of a gateway:
− Delay: Nodes far away from the gateway may result in
long end-to-end transmission delay
− Possible solutions: relocating the gateway and/or place
more gateways. Ideally, we should keep the number of
hops between a node and the gateway as low as
possible
Some packets need 6 hops to
reach the gateway!
33
Network Programming in Contiki
34
Network Programming in Contiki
− Two Packages
− The uIP TCP/IP stack:
− It provides Internet communication abilities to Contiki.
− The uIP implementation is designed to have only the
absolute minimal set of features needed for a full TCP/IP
stack. It can only handle a single network interface and
contains the IP, ICMP, UDP and TCP protocols.
− The Rime communication stack: our focus
− It provides a set of lightweight communication primitives
ranging from best-effort anonymous local area broadcast to
reliable network flooding.
35
The Rime Communication Stack
Modules
− Rime buffer management, Packet queue, Rime queue buffer
management, Anonymous best-effort local area broadcast,
Announcements, Rimebroadcastannouncement, Best-effort local
area broadcast, Link estimate management, Collect neighbor
management, Tree-based hop-by-hop reliable data collection, Ipolite
best effort local broadcast, Mesh routing, Best-effort multihop
forwarding, Neighbor discovery, Best-effort network flooding,
Rimepoliteannouncement, Polite anonymous best effort local
broadcast, Rime addresses, Rime route discovery protocol, Rime
route table, Single-hop reliable bulk data transfer, Multi-hop reliable
bulk data transfer, Single-hop reliable unicast, Stubborn best-effort
local area broadcast, Stubborn unicast, Reliable single-source multi-
hop flooding, Single-hop unicast.
36
Example:
Best-effort local area broadcast
Data Structures
struct broadcast_callbacks;
struct broadcast_conn;
Functions
void broadcast_open (struct broadcast_conn *c,
uint16_t channel,
const struct broadcast_callbacks *u)
// Set up an identified best-effort broadcast connection.
struct broadcast_callbacks {
void (*recv)(struct broadcast_conn *ptr, const rimeaddr_t *sender);
void (*sent)(struct broadcast_conn *ptr, int status, int num_tx);
}
struct broadcast_conn {
struct abc_conn c;
const struct broadcast_callbacks *u;
}
struct abc_conn {
struct channel channel;
const struct abc_callbacks *u;
};
38
Best-effort local area broadcast
Broadcasting a packet
#include "net/rime.h"
...
static const struct broadcast_callbacks broadcast_call = {broadcast_recv};
static struct broadcast_conn broadcast;
PROCESS_THREAD(example_broadcast_process,
static void ev, data)
{ broadcast_recv(struct broadcast_conn *c, const rimeaddr_t *from)
static struct
{ etimer et;
PROCESS_EXITHANDLER(broadcast_close(&broadcast);)
printf("broadcast message received from // exit '%s'\n",
%d.%d: process handler
PROCESS_BEGIN(); from->u8[0],
broadcast_open(&broadcast, 129, &broadcast_call); // open a handler
from->u8[1],
while(1) { (char *)packetbuf_dataptr());
/* Delay
} 2-4 seconds */
etimer_set(&et, CLOCK_SECOND * 4 + random_rand() % (CLOCK_SECOND * 4));
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
41
Questions?
42