ubd is located in the https://github.com/muccc/ubd git repository.
ubavahid is located in the https://github.com/muccc/ubavahid git repository.
ubd will make the moodlamps available via ipv6-address and a json directory service, ubavahid announces their names on the network.
ubd stands for “uberbus daemon”. It is the daemon which is responsible to make the nodes attached to the computer available via IPv6. It is written with C using glib2. Currently it only runs on Linux due to the special code to add and remove IPv6 addresses on network interfaces.
ubd interfaces with the master node of the bus via USB. It finds, initialises and exposes nodes via IPv6.
To expose every node via IPv6 the daemon adds new IPv6 addresses to a specified interface and opens sockets on these addresses.
ubd it self can run as a normal unprivileged process. The task of adding and removing addresses on an interface requires root access. Therefore a second program ubnetd is used to to this special task. This program needs to be executed as root. It is a very simple program which is not capable of doing anything else than adding or deleting IPv6 addresses from an interface.
ubd, ubnetd and ubavahid have support for OpenWRT. You can run it on cheap broadband routers like the TL-WR1043ND. Have a look at openwrt.
Prerequisites
You need a working IPv6 network where you want to use ubd.
It probably is a good idea to get a v6 address from your ISP or set up a 6to4 tunnel with a tunnel broker like HE or SixXS. There are extensive HOWTOs on setting up v6 tunnels and routing available on the internet.
Simulating a network
If you do not want IPv6 connectivity at your location you can set up a “fake” network:
You will need link-local advertisements of IPv6 prefixes on the network you want to use ubd to autoconfigure nodes and other client machines as well. On linux this is implemented with the Router ADVertisement Daemon radvd. Packages are available for major distributions and openwrt.
minimal .conf examples:
- /etc/radvd.conf
interface eth0 { AdvSendAdvert on; MinRtrAdvInterval 3; MaxRtrAdvInterval 10; prefix 2001:123:b00b:fefe::/64 { AdvOnLink on; AdvAutonomous on; AdvRouterAddr off; }; };
OpenWRT:
- etc/config/radvd
config interface option interface 'lan' option AdvSendAdvert 1 option AdvManagedFlag 0 option AdvOtherConfigFlag 0 option ignore 0 config prefix option interface 'lan' # If not specified, a non-link-local prefix of the interface is used option prefix '2001:123:b00b:fefe::/64' option AdvOnLink 1 option AdvAutonomous 1 option AdvRouterAddr 0 option ignore 0
Because advertising v6 prefixes without v6 routing to the internet could slow down or break some services on your network
you should get some real connectivity.
Build
To compile the daemon you need to install the libmxml-dev, libglib2.0-dev and libjson0-dev packages.
To Build ubd run the configure script and make.
The install target then installs the ubd and ubnetd executables.
Configuration
The daemon uses /etc/ubdconfig.xml as configuration file.
When the daemon starts up it parses this configuration file and reads out the following values:
Name | Description | Notes |
---|---|---|
interface | interface to listen on | Important for multicast packets |
base | The address at which the daemon will open its control socket | The first 64 Bit of the address provide the prefix for new IPs |
prefix | prefix of the net at the base address | Currently not used |
device | The serial device at which the master node is connected | |
rate | The baud rate of the master node | |
timeout | The time after which a node is removed when not getting any packets |
Additionally a list of known nodes is parsed. This list contains the id of a specific node. Also the name to use with this node and a list of multicast groups is specified.
json directory server example
<directory client="enabled" remotedirectory="directory.example.com" server="enabled" directoryname="ubdirectory" />
Node list example:
<nodes> <node id="foo" hostname="Foo"> <group name="group1"/> <group name="all"/> </node> <node id="bar" hostname=""> <group name="group2"/> <group name="all"/> </node> </nodes> <groups> <group name="group1" hostname="group1" class="moodlamp" /> <group name="group2" hostname="group2" class="moodlamp" /> <group name="all" hostname="all" class="moodlamp" /> </groups>
You also have to specify the used interface in /etc/default/ubnetd:
INTERFACE=eth0
Replaced eth0 with the device you want ubnetd to create new ipv6 addresses for your nodes on.
Operation
After you have successfully compiled udb, you can set up the daemon:
First copy the init scripts to /etc/init.
sudo cp contrib/initscripts/ubd /etc/init.d sudo cp contrib/initscripts/ubnetd /etc/init.d
You will have to add your interface to the INTERFACE variable in /etc/init.d/ubnetd.
You can now start the daemons:
sudo service ubnetd start sudo service ubd start
If you want to start the daemons on system startup do the following(Debian Sqeeze, Ubuntu):
sudo update-rc.d ubnetd defaults sudo update-rc.d ubd defaults
When started ubd switches the node which is attached via the serial connection into master mode. This node now forms the master node on the wired and wireless network.
When an identify packet from this or other nodes arrives ubd automatically initialises these nodes. It reads its ID, version, class, and preferred polling interval. It sets the bus address and multicast groups. It then creates a new address on the specified network interface and opens ports to communicate with the node.
After a few second you can check if additional ipv6 addresses have been created:
$ ifconfig eth0 eth0 Link encap:Ethernet HWaddr f1:f1:e5:e1:af:fe inet addr:10.0.0.2 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: 2001:123:b00b:fefe::1:1/128 Scope:Global inet6 addr: 2001:123:b00b:fefe:92c4:98ad:e265:cb95/128 Scope:Global inet6 addr: 2001:123:b00b:fefe:cd3c:f0a1:d65d:e925/128 Scope:Global inet6 addr: 2001:123:b00b:fefe:210:75ff:fe1a:dd67/64 Scope:Global inet6 addr: fe80::123:123:123:123/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:637356 errors:0 dropped:0 overruns:0 frame:0 TX packets:393522 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:101098177 (96.4 MiB) TX bytes:73419945 (70.0 MiB) Interrupt:11
ubavahid
To compile the daemon you need to install the libavahi-core-dev packages.
To Build ubavahid run the configure script and make.
The install target then installs the ubavahid executable.
After you have successfully compiled ubavahid, you can set up the daemon:
First copy the init scripts to /etc/init.
sudo cp contrib/initscripts/ubavahid /etc/init.d
You will have to add your interface to the DAEMON_ARGS variable.
After launching ubavahid with
sudo /etc/init.d/ubavahid start
you can check if the nodes are properly announced with avahi-browse
$ avahi-browse -a + eth0 IPv6 foo _moodlamp._tcp local + eth0 IPv6 bar _moodlamp._tcp local + eth0 IPv6 foo _moodlamp._udp local + eth0 IPv6 bar _moodlamp._udp local + eth0 IPv6 group1 _moodlamp._udp local + eth0 IPv6 group2 _moodlamp._udp local + eth0 IPv6 all _moodlamp._udp local