Set up a VPN, route samba over it
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I get 3 IP addresses from my ISP, so after my modem I have a switch with three things. Two are servers, one is a router. All my personal computers are behind the router. My old server used to have two ethernet ports, so I would put one on the switch and one on the router so that I could keep server traffic off the router and still be able to have samba shares for media.
My new lower-power server only has one LAN. I will eventually get a USB ethernet plug for it, but until then I'd like to still have my samba shares. I thought to myself, there must be some way to achieve this via VPN.
So what I'd like to do is this, set up a VPN server on the server, allow clients behind the router to connect to it. That seemed simple enough, except that all the guides I've seen assume you can allocate addresses on the server's LAN. Since my server's LAN is the public internet I can't really do that. Is there any way I can make up some 'imaginary' LAN that exists only in the mind of the server and put my VPN clients on that?
To clarify, if the server is 68.232.SSS.SSS and if the router is 68.232.RRR.RRR and if computers behind the router are 10.0.0.1-255 then can I make VPN clients use addresses like 192.168.0.VPN?
OOoOoOOOooOOo
OoO Public OoOOo-----Server eth0 (Real) 68.232.SSS.SSS
OoO Internet OoO eth1 (Virtual) 192.168.0.1
OoOoOOoOOoOOOo
|
--Router eth0 (WAN) 68.232.RRR.RRR
| eth1 (LAN) 10.0.0.1
|
-----Client eth1 (Virtual) 192.168.0.2
eth0 (Real) 10.0.0.2
samba vpn remote
add a comment |
I get 3 IP addresses from my ISP, so after my modem I have a switch with three things. Two are servers, one is a router. All my personal computers are behind the router. My old server used to have two ethernet ports, so I would put one on the switch and one on the router so that I could keep server traffic off the router and still be able to have samba shares for media.
My new lower-power server only has one LAN. I will eventually get a USB ethernet plug for it, but until then I'd like to still have my samba shares. I thought to myself, there must be some way to achieve this via VPN.
So what I'd like to do is this, set up a VPN server on the server, allow clients behind the router to connect to it. That seemed simple enough, except that all the guides I've seen assume you can allocate addresses on the server's LAN. Since my server's LAN is the public internet I can't really do that. Is there any way I can make up some 'imaginary' LAN that exists only in the mind of the server and put my VPN clients on that?
To clarify, if the server is 68.232.SSS.SSS and if the router is 68.232.RRR.RRR and if computers behind the router are 10.0.0.1-255 then can I make VPN clients use addresses like 192.168.0.VPN?
OOoOoOOOooOOo
OoO Public OoOOo-----Server eth0 (Real) 68.232.SSS.SSS
OoO Internet OoO eth1 (Virtual) 192.168.0.1
OoOoOOoOOoOOOo
|
--Router eth0 (WAN) 68.232.RRR.RRR
| eth1 (LAN) 10.0.0.1
|
-----Client eth1 (Virtual) 192.168.0.2
eth0 (Real) 10.0.0.2
samba vpn remote
add a comment |
I get 3 IP addresses from my ISP, so after my modem I have a switch with three things. Two are servers, one is a router. All my personal computers are behind the router. My old server used to have two ethernet ports, so I would put one on the switch and one on the router so that I could keep server traffic off the router and still be able to have samba shares for media.
My new lower-power server only has one LAN. I will eventually get a USB ethernet plug for it, but until then I'd like to still have my samba shares. I thought to myself, there must be some way to achieve this via VPN.
So what I'd like to do is this, set up a VPN server on the server, allow clients behind the router to connect to it. That seemed simple enough, except that all the guides I've seen assume you can allocate addresses on the server's LAN. Since my server's LAN is the public internet I can't really do that. Is there any way I can make up some 'imaginary' LAN that exists only in the mind of the server and put my VPN clients on that?
To clarify, if the server is 68.232.SSS.SSS and if the router is 68.232.RRR.RRR and if computers behind the router are 10.0.0.1-255 then can I make VPN clients use addresses like 192.168.0.VPN?
OOoOoOOOooOOo
OoO Public OoOOo-----Server eth0 (Real) 68.232.SSS.SSS
OoO Internet OoO eth1 (Virtual) 192.168.0.1
OoOoOOoOOoOOOo
|
--Router eth0 (WAN) 68.232.RRR.RRR
| eth1 (LAN) 10.0.0.1
|
-----Client eth1 (Virtual) 192.168.0.2
eth0 (Real) 10.0.0.2
samba vpn remote
I get 3 IP addresses from my ISP, so after my modem I have a switch with three things. Two are servers, one is a router. All my personal computers are behind the router. My old server used to have two ethernet ports, so I would put one on the switch and one on the router so that I could keep server traffic off the router and still be able to have samba shares for media.
My new lower-power server only has one LAN. I will eventually get a USB ethernet plug for it, but until then I'd like to still have my samba shares. I thought to myself, there must be some way to achieve this via VPN.
So what I'd like to do is this, set up a VPN server on the server, allow clients behind the router to connect to it. That seemed simple enough, except that all the guides I've seen assume you can allocate addresses on the server's LAN. Since my server's LAN is the public internet I can't really do that. Is there any way I can make up some 'imaginary' LAN that exists only in the mind of the server and put my VPN clients on that?
To clarify, if the server is 68.232.SSS.SSS and if the router is 68.232.RRR.RRR and if computers behind the router are 10.0.0.1-255 then can I make VPN clients use addresses like 192.168.0.VPN?
OOoOoOOOooOOo
OoO Public OoOOo-----Server eth0 (Real) 68.232.SSS.SSS
OoO Internet OoO eth1 (Virtual) 192.168.0.1
OoOoOOoOOoOOOo
|
--Router eth0 (WAN) 68.232.RRR.RRR
| eth1 (LAN) 10.0.0.1
|
-----Client eth1 (Virtual) 192.168.0.2
eth0 (Real) 10.0.0.2
samba vpn remote
samba vpn remote
asked Feb 16 '12 at 18:27
HuckleHuckle
5,99242139
5,99242139
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
- install openvpn on your server and your client
generate the certificates as in the official HOWTO:
root@server:/etc/openvpn/easy-rsa# cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa
root@server:/etc/openvpn/easy-rsa# cd /etc/openvpn/easy-rsa
Edit /etc/openvpn/easy-rsa/vars and fill in the appropiate values
root@server:/etc/openvpn/easy-rsa# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
root@server:/etc/openvpn/easy-rsa# ./clean-all
root@server:/etc/openvpn/easy-rsa# ./build-ca
Generating a 1024 bit RSA private key
......................++++++
........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [OpenVPN-CA]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
root@server:/etc/openvpn/easy-rsa# ./build-key-server server
Generating a 1024 bit RSA private key
...............++++++
..........++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [server]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'server'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:18:09 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-key client
Generating a 1024 bit RSA private key
..........++++++
...................................................++++++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [client]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'client'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:20:00 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................................................................+..................+...........+...........................+..............+..............................................................+......................................................................................................+......................................................................................+..............................................................................+..................+.................+..................................................................+.........................................+...........+..........................................................................................+..............................................+....................................+...................+....+..+................+.+.........+..............................................................+....................................................................................................................+...........+.....................................................................................................................................+.........................................................+...........................................................+.......................................................................................................................................................................................................................................+..............+..............................................................................................................................................+............................+..........................................+....................................................................................................................................++*++*++*
copy the needed files from /etc/openvpn/easy-rsa/keys on the server to /etc/openvpn
for server: ca.crt dh1024.pem server.crt server.key
for client: ca.crt client.crt client.key
copy the appropriate sample configuration files from /usr/share/doc/openvpn/examples/sample-config-files/ to /etc/openvpn and decompress them
server: server.conf.gz
client: client.conf
- The server configuration file should be workable by default
edit the "remote" entry on the client /etc/openvpn/client.conf
Input the server name / IP-address. No other changes needs to be done
- Open up UDP 1194 on the server's firewall
The service is ready to start now, the server is at 10.8.0.1
I assume you only need to access the server, additional work need to be done if you want to access other internal networks.
configure samba to listen on 10.8.0.0/24
Everything should have been done, leave comment here if something goes wrong.
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
add a comment |
Install openvpn on the server and the clients. On the server this will bring up a tun0 tunnel interface with an IP subnet of your choosing. The relevant options in the configuration file /etc/openvpn/server.conf are:
dev tun
server 192.168.1.0 255.255.255.0
Unless you want the clients to route all their traffic through the VPN, comment out any lines looking like push "route A.B.C.D W.X.Y.Z" from the configuration.
In addition to the network configuration, you have to generate certificates for the server and for the clients (both sides authenticate). How to do that is covered in OpenVPN documentation.
Finally, you have to configure the clients to be able to use this connection, so you put in their /etc/openvpn/client.conf:
remote 68.232.SSS.SSS 1194
The 1194/udp is OpenVPN standard port, which needs to be open to the world in your firewall (hence the need for certificates).
I hope this answer and the documentation and sample configuration from openvpn will get you started.
add a comment |
While not a direct answer to your question, I suggest you consider mounting your server using sshfs instead. All you need is a running ssh server, instead of a complex combination of samba and a bolted-on vpn solution.
On the client, have a look at How to auto mount using sshfs? for a GUI solution or http://ubuntuforums.org/showthread.php?t=430312 for a system-wide fstab solution.
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f104834%2fset-up-a-vpn-route-samba-over-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
- install openvpn on your server and your client
generate the certificates as in the official HOWTO:
root@server:/etc/openvpn/easy-rsa# cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa
root@server:/etc/openvpn/easy-rsa# cd /etc/openvpn/easy-rsa
Edit /etc/openvpn/easy-rsa/vars and fill in the appropiate values
root@server:/etc/openvpn/easy-rsa# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
root@server:/etc/openvpn/easy-rsa# ./clean-all
root@server:/etc/openvpn/easy-rsa# ./build-ca
Generating a 1024 bit RSA private key
......................++++++
........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [OpenVPN-CA]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
root@server:/etc/openvpn/easy-rsa# ./build-key-server server
Generating a 1024 bit RSA private key
...............++++++
..........++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [server]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'server'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:18:09 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-key client
Generating a 1024 bit RSA private key
..........++++++
...................................................++++++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [client]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'client'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:20:00 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................................................................+..................+...........+...........................+..............+..............................................................+......................................................................................................+......................................................................................+..............................................................................+..................+.................+..................................................................+.........................................+...........+..........................................................................................+..............................................+....................................+...................+....+..+................+.+.........+..............................................................+....................................................................................................................+...........+.....................................................................................................................................+.........................................................+...........................................................+.......................................................................................................................................................................................................................................+..............+..............................................................................................................................................+............................+..........................................+....................................................................................................................................++*++*++*
copy the needed files from /etc/openvpn/easy-rsa/keys on the server to /etc/openvpn
for server: ca.crt dh1024.pem server.crt server.key
for client: ca.crt client.crt client.key
copy the appropriate sample configuration files from /usr/share/doc/openvpn/examples/sample-config-files/ to /etc/openvpn and decompress them
server: server.conf.gz
client: client.conf
- The server configuration file should be workable by default
edit the "remote" entry on the client /etc/openvpn/client.conf
Input the server name / IP-address. No other changes needs to be done
- Open up UDP 1194 on the server's firewall
The service is ready to start now, the server is at 10.8.0.1
I assume you only need to access the server, additional work need to be done if you want to access other internal networks.
configure samba to listen on 10.8.0.0/24
Everything should have been done, leave comment here if something goes wrong.
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
add a comment |
- install openvpn on your server and your client
generate the certificates as in the official HOWTO:
root@server:/etc/openvpn/easy-rsa# cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa
root@server:/etc/openvpn/easy-rsa# cd /etc/openvpn/easy-rsa
Edit /etc/openvpn/easy-rsa/vars and fill in the appropiate values
root@server:/etc/openvpn/easy-rsa# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
root@server:/etc/openvpn/easy-rsa# ./clean-all
root@server:/etc/openvpn/easy-rsa# ./build-ca
Generating a 1024 bit RSA private key
......................++++++
........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [OpenVPN-CA]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
root@server:/etc/openvpn/easy-rsa# ./build-key-server server
Generating a 1024 bit RSA private key
...............++++++
..........++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [server]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'server'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:18:09 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-key client
Generating a 1024 bit RSA private key
..........++++++
...................................................++++++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [client]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'client'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:20:00 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................................................................+..................+...........+...........................+..............+..............................................................+......................................................................................................+......................................................................................+..............................................................................+..................+.................+..................................................................+.........................................+...........+..........................................................................................+..............................................+....................................+...................+....+..+................+.+.........+..............................................................+....................................................................................................................+...........+.....................................................................................................................................+.........................................................+...........................................................+.......................................................................................................................................................................................................................................+..............+..............................................................................................................................................+............................+..........................................+....................................................................................................................................++*++*++*
copy the needed files from /etc/openvpn/easy-rsa/keys on the server to /etc/openvpn
for server: ca.crt dh1024.pem server.crt server.key
for client: ca.crt client.crt client.key
copy the appropriate sample configuration files from /usr/share/doc/openvpn/examples/sample-config-files/ to /etc/openvpn and decompress them
server: server.conf.gz
client: client.conf
- The server configuration file should be workable by default
edit the "remote" entry on the client /etc/openvpn/client.conf
Input the server name / IP-address. No other changes needs to be done
- Open up UDP 1194 on the server's firewall
The service is ready to start now, the server is at 10.8.0.1
I assume you only need to access the server, additional work need to be done if you want to access other internal networks.
configure samba to listen on 10.8.0.0/24
Everything should have been done, leave comment here if something goes wrong.
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
add a comment |
- install openvpn on your server and your client
generate the certificates as in the official HOWTO:
root@server:/etc/openvpn/easy-rsa# cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa
root@server:/etc/openvpn/easy-rsa# cd /etc/openvpn/easy-rsa
Edit /etc/openvpn/easy-rsa/vars and fill in the appropiate values
root@server:/etc/openvpn/easy-rsa# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
root@server:/etc/openvpn/easy-rsa# ./clean-all
root@server:/etc/openvpn/easy-rsa# ./build-ca
Generating a 1024 bit RSA private key
......................++++++
........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [OpenVPN-CA]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
root@server:/etc/openvpn/easy-rsa# ./build-key-server server
Generating a 1024 bit RSA private key
...............++++++
..........++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [server]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'server'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:18:09 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-key client
Generating a 1024 bit RSA private key
..........++++++
...................................................++++++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [client]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'client'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:20:00 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................................................................+..................+...........+...........................+..............+..............................................................+......................................................................................................+......................................................................................+..............................................................................+..................+.................+..................................................................+.........................................+...........+..........................................................................................+..............................................+....................................+...................+....+..+................+.+.........+..............................................................+....................................................................................................................+...........+.....................................................................................................................................+.........................................................+...........................................................+.......................................................................................................................................................................................................................................+..............+..............................................................................................................................................+............................+..........................................+....................................................................................................................................++*++*++*
copy the needed files from /etc/openvpn/easy-rsa/keys on the server to /etc/openvpn
for server: ca.crt dh1024.pem server.crt server.key
for client: ca.crt client.crt client.key
copy the appropriate sample configuration files from /usr/share/doc/openvpn/examples/sample-config-files/ to /etc/openvpn and decompress them
server: server.conf.gz
client: client.conf
- The server configuration file should be workable by default
edit the "remote" entry on the client /etc/openvpn/client.conf
Input the server name / IP-address. No other changes needs to be done
- Open up UDP 1194 on the server's firewall
The service is ready to start now, the server is at 10.8.0.1
I assume you only need to access the server, additional work need to be done if you want to access other internal networks.
configure samba to listen on 10.8.0.0/24
Everything should have been done, leave comment here if something goes wrong.
- install openvpn on your server and your client
generate the certificates as in the official HOWTO:
root@server:/etc/openvpn/easy-rsa# cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa
root@server:/etc/openvpn/easy-rsa# cd /etc/openvpn/easy-rsa
Edit /etc/openvpn/easy-rsa/vars and fill in the appropiate values
root@server:/etc/openvpn/easy-rsa# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
root@server:/etc/openvpn/easy-rsa# ./clean-all
root@server:/etc/openvpn/easy-rsa# ./build-ca
Generating a 1024 bit RSA private key
......................++++++
........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [OpenVPN-CA]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
root@server:/etc/openvpn/easy-rsa# ./build-key-server server
Generating a 1024 bit RSA private key
...............++++++
..........++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [server]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'server'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:18:09 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-key client
Generating a 1024 bit RSA private key
..........++++++
...................................................++++++
writing new private key to 'client.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [HK]:
State or Province Name (full name) [New Territories]:
Locality Name (eg, city) [Tuen Mun]:
Organization Name (eg, company) [Home]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [client]:
Name [OpenVPN-CA]:
Email Address [test@example.com]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :
An optional company name :
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'HK'
stateOrProvinceName :PRINTABLE:'New Territories'
localityName :PRINTABLE:'Tuen Mun'
organizationName :PRINTABLE:'Home'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'client'
name :PRINTABLE:'OpenVPN-CA'
emailAddress :IA5STRING:'test@example.com'
Certificate is to be certified until Mar 18 13:20:00 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@server:/etc/openvpn/easy-rsa# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................................................................+..................+...........+...........................+..............+..............................................................+......................................................................................................+......................................................................................+..............................................................................+..................+.................+..................................................................+.........................................+...........+..........................................................................................+..............................................+....................................+...................+....+..+................+.+.........+..............................................................+....................................................................................................................+...........+.....................................................................................................................................+.........................................................+...........................................................+.......................................................................................................................................................................................................................................+..............+..............................................................................................................................................+............................+..........................................+....................................................................................................................................++*++*++*
copy the needed files from /etc/openvpn/easy-rsa/keys on the server to /etc/openvpn
for server: ca.crt dh1024.pem server.crt server.key
for client: ca.crt client.crt client.key
copy the appropriate sample configuration files from /usr/share/doc/openvpn/examples/sample-config-files/ to /etc/openvpn and decompress them
server: server.conf.gz
client: client.conf
- The server configuration file should be workable by default
edit the "remote" entry on the client /etc/openvpn/client.conf
Input the server name / IP-address. No other changes needs to be done
- Open up UDP 1194 on the server's firewall
The service is ready to start now, the server is at 10.8.0.1
I assume you only need to access the server, additional work need to be done if you want to access other internal networks.
configure samba to listen on 10.8.0.0/24
Everything should have been done, leave comment here if something goes wrong.
edited Mar 21 '12 at 12:53
answered Mar 20 '12 at 13:39
Michael TsangMichael Tsang
28116
28116
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
add a comment |
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
Exactly what I needed. Thanks. I'll look into the specific directives later and try to figure out what they all mean. For now I need to sleep.
– Huckle
Mar 21 '12 at 4:21
add a comment |
Install openvpn on the server and the clients. On the server this will bring up a tun0 tunnel interface with an IP subnet of your choosing. The relevant options in the configuration file /etc/openvpn/server.conf are:
dev tun
server 192.168.1.0 255.255.255.0
Unless you want the clients to route all their traffic through the VPN, comment out any lines looking like push "route A.B.C.D W.X.Y.Z" from the configuration.
In addition to the network configuration, you have to generate certificates for the server and for the clients (both sides authenticate). How to do that is covered in OpenVPN documentation.
Finally, you have to configure the clients to be able to use this connection, so you put in their /etc/openvpn/client.conf:
remote 68.232.SSS.SSS 1194
The 1194/udp is OpenVPN standard port, which needs to be open to the world in your firewall (hence the need for certificates).
I hope this answer and the documentation and sample configuration from openvpn will get you started.
add a comment |
Install openvpn on the server and the clients. On the server this will bring up a tun0 tunnel interface with an IP subnet of your choosing. The relevant options in the configuration file /etc/openvpn/server.conf are:
dev tun
server 192.168.1.0 255.255.255.0
Unless you want the clients to route all their traffic through the VPN, comment out any lines looking like push "route A.B.C.D W.X.Y.Z" from the configuration.
In addition to the network configuration, you have to generate certificates for the server and for the clients (both sides authenticate). How to do that is covered in OpenVPN documentation.
Finally, you have to configure the clients to be able to use this connection, so you put in their /etc/openvpn/client.conf:
remote 68.232.SSS.SSS 1194
The 1194/udp is OpenVPN standard port, which needs to be open to the world in your firewall (hence the need for certificates).
I hope this answer and the documentation and sample configuration from openvpn will get you started.
add a comment |
Install openvpn on the server and the clients. On the server this will bring up a tun0 tunnel interface with an IP subnet of your choosing. The relevant options in the configuration file /etc/openvpn/server.conf are:
dev tun
server 192.168.1.0 255.255.255.0
Unless you want the clients to route all their traffic through the VPN, comment out any lines looking like push "route A.B.C.D W.X.Y.Z" from the configuration.
In addition to the network configuration, you have to generate certificates for the server and for the clients (both sides authenticate). How to do that is covered in OpenVPN documentation.
Finally, you have to configure the clients to be able to use this connection, so you put in their /etc/openvpn/client.conf:
remote 68.232.SSS.SSS 1194
The 1194/udp is OpenVPN standard port, which needs to be open to the world in your firewall (hence the need for certificates).
I hope this answer and the documentation and sample configuration from openvpn will get you started.
Install openvpn on the server and the clients. On the server this will bring up a tun0 tunnel interface with an IP subnet of your choosing. The relevant options in the configuration file /etc/openvpn/server.conf are:
dev tun
server 192.168.1.0 255.255.255.0
Unless you want the clients to route all their traffic through the VPN, comment out any lines looking like push "route A.B.C.D W.X.Y.Z" from the configuration.
In addition to the network configuration, you have to generate certificates for the server and for the clients (both sides authenticate). How to do that is covered in OpenVPN documentation.
Finally, you have to configure the clients to be able to use this connection, so you put in their /etc/openvpn/client.conf:
remote 68.232.SSS.SSS 1194
The 1194/udp is OpenVPN standard port, which needs to be open to the world in your firewall (hence the need for certificates).
I hope this answer and the documentation and sample configuration from openvpn will get you started.
answered Mar 20 '12 at 8:03
tanelitaneli
2,4991332
2,4991332
add a comment |
add a comment |
While not a direct answer to your question, I suggest you consider mounting your server using sshfs instead. All you need is a running ssh server, instead of a complex combination of samba and a bolted-on vpn solution.
On the client, have a look at How to auto mount using sshfs? for a GUI solution or http://ubuntuforums.org/showthread.php?t=430312 for a system-wide fstab solution.
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
add a comment |
While not a direct answer to your question, I suggest you consider mounting your server using sshfs instead. All you need is a running ssh server, instead of a complex combination of samba and a bolted-on vpn solution.
On the client, have a look at How to auto mount using sshfs? for a GUI solution or http://ubuntuforums.org/showthread.php?t=430312 for a system-wide fstab solution.
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
add a comment |
While not a direct answer to your question, I suggest you consider mounting your server using sshfs instead. All you need is a running ssh server, instead of a complex combination of samba and a bolted-on vpn solution.
On the client, have a look at How to auto mount using sshfs? for a GUI solution or http://ubuntuforums.org/showthread.php?t=430312 for a system-wide fstab solution.
While not a direct answer to your question, I suggest you consider mounting your server using sshfs instead. All you need is a running ssh server, instead of a complex combination of samba and a bolted-on vpn solution.
On the client, have a look at How to auto mount using sshfs? for a GUI solution or http://ubuntuforums.org/showthread.php?t=430312 for a system-wide fstab solution.
edited Apr 13 '17 at 12:23
Community♦
1
1
answered Mar 20 '12 at 9:11
EgilEgil
10.9k23546
10.9k23546
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
add a comment |
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
That would work if I was using *nix based clients, but although the server is *nix based - the clients are of various OSes (Win, Mac, *nix)
– Huckle
Mar 21 '12 at 3:12
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f104834%2fset-up-a-vpn-route-samba-over-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown