iT邦幫忙

0

〔順利達成〕沒有公網IP建置站對站虛擬網路

1833 2024-10-24 17:43:281163 瀏覽
  • 分享至 

  • xImage

使用 UniFi Cloud Gateway Ultra 及 UniFi Dream Machine 建置 IPsec Site-to-Site VPN,使用今網網路服務因此沒有外網IP。

https://ithelp.ithome.com.tw/upload/images/20241025/20138244LcfhrGmumc.png

https://ithelp.ithome.com.tw/upload/images/20241025/20138244D9zhf3STcR.png

https://ithelp.ithome.com.tw/upload/images/20241025/20138244zIFFQA11BX.png

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
使用 UniFi Dream Machine 及 UniFi Cloud Gateway Ultra 建置 IPsec Site-to-Site VPN

網路業者:今網 (無公網IP,兩端都使用今網)
A端速率:400/400
B端速率:300/300
DDNS:Duckdns

https://ithelp.ithome.com.tw/upload/images/20250510/20138244uOi7S5lwpE.png

https://ithelp.ithome.com.tw/upload/images/20250510/201382445SvrZFec4N.png

https://ithelp.ithome.com.tw/upload/images/20250510/20138244zoL23jDO9X.png

https://ithelp.ithome.com.tw/upload/images/20250510/20138244QlgWzmEdvk.png

https://ithelp.ithome.com.tw/upload/images/20250510/201382440Jv9GFq7xj.png

https://ithelp.ithome.com.tw/upload/images/20250510/20138244Yqxf7vEgFo.png

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A to B
admin@admin ~ % iperf3 -c 192.168.2.6

Connecting to host 192.168.2.6, port 5201
[ 5] local 192.168.1.190 port 50812 connected to 192.168.2.6 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 9.12 MBytes 76.5 Mbits/sec
[ 5] 1.00-2.00 sec 7.62 MBytes 63.7 Mbits/sec
[ 5] 2.00-3.01 sec 7.75 MBytes 64.9 Mbits/sec
[ 5] 3.01-4.00 sec 9.12 MBytes 76.8 Mbits/sec
[ 5] 4.00-5.00 sec 9.62 MBytes 80.8 Mbits/sec
[ 5] 5.00-6.00 sec 8.75 MBytes 73.3 Mbits/sec
[ 5] 6.00-7.00 sec 10.4 MBytes 87.0 Mbits/sec
[ 5] 7.00-8.00 sec 10.4 MBytes 87.0 Mbits/sec
[ 5] 8.00-9.00 sec 9.75 MBytes 81.7 Mbits/sec
[ 5] 9.00-10.00 sec 10.2 MBytes 86.1 Mbits/sec


