rancher安裝Openvpn

AskHarries發表於2020-04-03

背景:

為什麼要安裝vpn,因為vpn能幫我們打通網路,極大的方便我們開發除錯和執行維護,不用把所有的內部埠都暴露到外面主機上。掛上vpn,就可以進行本機除錯和開發。

1.安裝vpn

從應用商店搜尋vpn,如下圖

rancher安裝Openvpn

選擇OpenVPN for Rancher with "Rancher local" authentication 這個,也就是第四個,點選詳情進去

rancher安裝Openvpn

2.服務端配置vpn

啟動完之後,修改服務端配置,

rancher安裝Openvpn

點選右上角【升級】按鈕,

rancher安裝Openvpn

一定要記得修改,AUTHRANCHERLOCALURL 這個後面會驗證使用者名稱和密碼需要用到。將http[s]://hostname[:port] 改成自己訪問rancher的地址,然後點選升級

3.客戶端配置

客戶端新建配置檔案rancher_product.ovpn,內容如下

remote 118.191.2.218 1194clientdev tunproto tcpremote-randomresolv-retry infinitecipher AES-128-CBCauth SHA1nobindlink-mtu 1500persist-keypersist-tuncomp-lzoverb 3auth-user-passauth-retry interactns-cert-type server<ca>-----BEGIN CERTIFICATE-----MIIEmzCCA4OgAwIBAgIJANYjZIooTEHeMA0GCSqGSIb3DQEBCwUAMIGPMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQUwxEzARBgNVBAcTCkJpcm1pbmdoYW0xDTALBgNVBAoTBEFDTUUxCzAJBgNVBAsTAklUMRAwDgYDVQQDEwdBQ01FIENBMRAwDgYDVQQpEwdFYXN5UlNBMR4wHAYJKoZIhvcNAQkBFg9mb29AZXhhbXBsZS5jb20wHhcNMjAwMzA5MDczOTU5WhcNMzAwMzA3MDczOTU5WjCBjzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkFMMRMwEQYDVQQHEwpCaXJtaW5naGFtMQ0wCwYDVQQKEwRBQ01FMQswCQYDVQQLEwJJVDEQMA4GA1UEAxMHQUNNRSBDQTEQMA4GA1UEKRMHRWFzeVJTQTEeMBwGCSqGSIb3DQEJARYPZm9vQGV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ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-----END CERTIFICATE-----</ca>複製程式碼

配置完之後匯入tunnelblick

4.驗證

啟動客戶端tunnelblick

rancher安裝Openvpn

點選連結,連線成功之後,日誌顯示

2020-03-16 16:28:24.021898 MANAGEMENT: >STATE:1584347304,CONNECTED,SUCCESS,10.43.0.6,118.190.1.218,1194,192.168.13.115,637132020-03-16 16:28:24.175641 *Tunnelblick: Could not determine this computer's apparent public IP address before the connection was completed2020-03-16 16:28:24.246528 *Tunnelblick: DNS address 169.254.169.250 is being routed through the VPN2020-03-16 16:28:27.869402 *Tunnelblick: process-network-changes: A system configuration change was ignored2020-03-16 16:46:34.715189 *Tunnelblick: process-network-changes: A system configuration change was ignored2020-03-16 16:51:18.458545 *Tunnelblick: process-network-changes: A system configuration change was ignored複製程式碼

開啟終端驗證一下網路是否聯通,

rancher安裝Openvpn

說明已經連線了,大功告成




相關文章