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.
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
if you are having server-side(Openvpn server) access normally its under
/etc/openvpn/server/server.conf
or/etc/openvpn/server.conf
comment this configuration it will stop public traffic through OPEVPNjust put your desire website ip address like you can find desire website ip here
save this file and restart your openvpn service
systemctl restart [email protected]