OpenVPN server and client on the same machine (RPi)
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OpenVPN server and client on the same machine (RPi)
Hi,
I have RPi running OpenVPN server and client, both in routing. While server is running fine when client is down, it stops working when the client is up. RPi itself has still access to the internet via the client VPN.
First thoughts are speculative as you haven't shared enough detail. When the OpenVPN client becomes active, I assume that the remote VPN server may push a 'redirect-gateway' directive to your local OpenVPN client ie this would change the R.Pis default gateway. Now all internet traffic will be via the VPN. That would break any connections to your R.Pi OpenVPN server. Some policy-based routing will be needed to ensure properly route traffic that should go via the VPN tunnel and traffic that should not.
First thoughts are speculative as you haven't shared enough detail. When the OpenVPN client becomes active, I assume that the remote VPN server may push a 'redirect-gateway' directive to your local OpenVPN client ie this would change the R.Pis default gateway. Now all internet traffic will be via the VPN. That would break any connections to your R.Pi OpenVPN server. Some policy-based routing will be needed to ensure properly route traffic that should go via the VPN tunnel and traffic that should not.
Yes, that correct assumptions, except I can still connect to the server and reach first hop.
ip rule add from 192.168.1.17 table 10
ip route add default via 192.168.1.1 table 10
Sorry, I didn't make myself clear enough. I have tried many options including the ones on the openvpn community forum. However I have another idea I'll test this evening.
ip rule add from 192.168.1.0/24 or 192.168.2.1 or 192.168.1.17 or 192.168.2.0/24 table 10
ip route add default via 192.168.1.1 or 192.168.2.1 or 192.168.1.17 table 10
Code:
cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
10 vpn
It's hard to diagnose from a distance, and I don't have the time to drill deeper with this. You could cast your net wider by posting your issue on the openVPN Forum perhaps.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.