docs/docs/tunneling/fastd-compile-install.md

60 lines
1.9 KiB
Markdown

# Compile and install fastd
The fastd compilation process is documented at [Building fastd](https://fastd.readthedocs.io/en/stable/devel/building.html). This is only a brief guide. For reference, the official fastd documentation should be used.
## Preparation
The first thing to do is to install the appropriate dependencies. On Debian you can do this with the following command:
```
sudo apt install build-essential meson bison libuecc-dev libcap-dev libjson-c-dev libssl-dev libmnl-dev libsodium-dev clang-format
```
After that you can clone the Git repository. GitHub requires an IPv4 clearnet connection.
```
git clone https://github.com/NeoRaider/fastd.git
```
## Compilation
After that you can prepare the compilation:
```
meson setup fastd fastd-build -Dbuildtype=release -Db_lto=true -Dcapabilities=enabled -Doffload_l2tp=enabled
```
`-Db_lto=true` activates link-time optimizations. `-Dcapabilities=enabled` enables the option that fastd can later negotiate capabilities with its peer accordingly. `-Doffload_l2tp=enabled` enables the option to later offload L2TP connections in fastd to the kernel and thus increase speed.
The flag `-Dmethod_cipher-test=enabled` can be used to use the `cipher-test` method in fastd.
After that you can change to the build directory and compile fastd:
```
cd fastd-build
ninja
```
To install fastd you can use the following command:
```
sudo ninja install
```
## Installation
If you want to use fastd with Systemd, you can create a unit in the file `/lib/systemd/system/fastd@.service`:
```
[Unit]
Description=Fast and Secure Tunnelling Daemon (connection %I)
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/bin/fastd --syslog-level info --syslog-ident fastd@%I -c /etc/fastd/%I/fastd.conf
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
```
After that you can load the new unit:
```
systemctl daemon-reload
```