[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.00 sec 92.8 MBytes 77.8 Mbits/sec sender
[ 5] 0.00-10.02 sec 92.4 MBytes 77.4 Mbits/sec receiver

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

B to A
PS C:\iperf3> ./iperf3.exe -c 192.168.1.190
Connecting to host 192.168.1.190, port 5201
[ 5] local 192.168.2.6 port 50914 connected to 192.168.1.190 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 12.1 MBytes 101 Mbits/sec
[ 5] 1.00-2.01 sec 11.1 MBytes 92.2 Mbits/sec
[ 5] 2.01-3.00 sec 11.9 MBytes 101 Mbits/sec
[ 5] 3.00-4.01 sec 11.5 MBytes 96.1 Mbits/sec
[ 5] 4.01-5.01 sec 11.8 MBytes 97.9 Mbits/sec
[ 5] 5.01-6.00 sec 11.8 MBytes 99.5 Mbits/sec
[ 5] 6.00-7.01 sec 11.4 MBytes 94.8 Mbits/sec
[ 5] 7.01-8.00 sec 11.5 MBytes 97.4 Mbits/sec
[ 5] 8.00-9.01 sec 12.1 MBytes 101 Mbits/sec
[ 5] 9.01-10.00 sec 11.8 MBytes 99.5 Mbits/sec


[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.00 sec 117 MBytes 98.0 Mbits/sec sender
[ 5] 0.00-10.01 sec 116 MBytes 97.6 Mbits/sec receiver

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bluegrass iT邦高手 1 級 ‧ 2024-10-26 12:16:09 檢舉
你兩邊WAN都是私網IP, 算了吧
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
bluegrass
iT邦高手 1 級 ‧ 2024-10-25 14:11:52

如果你UNIFI都是直接抓到公網WAN IP, 不需要搞PORT

bluegrass iT邦高手 1 級 ‧ 2024-10-26 12:17:32 檢舉

兩邊WAN都是私網IP, 不用搞了, 可以放棄, 沒公網你接什麼VPN.

1833 iT邦新手 3 級 ‧ 2024-12-01 18:00:49 檢舉

UniFi GPT 『沒有公網IP建置站對站虛擬網路』

如果您的 UniFi Gateway 沒有公網 IP 地址,您仍然可以設置站對站 VPN,但需要進行一些額外的配置。以下是具體步驟:

使用 IPsec 站對站 VPN
要求
一個 UniFi Gateway 或 UniFi Cloud Gateway
步驟:
進入 IPsec 設定:

在 UniFi Network 應用程式中,前往 Network Settings > Teleport & VPN。
配置 IPsec VPN:

伺服器地址: 使用分配給 WAN 端口的 IP 地址或輸入手動地址。
共享遠程子網: 遠程位置使用的網絡。
遠程 IP: 遠程位置的公共 IP 地址。
配置身份驗證 ID:

如果 UniFi Gateway 位於 NAT 後面,則需要配置身份驗證 ID 以解決任何不匹配問題。例如:

UniFi Gateway Site A
WAN IP 192.168.5.1(位於 NAT 後面)
ISP modem/router Site A
WAN IP 203.0.113.1(公共 IP)
UniFi Gateway Site B
WAN IP 198.51.100.1(公共 IP)
VPN 設置在公共 IP 地址 203.0.113.1 和 198.51.100.1 之間。
當 Site B 接收到來自 Site A 的 IPsec VPN 對等請求時,它將包含 192.168.5.1 和 203.0.113.1 兩個 IP 地址。然而,Site B 只配置了與 203.0.113.1 對等,這會導致不匹配。為了解決這個問題,請在 Site A 上配置 203.0.113.1 作為 本地身份驗證 ID。
反之亦然,可以在 Site B 上配置 192.168.5.1 作為 遠程身份驗證 ID。
其他注意事項:
防火牆規則和靜態路由: 不需要手動創建,這些會自動生成。
測試連接性: 嘗試在兩個客戶端之間進行 ping,而不是在 UniFi gateway 本身之間進行 ping。如果 ping 不工作,請檢查是否有任何防火牆或流量規則配置可能阻止連接。
參考文章
UniFi Gateway - Site-to-Site IPsec VPN
UniFi Gateway - Site-to-Site IPsec VPN with Third-Party Gateways (Advanced)
這些步驟應該能幫助您在沒有公網 IP 的情況下設置站對站 VPN。如果您需要更多幫助,請點擊 這裡 聯繫支持。

Related articles:
UniFi Gateway - Site-to-Site IPsec VPN: This article explains setting up IPsec Site-to-Site VPNs on UniFi gateways, detailing required settings and troubleshooting steps.

UniFi Gateway - Site-to-Site IPsec VPN with Third-Party Gateways (Advanced): This article explains IPsec Site-to-Site VPN setup for UniFi Gateways, covering required information, interoperability, and key configuration details.

UniFi Gateway - Introduction to VPNs: This article explains UniFi Gateway's three VPN types: VPN Server, VPN Client, and Site-to-Site VPN, with supported protocols and features.

努力嘗試中........

bluegrass iT邦高手 1 級 ‧ 2024-12-02 09:23:48 檢舉

這個KB是說AGGRESIVE MODE VPN

針對位於 NAT 後面, NAT-T的應用.

說的是"其中一邊沒有沒有公網 IP 地址" 而 "對面有公網 IP 地址"

你KB中的"198.51.100.1"不就是公網嗎?

除非你有第三只網關/VPN服務器, 不然別傻了

/images/emoticon/emoticon39.gif

我要發表回答

立即登入回答