distributed systems 26. mobile ad hoc mesh networkspxk/417/notes/content/26-adhoc-slides.pdf ·...

35
Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski [email protected] 12/16/2011 1 © 2011 Paul Krzyzanowski

Upload: others

Post on 08-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Distributed Systems

26. Mobile Ad Hoc Mesh Networks

Paul Krzyzanowski

[email protected]

12/16/2011 1 © 2011 Paul Krzyzanowski

Page 2: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Mesh Networks

• Mobile Ad-hoc networks, sensor networks, …

• Decentralized networking

• No need for routers or access points

• Each node participates in routing

12/16/2011 2 © 2011 Paul Krzyzanowski

Page 3: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Mesh Networks

• Topology of the network has to be discovered

– Nodes come and go or move around

• Topology may change frequently → on-demand routing

– New nodes announce themselves

– Other nodes listen for announcements

• Often low-range, battery-powered devices

– Multiple hops are common

12/16/2011 3 © 2011 Paul Krzyzanowski

Page 4: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Mesh Networking

• Hop node-to-node until the destination is reached

– Nodes can act as repeaters to nearby peers

– Robust connectivity: find alternate routes

• Dynamic routing

– Table-based: maintain fresh lists of destinations/routes

– Dynamic: find route on demand

– Hierarchical

– Geographical

– Power-aware

– Multicast

See http://en.wikipedia.org/wiki/Ad_hoc_routing_protocol_list 12/16/2011 4 © 2011 Paul Krzyzanowski

Page 5: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Dynamic Source Routing (DSR)

• On-demand routing

• Source routing: sender learns the complete set of hops

needed to reach the destination

– Every packet carries the path of hops in its header

• Intermediate nodes do not need to store routing

information to route packets

12/16/2011 5 © 2011 Paul Krzyzanowski

Page 6: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

• Broadcast Route Request message for some destination

node, D, to all connected (reachable) nodes

• Receiving node:

– If it saw a packet with this ID, ignore request

– If node ≣ node D: send back a Route Reply message to the path

in the header

– Else: add node ID to the path and forward Route Request to

connected nodes

• Note:

– Path is maintained throughout the Route Request

– Loops are prevented (don’t route to a node in the path)

12/16/2011 6 © 2011 Paul Krzyzanowski

Page 7: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a (S,D)

(S,D)

12/16/2011 7 © 2011 Paul Krzyzanowski

Page 8: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a

(S, a, D)

b will drop the request to route S to D if it saw the same Route Request ID

12/16/2011 8 © 2011 Paul Krzyzanowski

Page 9: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a

(S, b, D)

(S, b, D)

12/16/2011 9 © 2011 Paul Krzyzanowski

Page 10: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a (S, b, c, D)

d will drop the request to route S to D since it saw the same Route

Request ID from b earlier

(S, b, c, D)

12/16/2011 10 © 2011 Paul Krzyzanowski

Page 11: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a

(S, b, d, D) (S, b, d, D)

At around the same time, c will drop the request to route S to D since it

saw the same Route Request ID from b earlier

12/16/2011 11 © 2011 Paul Krzyzanowski

Page 12: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a

e routes to d. D is the destination!

(S, b, c, e, D)

12/16/2011 12 © 2011 Paul Krzyzanowski

Page 13: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Route discovery via flooding

D

e

c

b

S

d

f

a

D sends a Route Reply back to S via the path.

Request: (S, b, c, e, D)

Reply: (D, e, c, b, S)

12/16/2011 13 © 2011 Paul Krzyzanowski

Page 14: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Source Routing

• Once a route is known

– Path is specified with the packet header

– If delivery fails, path will need to be rediscovered

• Optimizations

– Every node that sees packets or Route Reply messages learns how to

reach all the nodes listed in the route.

– Nodes can maintain tables to minimize learning routes

– More-frequently used routes may be considered to be more accurate

– Maintain and optimize for Distance Vector

