Synology NAS OpenVPN Route 亂談
這裡不談到底 VPN 該建在 Router 端 or NAS 端, 這各有不同的考量, 不少網友詢問 client 連線 NAS 上的 OpenVPN Server, 但無法存取到內網上的其他網路資源, 其實這就是路由的問題.
OpenVPN 的 route 可以透過好幾種方式去佈建, 可以是 push or pull. 就如附圖上面的這個設定 "允許用戶端存取伺服器的區域網路“, 它到底在做了什麼?
其實它就是 push route 給 client. 當 VPN tunnel 建立起來後, client 必須加入那些路由設定.
在 NAS VPN server 端 config file,
/usr/syno/etc/packages/VPNCenter/openvpn/openvpn.conf 它加了一筆 (註. NAS 內網網段為 192.168.10.0/24)
push "route 192.168.10.0 255.255.255.0″
原理就是這麼簡單,
另一種是 OpenVPN client 去設定 default gateway 都往 VPN tunnel 走.
# If redirect-gateway is enabled, the client will redirect it’s
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
# redirect-gateway def1
是不是都很容易