If you are seeing the above error in LXC, you need to do two things.
- Make sure the LXC container is running on privileged mode.
- Run the following commands inside the container:
mknod /dev/net/tun c 10 200
Now, you may run the OpenVPN command to start the VPN client:
openvpn --pull-filter ignore redirect-gateway --config ovpn.ovpn
# assumming your vpn config file is ovpn.ovpn
There are cases, where you might want to use OpenVPN to redirect only a fraction of traffic, but not all. By default, after you connect to OpenVPN, server would push the call
'redirect-gateway' to the client to make the client divert all the traffic through
This behavior can be override with the following command line argument:
--pull-filter ignore redirect-gateway
You can add it in the openvpn command line as following:
openvpn --pull-filter ignore redirect-gateway --config "your_file.ovpn"
Once this is done, remember that, you have to route the targetted traffic using either the
route command or
'ip route' command, otherwise no traffic will route through your openvpn tunnel network.
If you are using OpenVPN in a Linux platform through command line, it is always handy to be able to save the authentication information in a file and let openvpn use them. There are two ways you can do it.
First save the password in a file e.g auth.txt with two lines:
First line is for username and the second line is for password.
If you are using .ovpn files for configuration, open the .ovpn file and simply add the following:
Now, your authentication would use the authentication given in that file
You may add the
auth-user-pass in the openvpn command line argument, but you have to make sure, this is passed after the
--config. Here is an example
openvpn --config "your_file.ovpn" --auth-user-pass "auth.txt"
That should be enough.