from small one page howto to huge articles all in one place
 

search text in:







Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

5507

userrating:

no votes yet


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->net-misc->openvpn

OpenVPN primer


There are as many advantages to VPN tunnels as there are different VPN scenarios. One easy implementation is the "OpenVPN via tun-device" solution. An example: you'd like to connect your laptop to your LAN at home so that you can use your mail client without reconfiguring it anytime you switch from home to internet and back. Let's say your mail-server is 192.168.1.10 in your LAN (192.168.1.0/24) at home, and you have got a router/firewall providing access to the Internet. You connect from work or school and want to read mail. OpenVPN can create two virtual devices for you when connecting two computers through an encrypted tunnel. Naturally you then have the possibility of forwarding traffic into the networks behind them, and thus would be "virtually connected" to your LAN behind the firewall. To enable this, either your firewall or a server behind it should run OpenVPN (if you choose a server in your LAN, you'll have to forward the destination port to the OpenVPN server).

Here's what you need to do:
Code Listing 1: Enable the tun module in your kernel: Kernel config - tun module
          [*] Networking support    
Networking options --->
[ ] Amateur Radio support --->
< > IrDA (infrared) subsystem support --->
< > Bluetooth subsystem support --->
[*] Network device support
< > Dummy net driver support
< > Bonding driver support
< > EQL (serial line load balancing) support
Universal TUN/TAP device driver support
// This option must be enabled


Make sure this module exists and can be loaded. Next, install OpenVPN and it dependencies.
Code Listing 2: Install OpenVPN
emerge openvpn

Now on both server and client, create a directory for your configuration:

Code Listing 3: Make directory
mkdir /etc/openvpn    
mkdir /etc/openvpn/myhomelan


Inside that directory, create a shared key for your VPN session and copy that key to the client's directory, /etc/openvpn/myhomelan.

Code Listing 4: Generate shared key
cd /etc/openvpn/myhomelan    
openvpn --genkey --secret myhomelan-key.txt


Now for the tricky part, the routing. It is important that the two tun devices on the client and server use IP addresses from the same subnet. The configuration files shown below list the type of device, the two end-points of the tunnel, the compression method and the UDP-port on which the tunnel is established. Finally privileges are dropped to user and group as listed:

Code Listing 5: Server-side configuration file /etc/openvpn/myhomelan/local.conf
dev tun    
ifconfig 172.16.1.1 172.16.1.20 // IP of the local
// tun device and its peer
secret /etc/openvpn/myhomelan/myhomelan-key.txt
comp-lzo
port 5000
user nobody
group nobody


The client's configuration needs the tunnel's destination address. This is often a dynamic DNS address, sometimes a fixed IP, depending on your ISP. You also need to route to your home LAN (192.168.1.0 in our example). You can call a shell script from the configuration file that accordingly sets a route.

Code Listing 6: Client-side configuration file /etc/openvpn/myhomelan/local.conf
remote    // or your VPN 
// server's external IP if you have a fixed one
dev tun
ifconfig 172.16.1.20 172.16.1.1 // IP of the local tun
// device and its peer
secret /etc/openvpn/myhomelan/myhomelan-key.txt
comp-lzo
port 5000
user nobody
group nobody
up /etc/openvpn/myhomelan/route.sh // sets up the route
//to the network behind the VPN server


The route command would need to set the client's gateway for the network 192.168.1.0 to its peer's address (172.16.1.1 in our setup).

Code Listing 7: /etc/openvpn/myhomelan/route.sh
#!/bin/bash    
route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.16.1.1


That's it. Start OpenVPN on the server and the client, and check the devices with ifconfig and the routes with route -n. Success!

From http://www.gentoo.org/news/en/gwn/20041011-newsletter.xml
rate this article:
current rating: average rating: 2.0 (1 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back
comment this article
Please read "Why adblockers are bad".



to the forum.
:
:
other Ads
Stellenangebote
Stellenangebote
für Fach- und
Führungskräfte
www.nachoben.com
Trace My Cash
Wenn Sie sich schon immer mal gefragt haben, wo eigentlich Ihr geliebtes Bargeld geblieben ist, finden Sie hier vielleicht die Antwort.
www.tracemycash.com
Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
FeedCollector
Combine various newsfeeds to one customized webpage
www.feedcollector.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2009-07-03
blender - 2.49a
Ebuild name:

media-gfx/blender-2.49a

Description

3D Creation/Animation/Publishing System

Added to portage

2009-07-03

btg - 1.0.0
Ebuild name:

net-p2p/btg-1.0.0

Description

A bittorrent client using rb_libtorrent with a daemon/client model

Added to portage

2009-07-03

gcalctool - 5.26.3
Ebuild name:

gnome-extra/gcalctool-5.26.3

Description

A calculator application for GNOME

Added to portage

2009-07-03

geeqie - 1.0_beta2
Ebuild name:

media-gfx/geeqie-1.0_beta2

Description

A lightweight GTK image viewer forked from GQview

Added to portage

2009-07-03

griffith - 0.10_beta3
Ebuild name:

media-video/griffith-0.10_beta3

Description

Movie collection manager

Added to portage

2009-07-03

kanjistrokeorders - 2.012
Ebuild name:

media-fonts/kanjistrokeorders-2.012

Description

font to view stroke order diagrams for Kanji, Kana and etc

Added to portage

2009-07-03

kdenlive - 0.7.5
Ebuild name:

media-video/kdenlive-0.7.5

Description

Kdenlive! (pronounced Kay-den-live) is a Non Linear Video Editing Suite

Added to portage

2009-07-03

libtiger - 0.3.3
Ebuild name:

media-libs/libtiger-0.3.3

Description

A rendering library for Kate streams using Pango and Cairo

Added to portage

2009-07-03

mercurial - 1.3
Ebuild name:

dev-util/mercurial-1.3

Description

Scalable distributed SCM

Added to portage

2009-07-03

nvidia-drivers - 96.43.13
Ebuild name:

x11-drivers/nvidia-drivers-96.43.13

Description

NVIDIA X11 driver and GLX libraries

Added to portage

2009-07-03

openttd - 0.7.1
Ebuild name:

games-simulation/openttd-0.7.1

Description

OpenTTD is a clone of Transport Tycoon Deluxe

Added to portage

2009-07-03

umeplus-fonts - 20090604
Ebuild name:

media-fonts/umeplus-fonts-20090604

Description

UmePlus fonts are modified Ume and M+ fonts for Japanese

Added to portage

2009-07-03

2009-07-02
Devel-StackTrace - 1.21
Ebuild name:

dev-perl/Devel-StackTrace-1.21

Description

Devel-StackTrace module for perl

Added to portage

2009-07-02

Proc-Background - 1.09
Ebuild name:

dev-perl/Proc-Background-1.09

Description

Generic interface to background process management

Added to portage

2009-07-02

acl - 2.2.47-r1
Ebuild name:

sys-apps/acl-2.2.47-r1

Description

Access control list utilities, libraries and headers

Added to portage

2009-07-02

arrayfields - 4.7.4
Ebuild name:

dev-ruby/arrayfields-4.7.4

Description

Allow keyword access to array instances.

Added to portage

2009-07-02

broadcom-sta - 5.10.91.9-r2
Ebuild name:

net-wireless/broadcom-sta-5.10.91.9-r2

Description

Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver.

Added to portage

2009-07-02

bzr - 1.16.1
Ebuild name:

dev-util/bzr-1.16.1

Description

Bazaar is a next generation distributed version control system.

Added to portage

2009-07-02

file-browser-applet - 0.6.4
Ebuild name:

gnome-extra/file-browser-applet-0.6.4

Description

Browse and open files in your home directory from the GNOME p

Added to portage

2009-07-02

filezilla - 3.2.6.1
Ebuild name:

net-ftp/filezilla-3.2.6.1

Description

FTP client with lots of useful features and an intuitive interface

Added to portage

2009-07-02

git-sources - 2.6.31_rc1-r9
Ebuild name:

sys-kernel/git-sources-2.6.31_rc1-r9

Description

The very latest -git version of the Linux kernel

Added to portage

2009-07-02

gtk-engines-qtcurve - 0.65.2
Ebuild name:

x11-themes/gtk-engines-qtcurve-0.65.2

Description

A set of widget styles for GTK2 based apps, also available fo

Added to portage

2009-07-02

mozilla-firefox - 3.5-r2
Ebuild name:

www-client/mozilla-firefox-3.5-r2

Description

Firefox Web Browser

Added to portage

2009-07-02

mutt - 1.5.20-r1
Ebuild name:

mail-client/mutt-1.5.20-r1

Description

a small but very powerful text-based mail client

Added to portage

2009-07-02

nicotine+ - 1.2.12
Ebuild name:

net-p2p/nicotine+-1.2.12

Description

A fork of nicotine, a Soulseek client in Python

Added to portage

2009-07-02

nm-applet - 0.7.1-r3
Ebuild name:

gnome-extra/nm-applet-0.7.1-r3

Description

Gnome applet for NetworkManager.

Added to portage

2009-07-02

nted - 1.6.0-r1
Ebuild name:

media-sound/nted-1.6.0-r1

Description

WYSIWYG score editor for GTK+2

Added to portage

2009-07-02

nted - 1.6.0-r2
Ebuild name:

media-sound/nted-1.6.0-r2

Description

WYSIWYG score editor for GTK+2

Added to portage

2009-07-02

pulseaudio - 0.9.16_rc2-r1
Ebuild name:

media-sound/pulseaudio-0.9.16_rc2-r1

Description

A networked sound server with an advanced plugin system

Added to portage

2009-07-02

pulseaudio - 0.9.16_rc2-r50
Ebuild name:

media-sound/pulseaudio-0.9.16_rc2-r50

Description

A networked sound server with an advanced plugin system

Added to portage

2009-07-02

pywebdav - 0.9.3
Ebuild name:

dev-python/pywebdav-0.9.3

Description

WebDAV server written in python

Added to portage

2009-07-02

qtcurve - 0.65.2
Ebuild name:

x11-themes/qtcurve-0.65.2

Description

Based on the eclass

Added to portage

2009-07-02

qtcurve-qt4 - 0.65.2
Ebuild name:

x11-themes/qtcurve-qt4-0.65.2

Description

A set of widget styles for Qt4 based apps, also available for KDE3 an

Added to portage

2009-07-02

rednotebook - 0.7.5
Ebuild name:

x11-misc/rednotebook-0.7.5

Description

A graphical journal with calendar, templates, tags, keyword searching, a

Added to portage

2009-07-02

toluapp - 1.0.93
Ebuild name:

dev-lang/toluapp-1.0.93

Description

A tool to integrate C/C++ code with Lua.

Added to portage

2009-07-02

wqy-microhei - 0.2.0_beta
Ebuild name:

media-fonts/wqy-microhei-0.2.0_beta

Description

A droid derived Sans-Serif style CJK font

Added to portage

2009-07-02

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004 S&P Softwaredesign
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 21.7 ms
system status display
Stellenangebote
Ärger mit Freenet.de