kylemanna / docker-openvpn

🔒 OpenVPN server in a Docker container complete with an EasyRSA PKI CA
https://hub.docker.com/r/kylemanna/openvpn/
MIT License
8.62k stars 2.37k forks source link

Routing DNS only #699

Open TheNighthawk99 opened 2 years ago

TheNighthawk99 commented 2 years ago

Hello, just installed from scratch, no other customization in the code. It is told everywhere to remove the following line in the client.ovpn file:

redirect-gateway def1

which I obviously did. Unfortunately, the traffic keeps to be routed through VPN entirely, while I would like DNS only. It looks like other settings must be edited, but I cannot understand where and what.

stzakar commented 2 years ago

u can write a script like a

if [ -z $1 ]; then echo "USAGE: $0 CONFIG_FNAME.ovpn" exit fi docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm -it kylemanna/openvpn easyrsa build-client-full $1 nopass docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm kylemanna/openvpn ovpn_getclient $1 > $1.ovpn sed -i '/redirect-gateway/d' $1.ovpn # is delete default GW

ps. ./script-name name-conf-user enjoy