• Distance Vector = number of hops

• Replace known routes with new routes with smaller distance vector

– Or test new routes with a potentially smaller distance vector

12/16/2011 14 © 2011 Paul Krzyzanowski

Page 15: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Table Driven Routing

• When a node learns of a newly accessible node, it adds

it to its routing table

– Propagates updated routing table to other nodes

(those nodes forward it, etc.)

– Everyone’s routing table is kept updated

• No need to perform dynamic routing

• No need to send source route in each packet

• Downside: extra network traffic for table propagation

– May be worthwhile if the environment is not dynamic

12/16/2011 15 © 2011 Paul Krzyzanowski

Page 16: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Example: ZigBee

• ZigBee (IEEE 802.15.4)

– 192 kbps

– 100-1000 ft. range

• ZenSys Z-Wave

Screw-in lamp module

$38

Dimmer switch $38

Outdoor plug module

$40

12/16/2011 16 © 2011 Paul Krzyzanowski

Page 17: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

ZigBee

• Wireless star or mesh network

– Star: single coordinator; no routing

• Self-configuring

• Redundant paths

• Self-healing

12/16/2011 17 © 2011 Paul Krzyzanowski

Page 18: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

ZigBee device types

• Coordinator

– Starts & controls network

– Stores info about the network

– Repository for security keys

• Router

– Extends network coverage, provides backup routes

– Connects to coordinator, other routers, & end devices

• End devices

– Transmit or receive a message

– Does not perform routing – must connect to a coordinator or router

• Roles may be combined:

– Light socket: router or coordinator & end device

– Battery-powered light switch: end device (mostly off)

12/16/2011 18 © 2011 Paul Krzyzanowski

Page 19: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Joining & Routing

• Joining

– Device sends a request to [re] join a network to the coordinator or router

– In the simplest case, it has the network key

• Routing

– Based on Distance Vector routing

• Distance Vector = number of hops to the destination

– Each router maintains a routing table with entries for each destination

– Routing table entry stores a distance vector & next router

• Learning routes

– Originating device broadcasts a route request

– Destination device sends a a route reply

– Intermediate nodes build up routing tables

12/16/2011 19 © 2011 Paul Krzyzanowski

Page 20: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

ZigBee Security

• Encryption

– All network traffic is encrypted with 128-bit AES

• Trust Center

– Maintains network key; periodically sends key updates

(new key encrypted with old key)

– Runs on a designated trusted device

– Decides whether to allow new devices onto its network

• Keys

– Master keys: initial shared secret between two devices. Used to

generate Link Keys

– Network keys: all devices on a network share the same key

– Link keys: optional for application-level encryption between two

devices

12/16/2011 20 © 2011 Paul Krzyzanowski

Page 21: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

ZigBee setup

• Out-of-the-box device can join any network

• Installer:

– Uses dedicated device with ZigBee coordinator

– Device joins a “commissioning network”

– Installer commissions device to identify correct network &

security settings

• Master key & Trust Center address configured

• If master key is not configured

– May sent on an insecure channel during configuration

– Some implementations (Certicom’s) support public-key based

key exchange using ECC (Elliptic Curve Cryptography)

• Less compute (power) overhead than RSA or Diffie-Hellman

12/16/2011 21 © 2011 Paul Krzyzanowski

Page 22: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Network-Based Plug & Play

12/16/2011 22 © 2011 Paul Krzyzanowski

Page 23: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Ad-hoc networking and auto-discovery

• Device/service discovery and control

– Microsoft, Intel: UPnP

– Apple: Bonjour

• Universal Plug and Play architecture

– http://www.upnp.org

• Networked devices

– Unreliable: nodes added/removed unpredictably

– Programs need to talk to programs (services)

12/16/2011 23 © 2011 Paul Krzyzanowski

Page 24: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

• Apple (primarily)

• Goal: advertise & discover services on a LAN

• allocate addresses without a DHCP server

