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

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

13282

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: 3.8 (6 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back
Please read "Why adblockers are bad".



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
2012-05-18
alot - 0.3.1
Ebuild name:

mail-client/alot-0.3.1

Description

Experimental terminal UI for net-mail/notmuch written in Python

Added to portage

2012-05-18

babl - 9999
Ebuild name:

media-libs/babl-9999

Description

A dynamic, any to any, pixel format conversion library

Added to portage

2012-05-18

genkernel - 3.4.33.1
Ebuild name:

sys-kernel/genkernel-3.4.33.1

Description

Gentoo automatic kernel building scripts

Added to portage

2012-05-18

mDNSResponder - 320.10.80
Ebuild name:

net-misc/mDNSResponder-320.10.80

Description

A component of Bonjour, Apple's initiative for zero-configuration

Added to portage

2012-05-18

opera-next - 12.00.1417
Ebuild name:

www-client/opera-next-12.00.1417

Description

A fast and secure web browser and Internet suite

Added to portage

2012-05-18

python-ldap - 2.4.9
Ebuild name:

dev-python/python-ldap-2.4.9

Description

Various LDAP-related Python modules

Added to portage

2012-05-18

sudo - 1.8.5-r1
Ebuild name:

app-admin/sudo-1.8.5-r1

Description

Allows users or groups to run commands as other users

Added to portage

2012-05-18

udev - 171-r6
Ebuild name:

sys-fs/udev-171-r6

Description

Linux dynamic and persistent device naming support (aka userspace devfs)

Added to portage

2012-05-18

2012-05-17
ETL - 0.04.15
Ebuild name:

dev-cpp/ETL-0.04.15

Description

ETL is a multi-platform class and template library

Added to portage

2012-05-17

Mail-Box - 2.105.0
Ebuild name:

dev-perl/Mail-Box-2.105.0

Description

Mail folder manager and MUA backend

Added to portage

2012-05-17

Object-Realize-Later - 0.180.0
Ebuild name:

dev-perl/Object-Realize-Later-0.180.0

Description

Delay construction of real data until used

Added to portage

2012-05-17

User-Identity - 0.930.0
Ebuild name:

dev-perl/User-Identity-0.930.0

Description

Maintains info about a physical person

Added to portage

2012-05-17

amanda - 3.3.1
Ebuild name:

app-backup/amanda-3.3.1

Description

The Advanced Maryland Automatic Network Disk Archiver

Added to portage

2012-05-17

c++-gtk-utils - 2.0.7
Ebuild name:

x11-libs/c++-gtk-utils-2.0.7

Description

A library containing a number of classes and functions for programming

Added to portage

2012-05-17

chromium - 19.0.1084.46-r1
Ebuild name:

www-client/chromium-19.0.1084.46-r1

Description

Open-source version of Google Chrome web browser

Added to portage

2012-05-17

coq - 8.3_p4
Ebuild name:

sci-mathematics/coq-8.3_p4

Description

Coq is a proof assistant written in O'Caml

Added to portage

2012-05-17

debhelper - 9.20120513
Ebuild name:

dev-util/debhelper-9.20120513

Description

Collection of programs that can be used to automate common tasks in d

Added to portage

2012-05-17

emacs-vcs - 24.0.97
Ebuild name:

app-editors/emacs-vcs-24.0.97

Description

The extensible, customizable, self-documenting real-time display edit

Added to portage

2012-05-17

ffmpeg - 0.10.3
Ebuild name:

virtual/ffmpeg-0.10.3

Description

Virtual package for FFmpeg implementation

Added to portage

2012-05-17

gentoolkit - 0.3.0.6-r2
Ebuild name:

app-portage/gentoolkit-0.3.0.6-r2

Description

Collection of administration scripts for Gentoo

Added to portage

2012-05-17

gimps - 27.7-r1
Ebuild name:

sci-mathematics/gimps-27.7-r1

Description

The Great Internet Mersenne Prime Search

Added to portage

2012-05-17

gunicorn - 0.14.3
Ebuild name:

www-servers/gunicorn-0.14.3

Description

A WSGI HTTP Server for UNIX

Added to portage

2012-05-17

gxmessage - 2.20.0
Ebuild name:

x11-misc/gxmessage-2.20.0

Description

A GTK+ based xmessage clone

Added to portage

2012-05-17

libGLw - 1.0.0
Ebuild name:

x11-libs/libGLw-1.0.0

Description

Mesa GLw library

Added to portage

2012-05-17

libmp3splt - 0.7.2
Ebuild name:

media-libs/libmp3splt-0.7.2

Description

a library for mp3splt to split mp3 and ogg files without decoding.

Added to portage

2012-05-17

mari0 - 1.6
Ebuild name:

games-arcade/mari0-1.6

Description

A mix from Nintendo's Super Mario Bros and Valve's Portal

Added to portage

2012-05-17

mp3splt - 2.4.2
Ebuild name:

media-sound/mp3splt-2.4.2

Description

a command line utility to split mp3 and ogg files without decoding.

Added to portage

2012-05-17

mp3splt-gtk - 0.7.2
Ebuild name:

media-sound/mp3splt-gtk-0.7.2

Description

a GTK+ based utility to split mp3 and ogg files without decoding.

Added to portage

2012-05-17

msp430-binutils - 2.21.1_p20120406
Ebuild name:

dev-embedded/msp430-binutils-2.21.1_p20120406

Description

Tools necessary to build programs for MSP430 microcon

Added to portage

2012-05-17

msp430-binutils - 2.22_p20120514
Ebuild name:

dev-embedded/msp430-binutils-2.22_p20120514

Description

Tools necessary to build programs for MSP430 microcontr

Added to portage

2012-05-17

msp430-libc - 20120514
Ebuild name:

dev-embedded/msp430-libc-20120514

Description

C library for MSP430 microcontrollers

Added to portage

2012-05-17

msp430mcu - 20120514
Ebuild name:

dev-embedded/msp430mcu-20120514

Description

MCU-specific data for MSP430 microcontrollers

Added to portage

2012-05-17

multi_json - 1.3.5
Ebuild name:

dev-ruby/multi_json-1.3.5

Description

A gem to provide swappable JSON backends

Added to portage

2012-05-17

multi_xml - 0.5.1
Ebuild name:

dev-ruby/multi_xml-0.5.1

Description

A generic swappable back-end for XML parsing

Added to portage

2012-05-17

mysql-workbench - 5.2.40
Ebuild name:

dev-db/mysql-workbench-5.2.40

Description

MySQL Workbench

Added to portage

2012-05-17

nfs-utils - 1.2.6
Ebuild name:

net-fs/nfs-utils-1.2.6

Description

NFS client and server daemons

Added to portage

2012-05-17

notmuch - 0.13
Ebuild name:

net-mail/notmuch-0.13

Description

Thread-based e-mail indexer, supporting quick search and tagging

Added to portage

2012-05-17

opensonic - 0.1.4-r1
Ebuild name:

games-arcade/opensonic-0.1.4-r1

Description

A free open-source game based on the Sonic the Hedgehog universe

Added to portage

2012-05-17

pidgin-otr - 3.2.1
Ebuild name:

x11-plugins/pidgin-otr-3.2.1

Description

(OTR) Messaging allows you to have private conversations over instant

Added to portage

2012-05-17

polarssl - 1.1.3
Ebuild name:

net-libs/polarssl-1.1.3

Description

Cryptographic library for embedded systems

Added to portage

2012-05-17

portage - 2.1.10.62
Ebuild name:

sys-apps/portage-2.1.10.62

Description

Portage is the package management and distribution system for Gentoo

Added to portage

2012-05-17

portage - 2.2.0_alpha107
Ebuild name:

sys-apps/portage-2.2.0_alpha107

Description

Portage is the package management and distribution system for Gento

Added to portage

2012-05-17

pymountboot - 0.2
Ebuild name:

dev-python/pymountboot-0.2

Description

Python extension module to (re)mount /boot

Added to portage

2012-05-17

rpm2targz - 9.0.0.5g
Ebuild name:

app-arch/rpm2targz-9.0.0.5g

Description

Convert a .rpm file to a .tar.gz archive

Added to portage

2012-05-17

sysstat - 10.0.5
Ebuild name:

app-admin/sysstat-10.0.5

Description

System performance tools for Linux

Added to portage

2012-05-17

transmission-remote-gtk - 1.0.1
Ebuild name:

net-p2p/transmission-remote-gtk-1.0.1

Description

GTK client for management of the Transmission BitTorrent clie

Added to portage

2012-05-17

unrar - 4.2.2
Ebuild name:

app-arch/unrar-4.2.2

Description

Uncompress rar files

Added to portage

2012-05-17

v8 - 3.10.8.5
Ebuild name:

dev-lang/v8-3.10.8.5

Description

Google's open source JavaScript engine

Added to portage

2012-05-17

wicd - 1.7.2.4
Ebuild name:

net-misc/wicd-1.7.2.4

Description

A lightweight wired and wireless network manager for Linux

Added to portage

2012-05-17

xf86-video-openchrome - 0.2.906
Ebuild name:

x11-drivers/xf86-video-openchrome-0.2.906

Description

X.Org driver for VIA/S3G cards

Added to portage

2012-05-17

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: 17.6 ms
system status display
Stellenangebote
Ärger mit Freenet.de