Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Latest commit

 

History

History
48 lines (31 loc) · 1.85 KB

README.md

File metadata and controls

48 lines (31 loc) · 1.85 KB

🕸️wg-mesh

A mesh network configurator based on Wireguard.

📚Quick Start

wg-mesh configurator only works on Linux. Clone this project and run thirdpary.py to install the necessary dependencies. Note that thirdparty.py only works on Ubuntu and other Debian-based systems, try to port it if you are running on other systems.

python3 thirdparty.py

See example.py for the example configuration. In example.py, it configures two router nodes bj and hk, and a few clients. wg-mesh is based on Wireguard to build the P2P tunnel. So it needs to read and manage the Wireguard credentials. At the first time, you need to generate keys for all hosts. Run the following to generate keys which will be saved to the keys directory:

./exmaple.py genkey all

To set up the mesh network in the real environment, you have to sync the keys generated before to all hosts. Then run the following on the corresponding host:

./example.py up HOST_NAME

For the non-Linux client which cannot be configured by this script, it can use the standard Wrieguard clients with the configuration generated by:

./example.py gen-client-conf HOST_NAME

🤡Mock Network

Debugging the network configuration in the real environment is inconvenient. Thus, wg-mesh provides a way to generate a local mock network based on network namespaces:

./exmaple.py mock

You can explore it by using sudo ip netns exec HOST_NAME CMD to run commands in the mock network. For example, you can ping the bj host, which IP is 10.56.1.1 in the example configuration, from the hk host:

sudo ip netns exec hk ping 10.56.1.1

🧑‍💻Development

I track some TODO-s and thoughts in wiki.