我用 AWS 设置了一个wireguard 服务器,用一个树莓派设置了wireguard 客户端。
现在我需要将 WG 流量 (wg0) 重定向到 eth1(eth0 是我的交换机的上行链路)
-- 我的目标是在客户端连接到 PI eth1(全隧道)时从我的 WG 服务器获取 IP
我的 WG 配置
[Interface]
Address = 10.1.1.1/24
ListenPort = 51820
PrivateKey = ##
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = ##
AllowedIPs = 10.1.1.2/32
我安装了 Netplan,但我对配置很迷茫(我需要将 WG0 流量发送到 ETH1)
以下配置是否有意义:(可能不是......)
network:
version: 2
renderer: networkd
bonds:
bond0:
dhcp4: yes
interfaces:
- wg0
- eth1
parameters:
primary: wg0
It's would be even better for the Raspberry PI to joint my UniFi VLAN (uplink) and get an IP from there but still sent/receive all the traffic from WG server but that's to complex for me I guess
更新:我应该将 WG 配置添加到 Netplan 吗?
tunnels:
network:
version: 2
renderer: networkd
bonds:
bond0:
dhcp4: yes
interfaces:
- wg0
- eth1
parameters:
primary: wg0
wg0:
mode: wireguard
addresses: 10.1.1.1/24
peers:
- keys:
Public_key?
...
key: Private_key?