Hi,
i have following szenario:
A pc with the following interfaces with openvpn client installed.
Interface wwan0 connects to the internet. It is configured via DHCP.
The wwan0 interface shall also be used for the openvpn connection.
wlan0 interface to connect to a wifi. Also configured via DHCP. The wifi may also provide an internet connection.
In general the openvpn connection does work. But if i have both connections established (wlan0 and wwan0 are connected)
the openvpn client does always use the wlan0 interface.
How can i prevent this - i assume the problem is related to the default gateway setting of my setup. Is that correct?
Thanks in advance
Bind interface to VPN connection
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVpn Newbie
- Posts: 2
- Joined: Thu Oct 05, 2017 11:42 am
-
- OpenVpn Newbie
- Posts: 2
- Joined: Thu Oct 05, 2017 11:42 am
Re: Bind interface to VPN connection
I forgot to mention that i am running linux on the client pc.
-
- OpenVpn Newbie
- Posts: 2
- Joined: Fri Apr 26, 2019 6:32 pm
Re: Bind interface to VPN connection
there is no mention of OS. You mentioned default gateway, ubuntu? if on linux, edit /etc/network/interfaces to include "gateway x.x.x.x" to route traffic through the desired interface, there is also the ip tables,
sudo iptables -A FORWARD -o tun0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
UGH BORING.
or on any operating system, just disable the interface you dont want traffic to flow through.
sudo iptables -A FORWARD -o tun0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
UGH BORING.
or on any operating system, just disable the interface you dont want traffic to flow through.
-
- OpenVpn Newbie
- Posts: 1
- Joined: Mon Aug 09, 2021 9:43 pm
Re: Bind interface to VPN connection
@tandr, Did this provide the answer you are looking for? I am trying to do the same thing. I want to force the VPN to get established using a specific network interface.