Skip to content

Commit d76748a

Browse files
committed
add how to reach local node with wg to docs
1 parent d69efa8 commit d76748a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/internals/network-light/readme.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,52 @@ What happens now is:
8080
- VMs inside a single space can communicate directly over their bridge.
8181
- Different networks resource can (and well) have conflicting IP and ranges but with no issue since each network is completely isolated from the other ones.
8282

83+
## Private Networks
84+
85+
To reach vms on local nodes using wireguard you need to:
86+
87+
- Deploy a networkwith valid pairs so you can be able to connect to the vm from your machine and add a container to this network.
88+
For example:
89+
90+
```go
91+
WGPrivateKey: wgKey,
92+
WGListenPort: 3011,
93+
Peers: []zos.Peer{
94+
{
95+
Subnet: gridtypes.MustParseIPNet("10.1.2.0/24"),
96+
WGPublicKey: "4KTvZS2KPWYfMr+GbiUUly0ANVg8jBC7xP9Bl79Z8zM=",
97+
98+
AllowedIPs: []gridtypes.IPNet{
99+
gridtypes.MustParseIPNet("10.1.2.0/24"),
100+
gridtypes.MustParseIPNet("100.64.1.2/32"),
101+
102+
```
103+
104+
> **Note:** make sure to use valid two wg key pairs for the container and your local machine.
105+
106+
- After the deployment the network can be accessed through wg with the following config.
107+
108+
```conf
109+
[Interface]
110+
Address = 100.64.1.2/32
111+
PrivateKey = <your private key>
112+
113+
[Peer]
114+
PublicKey = cYvKjMRBLj3o3e4lxWOK6bbSyHWtgLNHkEBxIv7Olm4=
115+
AllowedIPs = 10.1.1.0/24, 100.64.1.1/32
116+
PersistentKeepalive = 25
117+
Endpoint = 192.168.123.32:3011
118+
```
119+
120+
- Bring wireguard interface up `wg-quick up <config file>`
121+
- Test the connection `wg`
122+
![image](https://github.com/user-attachments/assets/ca0d37e2-d586-4e0f-ae98-2d70188492bd)
123+
124+
- Then you should be able to ping/access the container `ping 10.1.1.2`
125+
![image](https://github.com/user-attachments/assets/d625a573-3d07-4980-afc0-4570acd7a21f)
126+
127+
- Then you should be able to ping to the container `ping 10.1.1.2`
128+
83129
### Full Picture
84130
85131
![full](png/full.png)

0 commit comments

Comments
 (0)