var img = document.createElement('img'); img.src = "https://matomo.0l.de/piwik.php?idsite=5&rec=1&url=https://cunicu.li" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Hosts-file Synchronization

The hosts-file synchronization updates your local hosts(5) file (/etc/hosts) with entries for each peer.

As hostname, cunicu uses the first 8 characters of the Base64-encoded public key as well as an optional hostname. This optional hostname can either be configured by the user in the configuration file or is discovered via the peer-discovery feature.

Example

The following snippet shows the local hosts file of an Ubuntu 20.04 system with two entries added by cunicu. As shown here, all entries managed by cunicu are marked with a comment prefixed with # cunicu:

/etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

fe80::13a9:c799:cead:4f28 buxfBfaN.wg-local fra-1.wg-local # cunicu: ifname=wg0, ifindex=9, pk=buxfBfaNZI8UFT0cB1aj9YanhbLfxlTfd/hH3DrGaFA=
fe80::1fed:fabb:a9f6:d78 ZEki/XKE.wg-local # cunicu: ifname=wg1, ifindex=10, pk=ZEki/XKEsqdjFyURo5Sm+g3vXSKJKpV5WmwWKAQqo2c=

Configuration

The following settings can be used in the main section of the configuration file or with-in the interfaces section to customize settings of an individual interface.

sync_hosts
boolean (/etc/hosts Synchronization)
Default: true

Enable hosts file synchronization.

domain
string (Domain)

The domain name which is appended to each of the peer host names

{
  • "sync_hosts": true,
  • "domain": "wg-local"
}