OpenVPN on LXC
適用 Ubuntu 18.04
建立 LXC 過程中需要預先關閉非特權的功能否則後續 TUN/TAP 會無法建立
apt update &&apt upgrade -y && apt install -y ca-certificates wget net-tools gnupg2
wget https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh -O ubuntu-22.04-lts-vpn-server.sh
chmod -v +x ubuntu-22.04-lts-vpn-server.sh
./ubuntu-22.04-lts-vpn-server.sh
建立TUN/TAP: LXC 開啟 TUN/TAP
重新設定:
/usr/local/openvpn_as/bin/ovpn-init tool
如果遇到:
LXC:Unable to create new inotify object: Too many open files
請執行: LXC:開啟太多LXC 遇到 inotify limits 解法
# --- stop the service --- #
sudo systemctl stop openvpn@server
# --- start the service --- #
sudo systemctl start openvpn@server
# --- restart the service --- #
sudo systemctl restart openvpn@server
# --- get the service status --- #
sudo systemctl status openvpn@server
最後登入頁面下載conf之後,使用文字編輯器修改掉內網IP為外網IP,路由器開啟對應轉發Port即可
阅读剩余
THE END