These instructions provide a brief overview of what Yggdrasil can do. It connects 2 nodes together (local and remote) and use Netcat as a server to reply to HTTP requests.
Install Yggdrasil on both machine, refer to this installation guide.
On the local node, edit /etc/yggdrasil/yggdrasil.conf
add the remote IP/port to the list of peers:
{
# ...
Peers: ["tls://192.168.0.10:9001"]
# ...
}
Then get your local public key and IPv6 address which is used in the next step.
$ yggdrasilctl getself
Build name: yggdrasil
Build version: 0.4.7
IPv6 address: 201:1c1a:4319:80a7:c7d6:215b:347f:e617
IPv6 subnet: 301:1c1a:4319:80a7::/64
Coordinates: []
Public key: 78f96f399fd60e0a77a932e0067a3165239b32f2f5931316a50ada5111ed26b6
Restart Yggdrasil to pickup the new configuration:
systemctl restart yggdrasil
On the remote node, edit /etc/yggdrasil/yggdrasil.conf
and define both the port to listen to and the public key from your local machine. Like this, only the local machine is allowed to access the remote node.
{
# ...
Listen: [
"tls://0.0.0.0:9001"
]
# ...
AllowedPublicKeys: [
"78f96f399fd60e0a77a932e0067a3165239b32f2f5931316a50ada5111ed26b6"
]
# ...
}
Restart Yggdrasil to pickup the new configuration:
systemctl restart yggdrasil
Start netcat to listen for incoming connections on port 8888:
while true; do printf 'HTTP/1.1 200 OK\nContent-Length: 5\n\nHello' | nc -l '200:2adf:9a85:c64b:dda1:fc53:bb96:1de7' 8888; done
The above command should reply to requests with a 200. Execute the following curl command from the first node:
$ curl 'http://[200:2adf:9a85:c64b:dda1:fc53:bb96:1de7]:8888' -v
* Trying [200:2adf:9a85:c64b:dda1:fc53:bb96:1de7]:8888...
* Connected to 200:2adf:9a85:c64b:dda1:fc53:bb96:1de7 (200:2adf:9a85:c64b:dda1:fc53:bb96:1de7) port 8888 (#0)
> GET / HTTP/1.1
> Host: [200:2adf:9a85:c64b:dda1:fc53:bb96:1de7]:8888
> User-Agent: curl/7.87.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 5
<
* Connection #0 to host 200:2adf:9a85:c64b:dda1:fc53:bb96:1de7 left intact
Hello