---
# System prepended metadata

title: openvpn

---

# openvpn
curl -fsSl https://get.docker.com | bash
service docker restart
docker pull kylemanna/openvpn


mkdir ovpn-data
OVPN_DATA="ovpn-data"

docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u tcp://ip

docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki nopass
提示:Common Name (eg: your user, host, or server name) [Easy-RSA CA]:
ip

启动
docker run -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/tcp --cap-add=NET_ADMIN kylemanna/openvpn

创建client配置:
docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn