Setup Yggdrasil on Alpine Linux

2021-01-29

I love to use Alpine Linux because it is small and efficient. However, one tradeoff is that not everything works out of the box like on say Ubuntu.

When I was experimenting with Yggdrasil I had no problem with Debian, but Yggdrasil ran into some issues on Alpine.

Luckily, this is easy to fix. It took more digging than I would’ve liked so here is this post.

All of the steps below assume you are running as root, so make sure you can get root access of the machine you are working with.

Install

Fortunately, there is already a package for yggdrasil for Alpine. This makes our lives easier because we can install in one line, and it already integrates with openrc.

apk add yggdrasil

This will install the binaries: yggdrasil and yggdrasilctl, as well as the yggdrasil openrc configurations.

One reason Alpine is so lightweight is it doesn’t enable every kernel module under the sun. However, this through me for a loop.

Luckily, there is a mention of this in the yggdrasil docs.

We need to enable the tun kernel module, like so:

modprobe tun

Now we have the binaries and the kernel module that yggdrasil depends on.

Config

The next thing we need to do is generate the config. We can do it like this:

yggdrasil -genconf > /etc/yggdrasil.conf

Customize that config to your liking, but it should work fine without changes.

Now we can finally start the yggdrasil service.

Openrc

Initialize the yggdrasil service with rc:

rc-service yggdrasil start

You can check the status:

rc-service yggdrasil status

Or take a look at the logs at /var/log/yggdrasil.log in case you run into any trouble.

Now you have yggdrasil running!

If you turn your computer on and off, you’ll notice yggdrasil isn’t running. You can enable yggdrasil to start on boot with this:

rc-update add yggdrasil

IPv6 Address

In order to connect to this machine you will need to know the IPv6 address that yggdrasil makes for you.

You can use yggdrasilctl to do that.

yggdrasilctl -v getSelf

Which will return something like this:

Build version: 0.3.15
IPv6 address: 200:dcb7:4f58:45a3:793d:5f7e:74c3:de98
IPv6 subnet: 300:dcb7:4f58:45a3::/64
Coords: [1]
Public encryption key: 3a8667ab28cdf009094c704a95f61db5bff4ef6f18ae07de5ff0cf7edfb8cd2b

The IPv6 address will allow you to connect to your Alpine Linux machine for whatever application you want.

Have fun, and keep it decentralized!


Enter your instance's address