EtherGuard-VPN/README.md

95 lines
3.6 KiB
Markdown
Raw Normal View History

2021-08-26 21:06:15 +02:00
# Etherguard
2021-08-25 15:21:26 +02:00
2021-12-12 19:05:58 +01:00
[English](#) | [中文](README_zh.md)
2021-08-30 08:24:46 +02:00
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
2021-12-12 19:05:58 +01:00
A Full Mesh Layer2 VPN based on wireguard-go
2021-08-30 08:24:46 +02:00
OSPF can find best route based on it's cost.
But sometimes the latency are different in the packet goes and back.
I'm thinking, is it possible to find the best route based on the **single-way latency**?
2021-12-12 19:05:58 +01:00
2021-08-30 08:24:46 +02:00
For example, I have two routes A and B at node N1, both of them can reach my node N2. A goes fast, but B backs fast.
My VPN can automatically send packet through route A at node N1, and the packet backs from route B.
Here is the solution. This VPN `Etherguard` can collect all the single-way latency from all nodes, and calculate the best route using [FloydWarshall algorithm](https://en.wikipedia.org/wiki/FloydWarshall_algorithm).
2021-08-30 08:24:46 +02:00
Worried about the clock not match so that the measure result are not correct? It doesn't matter, here is the proof (Mandarin): [https://www.kskb.eu.org/2021/08/rootless-routerpart-3-etherguard.html](https://www.kskb.eu.org/2021/08/rootless-routerpart-3-etherguard.html)
2021-08-30 08:24:46 +02:00
## Usage
```bash
Usage of ./etherguard-go:
-bind string
UDP socket bind mode. [linux|std]
2021-12-12 19:05:58 +01:00
You may need std mode if you want to run Etherguard under WSL. (default "linux")
-cfgmode string
Running mode for generated config. [none|super|p2p]
2021-08-30 08:24:46 +02:00
-config string
2021-12-12 19:05:58 +01:00
Config path for the interface.
2021-08-30 08:24:46 +02:00
-example
Print example config
-help
Show this help
-mode string
2021-12-12 19:05:58 +01:00
Running mode. [super|edge|solve|gencfg]
2021-08-30 08:24:46 +02:00
-no-uapi
2021-12-12 19:05:58 +01:00
Disable UAPI
With UAPI, you can check etherguard status by "wg" command
2021-08-30 08:24:46 +02:00
-version
Show version
```
2021-12-12 19:05:58 +01:00
## Working Mode
Mode | Description
------------|:-----
Static Mode | No dynamic routing, no handshake server.<br>Similar to original wireguard , all configs are static<br>[Detail](example_config/static_mode/README.md)
Static Mode | Inspired by [n2n](https://github.com/ntop/n2n). There 2 types of node: SuperNode and EdgeNode<br>EdgeNode must connect to SuperNode firstget connection info of other EdgeNode from the SuperNode<br>The SuperNode runs [Floyd-Warshall Algorithm](https://en.wikipedia.org/wiki/FloydWarshall_algorithm)and distribute the result to all other EdgeNodes.<br>[Detail](example_config/super_mode/README.md)
P2P Mode | Inspired by [tinc](https://github.com/gsliepen/tinc), There are no SuperNode. All EdgeNode will exchange information each other.<br>EdgeNodes are keep trying to connect each other, and notify all other peers success or not.<br>All edges runs [Floyd-Warshall Algorithm](https://en.wikipedia.org/wiki/FloydWarshall_algorithm) locally and find the best route by it self.<br>**Not recommend to use this mode in production environment, not test yet.**<br>[Detail](example_config/p2p_mode/README.md)
## Quick start
[Super mode quick start](example_config/super_mode/README.md)
2021-08-26 21:06:15 +02:00
## Build
### No-vpp version
2021-08-30 08:24:46 +02:00
Build Etherguard.
Install Go 1.16
2021-08-25 15:21:26 +02:00
```bash
add-apt-repository ppa:longsleep/golang-backports
apt-get -y update
apt-get install -y wireguard-tools golang-go build-essential git
2021-08-25 15:21:26 +02:00
```
2021-08-30 08:24:46 +02:00
Build
2021-08-25 15:21:26 +02:00
```bash
2021-08-23 21:11:01 +02:00
make
2021-08-26 21:06:15 +02:00
```
### VPP version
2021-08-30 08:24:46 +02:00
Build Etherguard with VPP integrated.
You need libmemif.so installed to run this version.
2021-08-26 21:06:15 +02:00
Install VPP and libmemif
2021-08-26 21:06:15 +02:00
2021-08-30 08:24:46 +02:00
```bash
2021-08-26 21:06:15 +02:00
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" > /etc/apt/sources.list.d/99fd.io.list
curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add -
apt-get -y update
apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev
```
2021-08-30 08:24:46 +02:00
Build
2021-08-26 21:06:15 +02:00
```bash
make vpp
2021-08-30 08:24:46 +02:00
```