3

I have set up an OpenVPN server for access to my work LAN. It appears that all traffic routes through the vpn server when it's connected but I only want LAN traffic to go to it. How can I stop this? Specifically, I want only a single website with a public dns which is resolves to a 10.* subnet IP to go through the vpn and everything else to go via my regular ISP.

Here is my server.conf

port 1194

proto udp

dev tun

ca ca.crt
cert my.crt
key my.key
dh dh2048.pem

server 192.168.7.0 255.255.255.0

ifconfig-pool-persist ipp.txt

push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

keepalive 10 120

comp-lzo

user nobody
group nogroup

persist-key
persist-tun

status openvpn-status.log
verb 3

Here is my ovpn file

client
dev tun
proto udp
remote mydomain.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert my.crt
key my.key
remote-cert-tls server
ping 15
ping-restart 120
route 10.0.0.0 255.0.0.0
route-nopull
comp-lzo
daemon
verb 3
user nobody
group nogroup

Softether works the way i want it to, not routing all traffic through the vpn server. I need to either change the metric for the OpenVPN gateway or mark it as not the default gateway. route

SOFTETHER

default         192.168.1.1     0.0.0.0         UG    600    0        0 wlp1s0
10.0.0.0        10.0.1.1        255.0.0.0       UG    0      0        0 vpn_vpn

OPENVPN

default         192.168.7.5     0.0.0.0         UG    50     0        0 tun0
default         192.168.1.1     0.0.0.0         UG    600    0        0 wlp1s0

The following is from the OpenVPN howto, it indicates that the default is not to direct all traffic through the vpn which is what I want but my configuration at least makes this seem to be the opposite.

By default, when an OpenVPN client is active, only network traffic to and from the OpenVPN server site will pass over the VPN. General web browsing, for example, will be accomplished with direct connections that bypass the VPN.

3
  • 1
    I think you're looking to achieve "split tunneling". Trying searching about for split-tunneling options for your particular server or clients. – elCrash Jul 27 '16 at 3:01
  • Show route table and interfaces: ip r and ip a . From configs I do not see redirect-gateway option so only VPN traffic should go thru VPN. What is your local interface IP? – Dariusz Bączkowski Jul 27 '16 at 7:26
  • edited to add routes. I don't have a redirect-gateway set. Whatever solution I find I need to be able to apply to non tech staff laptops as well as mine. – markhorrocks Jul 27 '16 at 11:09
10

The problem was caused by Network Manager which was handling the opvn config. To disable sending all traffic through the VPN do this

Click NetworkManager applet icon > VPN Connections > Configure VPN... > select VPN network > Edit > IPv4 Settings > Routes... > Check 'Use this connection only for resources on its network'

https://ubuntuforums.org/showthread.php?t=1668165

1
  • 1
    Great this has solved the issue on my Ubuntu 17.10. Thanks! – Eduardo B. Jan 28 '18 at 23:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.