| :: Setting up VPN using LinVPN :: | |||
| HOME |
-------------------------------------
PPP-Client PPP-Server
-------------------------------------
lock X X
noauth X X
debug X
dump X
logfd 2 X
updetach X
noccp X X **
novj X X **
novjccomp X X **
nopcomp X X **
noaccomp X X **
**comment out the option if you want compression enabled in PPP.
~linvpn#>tar -xvzf LinVPN-version.tar.gz ~linvpn#>cd LinVPN-version ~linvpn#>mkdir /home/linvpn/etc; mkdir /home/linvpn/sbin ~linvpn#>./configure --prefix=/home/linvpn --config=/home/linvpn/etc ~linvpn#>make; make install
shashank@zidler:/home/linvpn/sbin# ls | more vpn-wrapper #wrapper program to execute certain commands like route, similar to sudo vpnd #Program to be run by the server vpncd #program to be run by the client vpndel #NOT REQUIRED. Same functionality availavle in vpncd and vpnd. vpnadd #Used to create a self-signed certificate. I Do not use this method.You can also get good explanation of setting up a linux-to-linux vpn by reading the How-To that comes with tarball, and this recipe will serve as a good supplement.

linvpn@zidler:/home/linvpn/sbin# ./vpnadd server testVPN 192.168.254.201:192.168.254.200 1024 Using configuration from /usr/share/ssl/openssl.cnf Generating a 1024 bit RSA private key ..++++++ ..........................................++++++ writing new private key to 'key.pem' ----- 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) [US]: State or Province Name (full name) [Illinois]: Locality Name (eg, city) [Chicago]: Organization Name (eg, company) [UIC]: Organizational Unit Name (eg, section) [ECE]: Common Name (eg, your name or your server's hostname) []:linvpn Email Address []:linvpn@zidler.ece.uic.edu Adding VPN testVPN on server: done!At the end, you will get a cert.pem file, in /home/linvpn/sbin that you can send to the peer.
linvpn@zidler:/home/linvpn/sbin# cat key.pem -----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQCXX7qha8ZZRK1XzObWodf8m8SbmNLN0vKb6P7vPk81iTASV9Ok VlsBRVVEYsugRoM9iekCQGk9lqJ1DVvw3slJXrD//COqO/pmLDIoyf4cBDwg18FG wTnlVxGxO/iQ9vB/c/nNVJVIETqyQirg+ltx70XEfyo= --SNIP-- -----END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIDJzCCAg+gAwIBAgIBDzANBgkqhkiG9w0BAQQFADCBqzE9MDsGA1UEAxM0Q2Vy dGlmaWNhdGUgQXV0aG9yaXR5IENyZWF0ZWQgYnkgU2hhc2hhbmsgS2hhbnZpbGth cjERMA8GA1UECBMISWxsaW5vaXMxCzAJBgNVBAYTAlVTMSMwIQYJKoZIhvcNAQkB FhRzaGFzaGFua0BldmwudWljLmVkdTElMCMGA1UEChMcUm9vdCBDZXJ0aWZpY2F0 Bcn3QAUVbzbTkRT06UH23Uc3Q/gQAfabSFPmKUznN7muoyBCfDPDEOXSWw== --SNIP-- -----END CERTIFICATE-----NOTE: The blank line between the certificate and the private key.
1. linvpn@zidler:/home/linvpn/sbin# ./vpnd daemon
-------------------------------------------------------------------------------
2. linvpn@zidler:/home/linvpn/sbin# ./vpnd --help
usage: ./vpnd [command [option(s)]]
Avaliable commands:
insert vpn_name local:remote : Insert a new entry
remove vpn_name : Remove an existing entry
fetch vpn_name : Fetch an existing entry
change vpn_name local:remote : Change an existing entry
list : Show all entries
stats : Show connected clients
disconnect vpn_name : Disconnect a client
event vpn_name [conn|disco] : Edit VPN events
setkey vpn_name keyfile.pem : Set RSA private key
dumpkey vpn_name : Dump key to stdout
daemon : Run daemon
--version : Show version
--help : This help
-------------------------------------------------------------------------------
3. linvpn@zidler:/home/linvpn/sbin# ./vpnd insert testVPN 192.168.254.201:192.168.254.200
Entry testVPN has been added successfully!
-------------------------------------------------------------------------------
4. linvpn@zidler:/home/linvpn/sbin# ./vpnd setkey testVPN key.pem
Keyfile of testVPN has been saved successfully!
-------------------------------------------------------------------------------
5. linvpn@zidler:/home/linvpn/sbin# ./vpnd dumpkey testVPN
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCXX7qha8ZZRK1XzObWodf8m8SbmNLN0vKb6P7vPk81iTASV9Ok
gF4v9OZBADj2wKeuE7Ex5j8+LzfN2Lch/P2ntQMZy/te6i+0YPSVTLOF57nswdn1
--SNIP--
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDJzCCAg+gAwIBAgIBDzANBgkqhkiG9w0BAQQFADCBqzE9MDsGA1UEAxM0Q2Vy
dGlmaWNhdGUgQXV0aG9yaXR5IENyZWF0ZWQgYnkgU2hhc2hhbmsgS2hhbnZpbGth
cjERMA8GA1UECBMISWxsaW5vaXMxCzAJBgNVBAYTAlVTMSMwIQYJKoZIhvcNAQkB
--SNIP--
-----END CERTIFICATE-----
-------------------------------------------------------------------------------
6. linvpn@zidler:/home/linvpn/sbin# setenv EDITOR pico
7. linvpn@zidler:/home/linvpn/sbin# ./vpnd event testVPN conn
8. linvpn@zidler:/home/linvpn/sbin# ./vpnd event testVPN disco
-------------------------------------------------------------------------------
The last two commands (7, 8) will open up the editor and you can add appropriate routing commands to it.
For example, I added the following commands (though this did not work for me):
+/sbin/route add -net 192.168.0.0 netmask 255.255.255.0 dev $i
1. linvpn@mia:/home/linvpn/sbin# ./vpncd --help
usage: ./vpncd command [option(s)]
Avaliable commands:
insert vpn_name remote_host : Insert a new entry
remove vpn_name : Remove an existing entry
fetch vpn_name : Fetch an existing entry
change vpn_name remote_host : Change an existing entry
list : Show all entries
connect vpn_name [retry=#] : Make your VPN connection
event vpn_name [conn|disco] : Edit VPN events
setcert vpn_name cert.pem : Set a Certificate
--version : Show version
--help : This help
-------------------------------------------------------------------------------
2. linvpn@mia:/home/linvpn/sbin#./vpncd insert testVPN 131.193.50.184
Entry testVPN has been added successfully!
-------------------------------------------------------------------------------
3. linvpn@mia:/home/linvpn/sbin#./vpncd setcert testVPN cert.pem
Keyfile for testVPN has been saved successfully!
-------------------------------------------------------------------------------
4. linvpn@mia:/home/linvpn/sbin# setenv EDITOR pico
5. linvpn@mia:/home/linvpn/sbin# ./vpnd event testVPN conn
6. linvpn@mia:/home/linvpn/sbin# ./vpnd event testVPN disco
-------------------------------------------------------------------------------
7. linvpn@mia:/home/linvpn/sbin# ./vpncd connect testVPN
The two commands (5, 6) will open up the editor and you can add appropriate routing commands to it.
For example, I added the following commands (though this did not work for me):
+/sbin/route add -net 192.168.2.0 netmask 255.255.255.0 dev $i
[shashank@mia sbin]# ifconfig
ppp0 Link encap:Point-to-Point Protocol
inet addr:192.168.254.200 P-t-P:192.168.254.201 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:56 (56.0 b) TX bytes:56 (56.0 b)
shashank@zidler:# route add -net 192.168.0.0 netmask 255.255.255.0 dev ppp0 --------------------------------------------------------------------------- shashank@mia:# route add -net 192.168.2.0 netmask 255.255.255.0 dev ppp0