Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

OpenVPN on Ethernet problem

Thu May 25, 2017 11:01 am

I have OpenVPN running on an Rpi 3. When the pi is running on wifi everything works fine. I can connect a client to OPVN and use VPN to access the internet. When I plug an Ethernet cable in and turn off wifi I can still connect to the internet from the pi and connect to the VPN from a client but I cannot access the internet from a client while connected to the VPN.

If I unplug the Ethernet cable and turn on wifi everything's fine again.

Thoughts? What other info do you need? My Network/dhcpd and network/interfaces files are in their default configuration.

Thank you,

Sean

User avatar
lmarmisa
Posts: 1306
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: OpenVPN on Ethernet problem

Thu May 25, 2017 11:32 am

Your problem could be related to the default route. This command will help to diagnose the cause of the error (type it in both scenarios):

Code: Select all

ip route

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 3:17 am

Thanks for your reply.

When I run ip route with the ethernet cable attached I receive:

default via 192.168.0.1 dev eth0 metric 202
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.195 metric 202

When I run it without ethernet, wifi only, I receive:

default via 192.168.0.1 dev wlan0 metric 303
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.195
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.195 metric 303

Does this help you at all?

Sean

User avatar
DougieLawson
Posts: 40184
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 7:39 am

Try this:
sudo ifconfig eth0 0
sudo ifconfig eth0 down

to force use of WiFi.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
lmarmisa
Posts: 1306
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 12:32 pm

The default routes look good. Are you connected to the same router in both cases?. The problem seems external to your RPi.

Try these commands too:

Code: Select all

ping -c4 8.8.8.8
ping -c4 google.com
traceroute 8.8.8.8
traceroute google.com
If the command is not available, install it with this command:

Code: Select all

sudo apt-get install traceroute

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 5:07 pm

DougieLawson wrote:Try this:
sudo ifconfig eth0 0
sudo ifconfig eth0 down

to force use of WiFi.

Thanks.I am able to force wifi use by disconnecting the ethernet cvable and connect to my OVPN server but I am trying to keep both alive and functional so that if either wifi or ethernet goes down there will be a back up connection to my OVPN server.

Sean

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 5:16 pm

lmarmisa wrote:The default routes look good. Are you connected to the same router in both cases?. The problem seems external to your RPi.

Try these commands too:

Code: Select all

ping -c4 8.8.8.8
ping -c4 google.com
traceroute 8.8.8.8
traceroute google.com
If the command is not available, install it with this command:

Code: Select all


sudo apt-get install traceroute
I believe you are correct that the problem is external to the pi hardware. I ran traceroute without any issue.

I decided to reinstall openvpn via pivpn as I had done originally but this time only with ethernet connected, wifi off.

I am now able to connect to the OVPN server with the pi connected to the router via ethernet but cannot connect when the pi is connercted via wifi.

It is the exact opposite of my original problem!

There is clearly some configuration problem with the pi eth/wlan adapter, router config, or something else that I don't understand.

I am still able to connect to the internet while on the pi but now I cannot connect to the internet thru the OVPN when the pi is connected wirelessly.

I am using the same router for all of this which is located a foot away from the pi.

Any other ideas?


Sean

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Fri May 26, 2017 5:18 pm

Also, I looked at my ovpn server.conf file and I don't see why it would matter if the pi is connected thru wifi or ethernet.

Could it be a firewall problem? iptable?

crashboogie
Posts: 34
Joined: Thu Aug 04, 2016 4:03 am

Re: OpenVPN on Ethernet problem

Sat May 27, 2017 5:09 pm

I remember having a similar issue and messing with the iptables. That seemed to be the trick from what I remember. Try to use this code found here
https://arashmilani.com/post?id=53

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Tue May 30, 2017 4:07 pm

crashboogie wrote:I remember having a similar issue and messing with the iptables. That seemed to be the trick from what I remember. Try to use this code found here
https://arashmilani.com/post?id=53
Thanks. I'll take a look. Thanks to replies on this thread and further troubleshooting it looks like the trouble is openvpn will only listen on the interface which was active when openvpn was installed. Even though I have the wireless and ethernet interfaces using the same internal ip address traffic cannot reach the internet using wlan0 when openvpn was installed while eth0 was active and vice versa.

Thanks,

Sean

Sean

Sean5555
Posts: 9
Joined: Tue Sep 20, 2016 3:20 am

Re: OpenVPN on Ethernet problem

Sat Jun 03, 2017 5:23 pm

Sean5555 wrote:
crashboogie wrote:I remember having a similar issue and messing with the iptables. That seemed to be the trick from what I remember. Try to use this code found here
https://arashmilani.com/post?id=53
Thanks. I'll take a look. Thanks to replies on this thread and further troubleshooting it looks like the trouble is openvpn will only listen on the interface which was active when openvpn was installed. Even though I have the wireless and ethernet interfaces using the same internal ip address traffic cannot reach the internet using wlan0 when openvpn was installed while eth0 was active and vice versa.

Thanks,

Sean

Sean

I tried this iptable modification but still no luck. Thanks for your ideas anyway.

jmscreator
Posts: 1
Joined: Wed Jul 29, 2020 6:39 pm

Re: OpenVPN on Ethernet problem

Wed Jul 29, 2020 6:52 pm

Hey!
So I know this thread is about 3 years old, but it's word-for-word the exact same issue I am facing. I cannot for the life of networking figure out what is going on here.

Did anyone ever figure out how to fix this problem?

The best I could come up with is that there is something wrong with the openvpn configuration that pivpn doesn't take into account for. I am just not familiar enough with the nitty-gritty openvpn configuration scripts and config files, and how to get the traffic to route to either the wlan0 and the eth0. I know that it's not an issue with listening on the eth0 or vice versa, because I can connect to the VPN just fine; however, I cannot access the internet (route to the default gateway on the network) when connected to the VPN. I can access the Raspberry PI server remotely via the VPN. This means that the OVPN server is listening and making a valid connection on either wlan0 or eth0. But for some reason the routing is all screwed up on eth0, and won't route the OVPN client traffic through eth0, but instead works just fine via wlan0. (Reversed depending on if you installed pivpn with the eth0 connected or wlan0 connected)

If someone could please help us/me figure this out, that would be great. I'm honestly thinking of making an official bug report on the git repository for pivpn as technically this shouldn't be an issue when installing via the pivpn installation script.

Any feedback would greatly be appreciated! Thanks!

Return to “General discussion”