– Use 169.254/16 zeroconf range

• translate between names and IP addresses without a DNS server

– Multicast DNS: Use IP multicast for DNS queries (mDNSResponder)

• locate or advertise services without using a directory server

– Use DNS services (DNS or multicast DNS)

– Structured Instance Names

• SRV record: <Instance>.<Service>.<Domain> gives target IP, port

• TXT record with same name: extra info as key/value pairs

– PTR record: service type to see all instances of the service

Bonjour

12/16/2011 24 © 2011 Paul Krzyzanowski

Page 25: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

SRV example

• Example DNS SRV record

myprinter._printer._tcp.local. 120 IN SRV 0 0 5432 myserver.local.

• DNS TXT record

– May contain additional information.

– Example:

• Different print queues for printer services on the same IP address

– Information is application-specific

• PTR record _printer._tcp.local. 28800 PTR myprinter._printer._tcp.local.

– Allows one to query DNS for all services of type _printer.

TTL port host

12/16/2011 25 © 2011 Paul Krzyzanowski

Page 26: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Bonjour steps

• New device

– Is there a DHCP server?

• If yes, get IP address and routing info

• If no, pick an address in the link-local (zeroconf) range: 169.254.0.0

– Test the address and claim it if nobody responds

– Start up Multicast DNS responder

• Requests a chosen hostname

• Multicasts query to see if it’s taken

• Claims it if not taken

– Start up service (get port)

– Publish service (friendly name, service name, address, port)

• Create SRV record friendly_name.service_name._tcp.local

that points to the hostname and port for the service

• Create PTR record service_name._tcp.local

12/16/2011 26 © 2011 Paul Krzyzanowski

Page 27: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

UPnP strategy

• Send data only over network

– No executables

• Use standard protocols

• Leverage standards

– HTTP, XML

• Basic IP network connectivity

12/16/2011 27 © 2011 Paul Krzyzanowski

Page 28: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Communication

• Between…

– Control points

• Controller usually client

– Device controlled

• Usually server

• Device may take on both functions

Control Point

Device

12/16/2011 28 © 2011 Paul Krzyzanowski

Page 29: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 0

• Control point and device get addresses

– DHCP

– Or AutoIP

• IETF draft: automatically choose IP address in ad-hoc IPv4 network

• Pick address in 169.256/16 range – see if it’s used

DHCP request DHCP request

DHCP server

address address

Control point Device

12/16/2011 29 © 2011 Paul Krzyzanowski

Page 30: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 1

• Control point finds device

– Devices advertise (broadcast) when added

• Periodic refresh

– Control points search as needed

• Devices respond

– Search for types of service

• Guarantee minimal capabilities

advertise Detect device

Control point Device

12/16/2011 30 © 2011 Paul Krzyzanowski

Page 31: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 2

• Control point learns about device capabilities

– SSDP: Simple Service Discovery Protocol

• IETF draft

• Administratively scoped multicast

• Unicast responses

– Get URL for description

• Actions, state variables expressed in XML

Response Discover Protocol

Control point Device

12/16/2011 31 © 2011 Paul Krzyzanowski

Page 32: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 3

• Control point invokes actions on device

– Send request, get result

– SOAP messages

Get command Invoke action

Control point Device

12/16/2011 32 © 2011 Paul Krzyzanowski

Page 33: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 4

• Control point listens to state changes of device

– Push model

– GENA: General Event Notification Architecture

Event Detect event

Control point Device

12/16/2011 33 © 2011 Paul Krzyzanowski

Page 34: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

Step 5

• Control point controls device and/or views device status

with HTML

Get request http://192.168.1.12/status

Control point Device

12/16/2011 34 © 2011 Paul Krzyzanowski

Page 35: Distributed Systems 26. Mobile Ad Hoc Mesh Networkspxk/417/notes/content/26-adhoc-slides.pdf · Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu

The End

12/16/2011 35 © 2011 Paul Krzyzanowski