LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-05-2021, 03:06 PM   #1
Dan Suson
Member
 
Registered: Aug 2007
Location: Valparaiso, IN
Distribution: Slackware
Posts: 100

Rep: Reputation: 7
Setting up VPN for family use with openVPN


For security reasons, my Slackware64-current computer is using iptables with everything dropped except for specific computers. Those on my home network are able to connect with my computer, as is my work computer, which has a fixed IP number. I'm trying to also set up access for my laptop, which needs to be able to connect from wherever I may be. After some research, I realized that I would need to create a VPN. I have been following the instructions for setting up openvpn found at https://docs.slackware.com/howtos:ne...rvices:openvpn in order to set up both the server (my desktop machine) and client (my laptop).

I have been able to set up the tunnel between the two machines and temporarily allowed ping to work in order to test the connections. This basically gets me through chapter 10 in the document. Since I am only need this to do a ssh/sftp connection from my laptop to my desktop, I haven't gone further yet. Unfortunately, ssh does not connect through the VPN. Do I need to add rules to iptables to let the client do more, configure the server to forward packets beyond the server, or something else?

I am taking a trip in a week and so need to finalize this relatively quickly. Any help is greatly appreciated!
 
Old 03-05-2021, 04:27 PM   #2
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by Dan Suson View Post
Unfortunately, ssh does not connect through the VPN.
Yeah, that's a firewall issue. But you can easily work around it by starting a reverse ssh session on the target machine. Eg:

Code:
$ ssh -fNR 22222:localhost:22 user@xx.xx.xx.xx
Where 'user' is your username and xx.xx.xx.xx is the IP address of the machine you'll be connecting to it from. Leave the word 'localhost' in the command.

You can then connect to that machine by first connecting to the VPN and then:

Code:
$ ssh -p22222 user@localhost
Again, use the proper username, but leave the word 'localhost' in the command.

Note: You don't have to use port 22222, you can use any port up to 65535 (I think).

I use this to connect to my home machine from the office. The home machine connects to the VPN server in my office. Once I start the reverse ssh session on the home machine, I can ssh into it from the office. It doesn't work without the reverse ssh session because the home machine is behind a restrictive firewall.

Last edited by rkelsen; 03-05-2021 at 04:34 PM.
 
Old 03-05-2021, 04:44 PM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
I note that chapter 11 onwards of the documentation you linked only applies if the Slackware box is also your router & firewall. This is not the case for me.

With my setup, I found the OpenVPN documentation to be quite helpful: https://openvpn.net/community-resour...server-subnet/

There is one sentence in that document, which I will quote here: "you must set up a route on the server-side LAN gateway to route the VPN client subnet (10.8.0.0/24) to the OpenVPN server (this is only necessary if the OpenVPN server and the LAN gateway are different machines)"

In my case, this meant logging into the router and creating a static route to the VPN server.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to allow OpenVPN (W10) client to use DNS server (BIND9) that resides on (Ubuntu 16.04) OpenVPN server? grigory Linux - Networking 13 09-17-2019 10:54 PM
[SOLVED] How to use openvpn or pptp vpn plugin in NetworkManager? kcynice Slackware 13 03-24-2017 05:10 AM
LXer: How to use OpenVPN to configure your own VPN server LXer Syndicated Linux News 0 10-29-2014 10:30 AM
Differences between Apache 1.3 family vs. 2.0 family rushenas Linux - Software 6 11-07-2007 04:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration