Skip to content

dtaht/hnetd

 
 

Repository files navigation

hnetd - a home network configuration daemon


** Abstract **

hnetd is a networking daemon to automatically manage address assignment,
routing, DNS, SD and border firewalling in home networks running it.
It implements the Home Networking Control protocol as specified in
http://tools.ietf.org/html/draft-ietf-homenet-hncp

hnetd is designed to run on generic Linux-based routers.


** Features **

1. State synchronization between routers
	a) link-local multicast transmission
	b) unicast fallback for bulk synchronization
	c) collision and conflict detection and resolving

2. Prefix distribution and allocation
	a) IPv6 prefix delegatuin
	b) IPv4 prefix allocation

3. Routing setup
	a) selection of a shared routing protocol
	b) fallback mechanism to setup routes autonomously

4. Dynamic border-detection for IPv4 and IPv6
	a) on-demand firewall reconfiguration
	b) on-demand RA/DHCP/DHCPv6 server configuration
	c) integration of fixed external connections (e.g. PPP, 6rd, ...)

5. Sharing of DNS and Service Discovery configuration
	a) Local DNS configuration
	b) mDNS / DNS-SD hybrid proxy configuration


** Compiling **

hnetd depends on the following libraries:
* libubox: http://nbd.name/gitweb.cgi?p=luci2/libubox.git
* libubus (OpenWrt only): http://nbd.name/gitweb.cgi?p=luci2/ubus.git

hnetd uses the following auxiliary tools (replacable):
* odhcp6c (DHCPv6 client): https://github.com/sbyx/odhcp6c
* odhcpd (RA/DHCP/DHCPv6 server): https://github.com/sbyx/odhcpd
* ohybridproxy (mDNS proxy, optional): https://github.com/sbyx/ohybridproxy
* udhcpc (DHCP client): http://busybox.net

hnetd uses cmake:
* To prepare a Makefile use:  "cmake . -DCMAKE_INSTALL_PREFIX=/usr" 
* To build / install use: "make" / "make install" afterwards.
* To build DEB or RPM packages use: "make package" afterwards.

Note: The script "build-generic.sh" can aid in building hnet and its
dependencies and tools on Debian/Ubuntu/Mint and related Linux distributions.


** OpenWrt Firmware Integration **

hnetd and ohybridproxy can be built from the openwrt-routing feed.
Use:
	./scripts/feeds update
	./scripts/feeds install hnetd ohybridproxy

and select both packets in "make menuconfig" under "Network" and the submenu
"IP Addresses and Names". Snapshot packages might be avialable in the OpenWrt
daily snapshots folder: http://downloads.openwrt.org/snapshots/trunk/

To use hnetd on an interface set its proto-option in /etc/config/network, e.g.

config interface lan
	option ifname eth0
	option proto hnet

or select the protocol "Automatic Homenet (HNCP)" in the web interface.

** Generic Firmware Integration **

hnetd can be integrated into generic Linux router firmwares with recent 3.10.x
or later kernels. The scripts that need to be adapted for the integration can
be found in the folder "generic".

Copy the scripts hnet-backend and hnetd-routing to /usr/sbin/ and adapt
them if needed. The symlinks hnet-client, hnet-ifup and hnet-ifdown should be
preserved as well.

Copy the scripts dhcp.script and dhcpv6.script to /usr/share/hnetd and
adapt them if needed. 

If you are using odhcpd as DHCP/DHCPv6/RA server start it as a daemon.
Afterwards run hnetd with appropriate parameters.

Once both services are running, you can use the hnet CLI tools:

hnet-ifup [-c category] [-a] [-d] [-u] [-p prefix] [-l id[/idmask]]
	[-i id/idmask [filter-prefix]] [-m ip6_plen] [-k trickle_k] 
	[-P ping_interval] <interfacename>
adds the network interface <interfacename> (e.g. eth0) to the homenet.
-c is an optional parameter declaring the interface category
	auto: auto-detect (default)
	external: fixed-external
	guest: guest-mode (fixed-internal)
	adhoc: ad-hoc mode (fixed-internal)
	hybrid: hybrid mode (fixed-internal)
-p is an optional parameter indicating one or more static prefixes.
-l is an optional parameter setting the link-id and id-mask.
-i is an optional parameter indicating one or more iface ids.
-m is an optional parameter overriding the default prefix length when
	generating an IPv6 assignment.
-d is an optional parameter indicating prefix assignment must be disabled.
-u is an optional parameter indicating that an IPv6 default route should be
	announced even when there is only a ULA-prefix present.
-k is an optional parameter indicating the interface's trickle K parameter.
-P is an optional parameter indicating the dead-peer-detection interval value in ms.

hnet-ifdown <interfacename> removes an interface from hnet again.

hnet-dump dumps you (most of) the current state of the network as JSON.

About

HomeNet-CP implementation (WIP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.5%
  • JavaScript 2.0%
  • Shell 1.6%
  • Other 0.9%