../
// udp2raw + Wiregurad组建虚拟专网
#import "/template.typ":*
#doc-template(
title: "udp2raw + Wiregurad组建虚拟专网",
date: "2024年1月27日",
body: [

== 服务端配置

Wireguard配置:

```
[Interface]
Address = 10.7.1.1/24
ListenPort = 51820
PrivateKey = *************
MTU=1350

[Peer]
PublicKey = *************
AllowedIPs = 10.7.1.2/32
```


用iptables开启NAT:

```
#!/bin/bash

IPT=iptables
SUB_NET=10.7.1.0/24
IN_FACE=eth0
WG_FACE=wg0
WG_PORT=51820

sudo $IPT -t nat -I POSTROUTING 1 -s $SUB_NET 

...

Email: i (at) mistivia (dot) com