Celeb Glow
updates | March 27, 2026

How connect to open vpn server without gui?

I cant use mmci and gnome gui on my laptop, because have error:

sudo nmcli connection import type openvpn file OpenVPN.ovpn
Ошибка: не удалось импортировать 'OpenVPN.ovpn': configuration error: unsupported 3th argument vpn_gateway to “route” (line 13).

But i succesfuly connected with:

sudo openvpn --config OpenVPN.ovpn 

and have opened tunnel:

tun2: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 10.0.10.6 netmask 255.255.255.255 destination 10.0.10.5 inet6 fe80::1d06:5638:3178:e66d prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100

And now, how i can use this tunnel for surfing the Internet through a browser?

2

1 Answer

I cant imported file via gui, because ovpn config have string:route x.x.x.x 255.255.0.0 vpn_gatewayBug:

My vpn cant work with console because i have problem in dns, solution(based on Ubuntu 18.04 no DNS resolution when connected to openvpn):

  1. Install openvpnsudo apt-get install openvpn

  2. Install openvpn-systemd-resolvedsudo apt install openvpn-systemd-resolved libnss-resolve

  3. Edit /etc/nsswitch.conf. Find string "hosts:" and replace to:hosts: files resolve

  4. For application which used /etc/resolv.conf directly create symlink:

ln -svi /run/systemd/resolve/resolv.conf /etc/resolv.conf
ls -la /etc/resolv.conf
  1. Start systemd-resolved:
systemctl enable systemd-resolved
systemctl start systemd-resolved
  1. Edit *.ovpn file, add:
script-security 2
up /etc/openvpn/update-systemd-resolved
down /etc/openvpn/update-systemd-resolved
down-pre

and at the end of file:

dhcp-option DOMAIN-ROUTE .
  1. Connect to vpn and enjoy
sudo openvpn --config my-vpn.ovpn

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy