Zafar Shahid Zero Configuration Networking 1
Zero Configuration
Networking
by
Zafar Shahid
Oct. 8 2017
Silicon Valley Code Camp, San Jose CA
Zafar Shahid Zero Configuration Networking 2
Have you heard the term ZERO-CONF ?Have you heard the term ZERO-CONF ?
1394
DVD and HDTV /
Display
Audio Jukebox
Tablet
100BaseT
802.11a+e+g
AP
Home PlugPrinter
Laptop
Zafar Shahid Zero Configuration Networking 3
Let us Imagine…Let us Imagine…
A service/device is added to LAN, and it is working
without installation. For example:
Refrigerator
Surveillance camera
Printer
Chat service
File service
All the computers has an updated list of services/
devices.
In short:
Must have for home LANs and Ad-hoc Networks.
Zafar Shahid Zero Configuration Networking 4
Concept
Zero Conf Stack
Addressing
Naming
Browsing
USB vs Ethernet
Conclusion
AgendaAgenda
Zafar Shahid Zero Configuration Networking 5
Plug and Play on LANPlug and Play on LAN
Just like Electric LampJust like Electric Lamp
On Wide area networks, we can communicate to
servers without much problem.
Wide area networks were mature since long. E.g.
email server, web server etc.
On Local area networks, it is not that easy. Just
connect two laptops using an ethernet cable using
hub, and try to make communication between them.
ZeroConf is a protocol stack which makes Services
on LAN plug and play.
Apple has done it 30+ years ago in AppleTalk, but
somehow it was missing in IP community
Zafar Shahid Zero Configuration Networking 6
Challenge: SimplicityChallenge: Simplicity
Any body can make a complicated product. The real
challenge is to make a simple product.
Once that cannot be broken in any scenario, on any
platform etc.
Protocol Design principle:
In protocol design, perfection has been reached:
not when there is nothing left to add,
but when there is nothing left to take away
RFC 1925 The Twelve Networking Truths
Zafar Shahid Zero Configuration Networking 7
Plug n play - HowPlug n play - How
Addressing:
First you need IP address.
Naming:
Human being don't like numbers, we need names.
Browsing:
IP networks don't have browsing.
Non-trivial part of the zero-conf stack.
More than Dozen technologies were proposed for
browsing, but they failed, because they were
complicated.
Zafar Shahid Zero Configuration Networking 8
AddressingAddressing
Automatic IP address assignment.
Pick random IP address from IPv4LL
ARP if anyone else is using it.
Perform conflict resolution if anyone is using it.
No DHCP server needed
Link-local addresses
IPv4 169.254.0.0/16
IPv6 FE80::/64
RFCs
RFC 3927 IPv4LL
RFC 2462 IPv6
Zafar Shahid Zero Configuration Networking 9
NamingNaming
Once addressing is done, computers can talk to each
other, but human likes names.
Multicast DNS (mDNS) - Extension to well known
DNS protocol
Same Query syntax
Same Packet format
Same naming and record types.
Similar to addressing where 169.254/16 is reserved
for LL. “.local” TLD is reserved for ZeroConf.
www.multicastdns.org
Zafar Shahid Zero Configuration Networking 10
NamingNaming
Pick desired name in .local TLD ( Top level domain. E.g.
zafarLaptop.local
Issue query to see if anyone else is using it by
multicasting it over the network.
If someone else is using it, try another.
Muilcast addresses:
IPv4 224.0.0.251
IPv6 FF02::FB
.local TLD is free so you don’t have to pay annual fee to
keep it.
Anyone can take any name.
Zafar Shahid Zero Configuration Networking 11
Browsing – Discovery protocolsBrowsing – Discovery protocols
So far, we have achieved addressing and naming
successfully using existing technologies.
But it we mis-type a name or don’t know the name, no
body is there to correct. So we need a browsing or
discovery protocol.
Historically there have been many tries but all
failed, probably because the protocols were too
complicated.
It is less obvious BUT possible to do Service
discovery using semantics of DNS protocols.
Zafar Shahid Zero Configuration Networking 12
Service Discovery using DNSService Discovery using DNS
We use some of the semantics of DNS in newer ways.
Multiple answers: IP can return multiple addresses. If
you have MULTI-HOMES hosts, you will get back
multiple address This is normal.
PTR records: performs reverse DNS, from addresses
to hostname.
SRV records (RFC 2782): returns the port number. If
directory service could tell you that number, then you
don't need it.
Zafar Shahid Zero Configuration Networking 13
Service Discovery – Three basic operationsService Discovery – Three basic operations
Register: register the service you are offering.
Browse : Client can browse for all the available
services.
Resolve(at time of service): .local name to IP
address. Names are persistent, but addresses are
not.
Service discovery does not find addresses. It finds
names. And at time of use, we resolve names to
addresses.
Zafar Shahid Zero Configuration Networking 14
DNS Service Discovery - ExampleDNS Service Discovery - Example
A computer wants to know the printers are on the LAN:
PTR DNS query: (multicast)
_ipp._tcp.local PTR
Response:
Sales._ipp._tcp.local
Marketing._ipp._tcp.local
Engg._ipp._tcp.local
2nd
floor QA._ipp._tcp.local // spaces allowed
Components of Service Name:
User-Visible Name:User-Visible Name: 2nd floor QA2nd floor QA._ipp._tcp.local.._ipp._tcp.local.
Service Type/Service Protocol Name: 2nd floor QAService Type/Service Protocol Name: 2nd floor QA._ipp._ipp._tcp.local.._tcp.local.
Domain: 2nd floor QA._ipp._tcp.Domain: 2nd floor QA._ipp._tcp.locallocal..
Zafar Shahid Zero Configuration Networking 15
LOOKUP via DNS SRVLOOKUP via DNS SRV
Let us connect to Engg printer Engg._ipp._tcp.local,
we will make the following calls:
Sales._ipp._tcp.local SRV
=> 0 0 30000 myprinter.local (port 30000)
Sales._ipp._tcp.local TXT
=> pdl=application/postscript (name/value pair.
myprinter.local A =>169.254.12.34
DNS-SD Availability
Use apple's Darwin open source
Very portable around ~20k lines of code.
Zafar Shahid Zero Configuration Networking 16
Avoiding ChattinessAvoiding Chattiness
AppleTalk was too chatty. We have taken measure to
make ZeroConf less chatty.
Aggressive caching //opportunistic caching for later
use.
Duplicate Suppression section in Queries.
Duplicate answer suppression
Duplication question supperession
Exponential query backoff.
TTL is too long.
Zafar Shahid Zero Configuration Networking 17
Joining/Leaving networkJoining/Leaving network
If new service joins, it announces itself.
If service leaves:
Shorter TTL will put un0necessary load.
So we go the other way, we use connection failure- as a
hint.
Other clients also witness this connection-failure over the
network
If resolve() fails => PTR record is reconfirmed.
If reconfirm fails =? Record removed from browser list. –
When other clients observe failed queries – They also
remove records from their lists.
Zafar Shahid Zero Configuration Networking 18
ImplementationImplementation
Bonjour on Mac/Windows
Avahi on Linux
Also available on Android.
Zafar Shahid Zero Configuration Networking 19
USB vs. EthernetUSB vs. Ethernet
Plug n play
Power
With Ethernet cable
Power over ethernet
Plug n play with Zero conf
Plus, can even work with 100 meter cable.
And have speed of gbps
So if we have all ZeroConf well in time, we might not
need USB interface at all.
Zafar Shahid Zero Configuration Networking 20
ConclusionConclusion
It is difficult to imagine a network deviceIt is difficult to imagine a network device
without ZeroConf capability.without ZeroConf capability.
Zafar Shahid Zero Configuration Networking 21
DemoDemo
Bonjour BrowserBonjour Browser
TeamViewerTeamViewer
DNS-SD cmd lineDNS-SD cmd line
WebcamWebcam
WiresharkWireshark

Zero Configuration Networking

  • 1.
    Zafar Shahid ZeroConfiguration Networking 1 Zero Configuration Networking by Zafar Shahid Oct. 8 2017 Silicon Valley Code Camp, San Jose CA
  • 2.
    Zafar Shahid ZeroConfiguration Networking 2 Have you heard the term ZERO-CONF ?Have you heard the term ZERO-CONF ? 1394 DVD and HDTV / Display Audio Jukebox Tablet 100BaseT 802.11a+e+g AP Home PlugPrinter Laptop
  • 3.
    Zafar Shahid ZeroConfiguration Networking 3 Let us Imagine…Let us Imagine… A service/device is added to LAN, and it is working without installation. For example: Refrigerator Surveillance camera Printer Chat service File service All the computers has an updated list of services/ devices. In short: Must have for home LANs and Ad-hoc Networks.
  • 4.
    Zafar Shahid ZeroConfiguration Networking 4 Concept Zero Conf Stack Addressing Naming Browsing USB vs Ethernet Conclusion AgendaAgenda
  • 5.
    Zafar Shahid ZeroConfiguration Networking 5 Plug and Play on LANPlug and Play on LAN Just like Electric LampJust like Electric Lamp On Wide area networks, we can communicate to servers without much problem. Wide area networks were mature since long. E.g. email server, web server etc. On Local area networks, it is not that easy. Just connect two laptops using an ethernet cable using hub, and try to make communication between them. ZeroConf is a protocol stack which makes Services on LAN plug and play. Apple has done it 30+ years ago in AppleTalk, but somehow it was missing in IP community
  • 6.
    Zafar Shahid ZeroConfiguration Networking 6 Challenge: SimplicityChallenge: Simplicity Any body can make a complicated product. The real challenge is to make a simple product. Once that cannot be broken in any scenario, on any platform etc. Protocol Design principle: In protocol design, perfection has been reached: not when there is nothing left to add, but when there is nothing left to take away RFC 1925 The Twelve Networking Truths
  • 7.
    Zafar Shahid ZeroConfiguration Networking 7 Plug n play - HowPlug n play - How Addressing: First you need IP address. Naming: Human being don't like numbers, we need names. Browsing: IP networks don't have browsing. Non-trivial part of the zero-conf stack. More than Dozen technologies were proposed for browsing, but they failed, because they were complicated.
  • 8.
    Zafar Shahid ZeroConfiguration Networking 8 AddressingAddressing Automatic IP address assignment. Pick random IP address from IPv4LL ARP if anyone else is using it. Perform conflict resolution if anyone is using it. No DHCP server needed Link-local addresses IPv4 169.254.0.0/16 IPv6 FE80::/64 RFCs RFC 3927 IPv4LL RFC 2462 IPv6
  • 9.
    Zafar Shahid ZeroConfiguration Networking 9 NamingNaming Once addressing is done, computers can talk to each other, but human likes names. Multicast DNS (mDNS) - Extension to well known DNS protocol Same Query syntax Same Packet format Same naming and record types. Similar to addressing where 169.254/16 is reserved for LL. “.local” TLD is reserved for ZeroConf. www.multicastdns.org
  • 10.
    Zafar Shahid ZeroConfiguration Networking 10 NamingNaming Pick desired name in .local TLD ( Top level domain. E.g. zafarLaptop.local Issue query to see if anyone else is using it by multicasting it over the network. If someone else is using it, try another. Muilcast addresses: IPv4 224.0.0.251 IPv6 FF02::FB .local TLD is free so you don’t have to pay annual fee to keep it. Anyone can take any name.
  • 11.
    Zafar Shahid ZeroConfiguration Networking 11 Browsing – Discovery protocolsBrowsing – Discovery protocols So far, we have achieved addressing and naming successfully using existing technologies. But it we mis-type a name or don’t know the name, no body is there to correct. So we need a browsing or discovery protocol. Historically there have been many tries but all failed, probably because the protocols were too complicated. It is less obvious BUT possible to do Service discovery using semantics of DNS protocols.
  • 12.
    Zafar Shahid ZeroConfiguration Networking 12 Service Discovery using DNSService Discovery using DNS We use some of the semantics of DNS in newer ways. Multiple answers: IP can return multiple addresses. If you have MULTI-HOMES hosts, you will get back multiple address This is normal. PTR records: performs reverse DNS, from addresses to hostname. SRV records (RFC 2782): returns the port number. If directory service could tell you that number, then you don't need it.
  • 13.
    Zafar Shahid ZeroConfiguration Networking 13 Service Discovery – Three basic operationsService Discovery – Three basic operations Register: register the service you are offering. Browse : Client can browse for all the available services. Resolve(at time of service): .local name to IP address. Names are persistent, but addresses are not. Service discovery does not find addresses. It finds names. And at time of use, we resolve names to addresses.
  • 14.
    Zafar Shahid ZeroConfiguration Networking 14 DNS Service Discovery - ExampleDNS Service Discovery - Example A computer wants to know the printers are on the LAN: PTR DNS query: (multicast) _ipp._tcp.local PTR Response: Sales._ipp._tcp.local Marketing._ipp._tcp.local Engg._ipp._tcp.local 2nd floor QA._ipp._tcp.local // spaces allowed Components of Service Name: User-Visible Name:User-Visible Name: 2nd floor QA2nd floor QA._ipp._tcp.local.._ipp._tcp.local. Service Type/Service Protocol Name: 2nd floor QAService Type/Service Protocol Name: 2nd floor QA._ipp._ipp._tcp.local.._tcp.local. Domain: 2nd floor QA._ipp._tcp.Domain: 2nd floor QA._ipp._tcp.locallocal..
  • 15.
    Zafar Shahid ZeroConfiguration Networking 15 LOOKUP via DNS SRVLOOKUP via DNS SRV Let us connect to Engg printer Engg._ipp._tcp.local, we will make the following calls: Sales._ipp._tcp.local SRV => 0 0 30000 myprinter.local (port 30000) Sales._ipp._tcp.local TXT => pdl=application/postscript (name/value pair. myprinter.local A =>169.254.12.34 DNS-SD Availability Use apple's Darwin open source Very portable around ~20k lines of code.
  • 16.
    Zafar Shahid ZeroConfiguration Networking 16 Avoiding ChattinessAvoiding Chattiness AppleTalk was too chatty. We have taken measure to make ZeroConf less chatty. Aggressive caching //opportunistic caching for later use. Duplicate Suppression section in Queries. Duplicate answer suppression Duplication question supperession Exponential query backoff. TTL is too long.
  • 17.
    Zafar Shahid ZeroConfiguration Networking 17 Joining/Leaving networkJoining/Leaving network If new service joins, it announces itself. If service leaves: Shorter TTL will put un0necessary load. So we go the other way, we use connection failure- as a hint. Other clients also witness this connection-failure over the network If resolve() fails => PTR record is reconfirmed. If reconfirm fails =? Record removed from browser list. – When other clients observe failed queries – They also remove records from their lists.
  • 18.
    Zafar Shahid ZeroConfiguration Networking 18 ImplementationImplementation Bonjour on Mac/Windows Avahi on Linux Also available on Android.
  • 19.
    Zafar Shahid ZeroConfiguration Networking 19 USB vs. EthernetUSB vs. Ethernet Plug n play Power With Ethernet cable Power over ethernet Plug n play with Zero conf Plus, can even work with 100 meter cable. And have speed of gbps So if we have all ZeroConf well in time, we might not need USB interface at all.
  • 20.
    Zafar Shahid ZeroConfiguration Networking 20 ConclusionConclusion It is difficult to imagine a network deviceIt is difficult to imagine a network device without ZeroConf capability.without ZeroConf capability.
  • 21.
    Zafar Shahid ZeroConfiguration Networking 21 DemoDemo Bonjour BrowserBonjour Browser TeamViewerTeamViewer DNS-SD cmd lineDNS-SD cmd line WebcamWebcam WiresharkWireshark

Editor's Notes

  • #16 )//Real TXT record is about 500 bytes and it tells all the attributes of a printer
  • #17 )//Real TXT record is about 500 bytes and it tells all the attributes of a printer // You list the answers you already know.So if you know 4 printers and you query _ipp, you will list all 4 i nyour query, so only newly added printers will reply.- On a network, faster machines reply faster, and it is always slower machines whose answers are lsot So this way you can get response from slower machines too.-
  • #18 )//Real TXT record is about 500 bytes and it tells all the attributes of a printer // You list the answers you already know.So if you know 4 printers and you query _ipp, you will list all 4 i nyour query, so only newly added printers will reply.- On a network, faster machines reply faster, and it is always slower machines whose answers are lsot So this way you can get response from slower machines too.-