SIP電話機OpenVPN 使用及憑證產生說明

模組介紹

概述

虛擬私人網路 VPN(virtual private network)是在公共網路中建立的安全網路連線。這種網路連線與一般意義上的網路連線不同之處在於,它採用了專用的隧道協定,實現資料的加密和完整性檢驗、使用者身分認證,從而保證資訊在傳輸中不被偷看、竄改、複製。從網路連線安全性的角度來看,就類似於在公共網路中建立了一個專線網路,只不過這個專線網路是邏輯上的而不是實體的,所以稱為虛擬私人網路。VPN 系統包括 VPN 伺服器、VPN 用戶端和隧道。由於使用 Internet 進行傳輸相對於租用專線來說,費用極為低廉,所以 VPN 的出現使企業透過 Internet 既安全又經濟地傳輸私有的機密資訊成為可能。
我們介紹的是利用 OpenVPN 配置 VPN。OpenVPN 是一個開源的第三方虛擬私人網路配置工具,可以利用既有設備搭建 VPN 應用閘道。

伺服器的安裝與配置

OpenVPN 是一個開源的第三方虛擬私人網路配置工具,可以利用既有設備搭建 VPN 應用閘道。以下將分別介紹 Ubuntu、Windows 作業系統下的伺服器部署與配置。

Ubuntu 下搭建OpenVPN 伺服器

