Mark Ku's Blog
首頁 關於我
Ubuntu automatically connect to Open VPN on startup
Infra
Ubuntu automatically connect to Open VPN on startup
Mark Ku
Mark Ku
November 28, 2024
1 min

First, Download open vpn certificate from your firewall(SOPHOS)

Download vpn configuration
Download vpn configuration

Copy ssl vpn configuration to “/etc/openvpn”

sudo cp sslvpn-mark.ku-client-config.ovpn /etc/openvpn/vpn.ovpn

Create vpn account and password file for open vpn connection

sudo vim /etc/openvpn/credentials.txt

credentials.txt

vpn account
vpn password

Grant permissions

sudo chmod 600 /etc/openvpn/credentials.txt sudo chown root:root /etc/openvpn/credentials.txt

Install open vpn

sudo apt update
sudo apt upgrade
sudo apt install openvpn

Test the VPN is working

sudo openvpn --config /etc/openvpn/vpn.ovpn --auth-user-pass /etc/openvpn/credentials.txt
sudo vim /etc/systemd/system/openvpn.service
[Unit]
Description=OpenVPN client service
After=network.target

[Service]
Type=simple
ExecStart=/usr/sbin/openvpn --config /etc/openvpn/vpn.ovpn --auth-user-pass /etc/openvpn/credentials.txt
ExecStop=/usr/sbin/openvpn --config /etc/openvpn/vpn.ovpn --auth-user-pass /etc/openvpn/credentials.txt --disconnect
Restart=on-failure

[Install]
WantedBy=multi-user.target 
sudo systemctl enable openvpn.service
sudo systemctl start openvpn.service
sudo systemctl status openvpn.service
sudo reboot

Final

You can try to connect your vpn network’s application


Tags

Mark Ku

Mark Ku

Software Developer

10年以上豐富網站開發經驗,開發過各種網站,電子商務、平台網站、直播系統、POS系統、SEO 優化、金流串接、AI 串接,Infra 出身,帶過幾次團隊,也加入過大團隊一起開發。

Expertise

前端(React)
後端(C#)
網路管理
DevOps
溝通
領導

Social Media

facebook github website

Related Posts

從Windows 到 Linux (Ubuntu) 開發環境遷移筆記
從Windows 到 Linux (Ubuntu) 開發環境遷移筆記
Invalid date
1 min

Quick Links

關於我

Social Media