我在NAT后面的计算机上有一台Web服务器,其中包含几TB的数据。 我想通过Azure上的VPS将其公开给Internet。
因此,我认为WireGuard将是一个很好的工具,但我不知道如何配置。
这是位于背后的NAT服务器上的wg0.conf
:
[Interface]
PrivateKey = OBUNhf6***
Address = 192.168.10.2/24
[Peer]
PublicKey = sUukxiqVNJQpcUVLYu/+fmHH+K9qD7Ol9CipOdlOc3c=
AllowedIPs = 192.168.10.1/24
Endpoint = 13.66.155.255:8101
PersistentKeepalive = 25
在同一台计算机上运行curl,表明Web服务器在端口9000上运行良好:
$ curl -s http://192.168.10.2:9000/
<html><head>
<title>Welcome to nginx!</title>
...
那个13.66.155.255端点-是VPS的IP。
因此,现在,我正在Azure上配置Ubuntu 19.10 VPS。所以wg0.conf
:
[Interface]
PrivateKey = sDH1wvnyRKE***
ListenPort = 8101
Address = 192.168.10.1/24
Table = 1234
PostUp = ip rule add ipproto tcp dport 9000 table 1234
PreDown = ip rule delete ipproto tcp dport 9000 table 1234
[Peer]
PublicKey = cnHwqyRLukwYoYw8nl+PH57ZsCKnMmStmXBAZSRNfx0=
AllowedIPs = 192.168.10.0/24
我在两台计算机上都启动了WireGuard。 看起来KeepAlive数据包已成功传输(我看到传输在增加)。
我可以像这样从VPS中打开该Web服务器:
VPS# curl 192.168.10.2:9000
<html><head>
<title>Welcome to nginx!</title>
...
但是我无法从VPS外部打开该Web服务器:
% curl http://13.66.155.255:9000/
curl: (7) Failed to connect to 13.66.155.255 port 9000: Connection refused
我的Azure防火墙(NSG)的端口8101和9000已打开。
我的Ubuntu防火墙已禁用。
启用内核PF:net.ipv4.ip_forward=1
我想念什么?
在此之上是否应该进行某种iptables
配置?