2.1.1安裝 OpenVPN 伺服器
在 Ubuntu 下輸入以下命令:
sudo apt-get -y install openvpn libssl-dev openssl
sudo apt-get -y install easy-rsa
2.1.2憑證製作
按照以下步驟執行命令,產生 OpenVPN 正常運行所需要的憑證初始化配置:
sudo mkdir /etc/openvpn/easy-rsa/
sudo cp -r /usr/share/easy-rsa/* /etc/openvpn/easy-rsa/
sudo su
sudo vi /etc/openvpn/easy-rsa/vars
----->按照需要可以修改憑證配置如下:
export KEY_COUNTRY=”CN”
export KEY_PROVINCE=”BJ”
export KEY_CITY=”BeiJing”
export KEY_ORG=”fanvil”
export KEY_EMAIL=”fanvil@fanvil.com”
export KEY_OU=”fanvil”
export KEY_NAME=”server”
執行 vars:    source vars
如果第一次執行清空所有:    ./clean-all
產生 CA 憑證:    ./build-ca
產生伺服器憑證:    ./build-key-server server
產生用戶端憑證:    ./build-key client
產生動態密碼庫.    ./build-dh

啟動伺服器

伺服器環境配置,將相應的憑證配置檔案放入指定的目錄:
cp keys/ca.crt /etc/openvpn/
cp keys/server.crt keys/server.key keys/dh2048.pem /etc/openvpn
mv /etc/openvpn/dh2048.pem /etc/openvpn/dh1024.pem
cp keys/client.key keys/client.crt   /etc/openvpn/
cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
cd /etc/openvpn
gzip -d server.conf.gz
cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn/
啟動伺服器:
/etc/init.d/openvpn restart

Windows 下搭建OpenVPN 伺服器

2.3.1安裝 OpenVPN 伺服器
在網上搜尋下載 Windows 版的 OpenVPN 軟體。本篇搭建使用的是 OpenVPN GUI;雙擊下載軟體進行預設安裝,注意勾選安裝 easy-rsa 配件。預設路徑是 C:\Program Files\OpenVPN。
2.3.2憑證製作
在進行操作之前,首先要進行初始化工作:
請根據自身情況修改 C:\Program Files\OPENVPN\easy-rsa\vars.bat.sample 的以下部分
set HOME=C:\Program Files\OPENVPN\easy-rsa
set KEY_COUNTRY=CN    #(國家)
set KEY_PROVINCE=BEIJING    #(省份)
set KEY_CITY= BEIJING    #(城市)
set KEY_ORG=WINLINE    #(組織)
set KEY_EMAIL=admin@winline.com.cn    #(郵件地址)
上面#開始的是註解,請不要寫到檔案中。
以管理員權限開啟 cmd 進入 DOS,執行下列命令進入
openvpn\easy-rsa 目錄:
        init-config
        vars
        clean-all
產生根憑證:    build-ca(一路按 Enter 按照預設配置產生即可)
產生動態密碼庫:    build-dh
產生伺服器憑證:    build-key-server server(一路按 Enter 按照預設配置產生即可)
產生用戶端憑證:    build-key client(一路按 Enter 按照預設配置產生即可)
2.3.3啟動伺服器
產生的金鑰均存放於 OpenVPN\easy-rsa\keys 目錄下
將產生的憑證複製到 OpenVPN\config 目錄下
將 OpenVPN\sample-config 下的伺服器配置檔案複製到 OpenVPN\config 目錄下,啟動 OpenVPN 應用程式即可

伺服器端配置

在 OpenVPN 的安裝目錄下,使用 notepad++ 開啟 server.ovpn 或者 server.conf 檔案,查看伺服器端檔案例子如下:
port 1194 # 這個連接埠是 IANA 為 OpenVPN 分配的指定連接埠,可以根據需要自行修改
proto udp # 可以選用 tcp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.8.0.0 255.255.255.0 # 虛擬區域網路網段設定,請根據需要自行修改
ifconfig-pool-persist ipp.txt
keepalive 10 120
client-to-client
comp-lzo
max-clients 100
persist-key
persist-tun
status openvpn-status.log
verb 3
更多詳細介紹可以參考 OpenVPN Wiki

用戶端使用與配置

用戶端配置

這裡的用戶端針對的是我們支援 OpenVPN 的設備。為了讓我們的電話機能夠連接到 OpenVPN 伺服器,我們需要憑證檔案。
首先需要針對用戶端的配置檔案 client.ovpn 或者 client.conf 進行編輯修改,用戶端配置檔案例子如下:
client
dev tun
proto udp
remote 192.168.1.135 1194 #伺服器網域/IP 和連接埠
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key comp-lzo
verb 3
可以結合伺服器端的配置進行相關修改。
其次將我們之前製作好的用戶端檔案 ca.crt、client.crt、client.key 匯出,在電話機升級時使用。

電話機使用 OpenVPN

登入電話機網頁,依次點擊網路->VPN,在 OpenVPN 檔案欄逐個升級 client.ovpn, client.key, client.crt, ca.crt。升級完成後,OpenVPN 檔案欄會顯示已升級進入的憑證檔案大小,如下所示
升級OpenVPN 檔案開啟 VPN 配置頁面,在 VPN 模式選擇 Open VPN,同時啟用 VPN,點擊提交按鈕。當成功連接伺服器之後,會在 VPN 頁面的 VPN 連線狀態一欄中顯示取得的 IP 位址,如下圖所示,取得的 IP 為 10.8.0.10。
開啟VPN配置介面

開啟 VPN NAT

開啟 VPN NAT介面
使用方法:
電話機匯入 VPN 憑證,開啟 Enable VPN 和 Enable NAT,PC(閘道需要設定為電話機的 IP)連接電話機 LAN 口,此時 PC 能夠存取電話機的 VPN。
PC ping10.8.0.10 可以 ping 通,ping www.baidu.com 也可以 ping 通(10.8.0.10 是 VPN IP 位址)
註:目前支援機型 J3G/X3U/X3SG/J1P 以及 X5S/X6/X7/X7C/X210/X210i;電話機 X3S/X4/X7 暫不支援

目錄
客服 電話
We use cookie to improve your online experience. By continuing to browse this website, you agree to our use of cookie.

Cookies

This Cookie Policy explains how we use cookies and similar technologies when you access or use our website and related services. Please read this Policy together with our Terms and Conditions and Privacy Policy so that you understand how we collect, use, and protect information.

By continuing to access or use our Services, you acknowledge that cookies and similar technologies may be used as described in this Policy, subject to applicable law and your available choices.

Updates to This Cookie Policy

We may revise this Cookie Policy from time to time to reflect changes in legal requirements, technology, or our business practices. When we make updates, the revised version will be posted on this page and will become effective from the date of publication unless otherwise required by law.

Where required, we will provide additional notice or request your consent before applying material changes that affect your rights or choices.

What Are Cookies?

Cookies are small text files placed on your device when you visit a website or interact with certain online content. They help websites recognize your browser or device, remember your preferences, support essential functionality, and improve the overall user experience.

In this Cookie Policy, the term “cookies” also includes similar technologies such as pixels, tags, web beacons, and other tracking tools that perform comparable functions.

Why We Use Cookies

We use cookies to help our website function properly, remember user preferences, enhance website performance, understand how visitors interact with our pages, and support security, analytics, and marketing activities where permitted by law.

We use cookies to keep our website functional, secure, efficient, and more relevant to your browsing experience.

Categories of Cookies We Use

Strictly Necessary Cookies

These cookies are essential for the operation of the website and cannot be disabled in our systems where they are required to provide the service you request. They are typically set in response to actions such as setting privacy preferences, signing in, or submitting forms.

Without these cookies, certain parts of the website may not function correctly.

Functional Cookies

Functional cookies enable enhanced features and personalization, such as remembering your preferences, language settings, or previously selected options. These cookies may be set by us or by third-party providers whose services are integrated into our website.

If you disable these cookies, some services or features may not work as intended.

Performance and Analytics Cookies

These cookies help us understand how visitors use our website by collecting information such as traffic sources, page visits, navigation behavior, and general interaction patterns. In many cases, this information is aggregated and does not directly identify individual users.

We use this information to improve website performance, usability, and content relevance.

Targeting and Advertising Cookies

These cookies may be placed by our advertising or marketing partners to help deliver more relevant ads and measure the effectiveness of campaigns. They may use information about your browsing activity across different websites and services to build a profile of your interests.

These cookies generally do not store directly identifying personal information, but they may identify your browser or device.

First-Party and Third-Party Cookies

Some cookies are set directly by our website and are referred to as first-party cookies. Other cookies are set by third-party services, such as analytics providers, embedded content providers, or advertising partners, and are referred to as third-party cookies.

Third-party providers may use their own cookies in accordance with their own privacy and cookie policies.

Information Collected Through Cookies

Depending on the type of cookie used, the information collected may include browser type, device type, IP address, referring website, pages viewed, time spent on pages, clickstream behavior, and general usage patterns.

This information helps us maintain the website, improve performance, enhance security, and provide a better user experience.

Your Cookie Choices

You can control or disable cookies through your browser settings and, where available, through our cookie consent or preference management tools. Depending on your location, you may also have the right to accept or reject certain categories of cookies, especially those used for analytics, personalization, or advertising purposes.

Please note that blocking or deleting certain cookies may affect the availability, functionality, or performance of some parts of the website.

Restricting cookies may limit certain features and reduce the quality of your experience on the website.

Cookies in Mobile Applications

Where our mobile applications use cookie-like technologies, they are generally limited to those required for core functionality, security, and service delivery. Disabling these essential technologies may affect the normal operation of the application.

We do not use essential mobile application cookies to store unnecessary personal information.

How to Manage Cookies

Most web browsers allow you to manage cookies through browser settings. You can usually choose to block, delete, or receive alerts before cookies are stored. Because browser controls vary, please refer to your browser provider’s support documentation for details on how to manage cookie settings.

Contact Us

If you have any questions about this Cookie Policy or our use of cookies and similar technologies, please contact us at support@becke.cc .