Husarnet Documentation
With Husarnet you can connect any device (laptops, servers, VMs, containers, microcontrollers etc.) with any interface (Wi-Fi, LTE/5G, Ethernet) into a peer-to-peer Virtual Private Network that works over the Internet with no configuration.
If you want to know more about the internals How Husarnet works is a great start.
Support
Our preferred way of support is through Husarnet Community.
If you want you can reach us at support@husarnet.com too.
Husarnet Dashboard
Husarnet Dashboard is a platform for managing all your Client instances. You can create groups/check statuses/rename nodes and a lot more there.
In the Husarnet Dashboard Quick Start guide, you'll find all the important bits and pieces of information to become a poweruser.
Husarnet Client
Husarnet Client is open source and available for all supported platforms at: https://github.com/husarnet/husarnet
For typical "quickstart" setup, choose your platform below and see installation instructions. Alternative approaches and extended guides for all the platforms can be found in the sidebar on the left, in the "Platforms" section.
- Linux
- Windows
- Container
- GitHub Actions
- ESP32
- MacOS
- Android ⏳
Husarnet Client for Linux
Supported architectures: i386, x64 (amd64), armhf, arm64, riscv64
Choose your Linux distribution:
- Debian, Ubuntu, CentOS, RHEL, Fedora, Mint or Arch
- Other distributions
For APT, pacman and yum based Linux the simplest way to install Husarnet is to paste the following line into your terminal:
curl https://install.husarnet.com/install.sh | sudo bash
Now export your Join Code as environment variable:
export JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/XXXXXXXXXXXXXXXXXXXXXX
To join your device to Husarnet network, execute:
sudo husarnet join $JOINCODE some-hostname
If your Linux distribution is not supported by the one-command install method, you can also download the binary package. For most seamless experience, it is recommended to unpack it in the root directory (/):
curl https://install.husarnet.com/tar/husarnet-latest-amd64.tar > husarnet-latest-amd64.tar
sudo tar --directory=/ --no-same-owner --dereference -xf husarnet-latest-amd64.tar
(replace -amd64 with -armhf, -arm64 or -i386 if you don't have 64-bit Intel/AMD processor)
If you are using systemd, enable and start the service:
systemctl enable husarnet
systemctl start husarnet
otherwise start the Husarnet Daemon manually:
husarnet daemon &
Now export your Join Code as environment variable:
export JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/XXXXXXXXXXXXXXXXXXXXXX
To join your device to Husarnet network, execute:
sudo husarnet join $JOINCODE some-hostname
Husarnet Client container (sidecar)
Supported architectures: x64 (amd64), armhf, arm64
Choose a preffered method for running containers:
- docker run
- docker compose
- ansible
To start a Husarnet Sidecar container execute:
export JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/XXXXXXXXXXXXXXXXXXXXXX
docker run -it \
--name husarnet-vpn \
--env JOINCODE=$JOINCODE \
--env HOSTNAME='testing-container' \
--env HUSARNET_DEBUG=1 \
--volume husarnet-vol:/var/lib/husarnet \
--device /dev/net/tun \
--cap-add NET_ADMIN \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \
husarnet/husarnet:latest
replace
fc94:...:932a/XXX...XXXXXwith your own Join Code
Now to give other containers on the same host access to your Husarnet network (using wordpress container as an example):
docker run -it \
--network container:husarnet-vpn \
--volume wordpress-vol:/var/www/html \
wordpress
Now you should be able to access a wordpress boilerplate in a browser of any computer connected to the same Husarnet network by using: http://testing-container:80 (because wordpress is hosted on port 80 by default)
To start a Husarnet Sidecar container that provides over-the-internet access for your application containers (in the example below - for wordpress), create a compose.yaml file:
services:
my-website:
image: wordpress
network_mode: service:husarnet
volumes:
- /var/www/html
husarnet:
image: husarnet/husarnet:latest
volumes:
- /var/lib/husarnet
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
environment:
- HOSTNAME=testing-container
- JOINCODE
- HUSARNET_DEBUG=1
And execute:
export JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/XXXXXXXXXXXXXXXXXXXXXX
docker-compose up
replace
fc94:...:932a/XXX...XXXXXwith your own Join Code
Now you should be able to access a wordpress boilerplate in a browser of any computer connected to the same Husarnet network by using: http://testing-container:80 (because wordpress is hosted on port 80 by default)
Running with network_mode: host
If you need to remove additional NAT layer provided by Docker network, you can run Husarnet container with network_mode: host. It will create additional network interface hnet0 directly on the host OS layer.
services:
my-website:
image: wordpress
network_mode: host
volumes:
- /var/www/html
husarnet:
image: husarnet/husarnet:latest
network_mode: host
volumes:
- /var/lib/husarnet
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
environment:
-