Linux 开机自动启动VPN客户端

vi /etc/systemd/system/openvpn@.service

Unit

Description=OpenVPN connection to %I

After=network.target network-online.target

Wants=network-online.target

Service

Type=notify

ExecStart=/usr/sbin/openvpn --config /etc/openvpn/client/%i.ovpn

Restart=on-failure

KillMode=process

Install

WantedBy=multi-user.target

==============

systemctl daemon-reload

systemctl enable openvpn@MaAnShanClient

sudo systemctl status openvpn@MaAnShanClient

==============

vi /etc/openvpn/client/MaAnShanClient.ovpn

auth-user-pass /etc/openvpn/client/static-auth-MaAnShanClient

vi /etc/openvpn/client/static-auth-MaAnShanClient

里面内容 两行,用户名 口令

sudo chmod 600 /etc/openvpn/client/static-auth-MaAnShanClient

sudo chown root:root /etc/openvpn/client/static-auth-MaAnShanClient

systemctl restart openvpn@MaAnShanClient

相关推荐
云烟成雨TD3 分钟前
Spring AI 1.x 系列【51】可观测性技术选型
java·人工智能·spring
星越华夏4 分钟前
ESP32-CAM图像传输项目说明文档
java·后端·struts·esp32
Jinkxs1 小时前
Java 跨域14-Java 与区块链(Hyperledger)集成
java·开发语言·区块链
mounter6251 小时前
现代 Linux 内存管理的演进与变革:从传统 LRU 到多代架构 MGLRU
linux·服务器·kernel
赵渝强老师2 小时前
【赵渝强老师】Kubernetes(K8s)中的金丝雀升级
linux·docker·云原生·容器·kubernetes
晨曦中的暮雨2 小时前
Golang速通(Javaer版)
java·开发语言·后端·golang
七老板的blog2 小时前
当 Spring StateMachine 遇见大模型:构建工业级 AI 写作流水线
java·人工智能·spring
Qt程序员2 小时前
Linux RCU 原理与应用
linux·c++·内核·linux内核·rcu
The Sheep 20232 小时前
Vue复习
linux·服务器·数据库
兄台の请冷静2 小时前
Linux 安装es
linux·elasticsearch·jenkins