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:

83515

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


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

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-03-03
install-xattr - 0.13
Ebuild name:

sys-apps/install-xattr-0.13

Description

Wrapper to coreutils install to preserve Filesystem Extended Attributes

Added to portage

2026-03-03

tkimg - 1.4.17
Ebuild name:

dev-tcltk/tkimg-1.4.17

Description

Adds a lot of image formats to Tcl/Tk

Added to portage

2026-03-03

2026-03-02
0ad - 0.28.0-r1
Ebuild name:

games-strategy/0ad-0.28.0-r1

Description

A free, real-time strategy game

Added to portage

2026-03-02

cmd2 - 3.3.0
Ebuild name:

dev-python/cmd2-3.3.0

Description

Extra features for standard library's cmd module

Added to portage

2026-03-02

crispy-bootstrap5 - 2026.3
Ebuild name:

dev-python/crispy-bootstrap5-2026.3

Description

Bootstrap5 template pack for django-crispy-forms

Added to portage

2026-03-02

discord - 0.0.126
Ebuild name:

net-im/discord-0.0.126

Description

All-in-one voice and text chat for gamers

Added to portage

2026-03-02

django-crispy-forms - 2.6
Ebuild name:

dev-python/django-crispy-forms-2.6

Description

DRY Django forms

Added to portage

2026-03-02

filelock - 3.25.0
Ebuild name:

dev-python/filelock-3.25.0

Description

A platform independent file lock for Python

Added to portage

2026-03-02

flint - 3.4.0
Ebuild name:

sci-mathematics/flint-3.4.0

Description

Fast Library for Number Theory

Added to portage

2026-03-02

freepg - 2.5.18
Ebuild name:

app-crypt/freepg-2.5.18

Description

Cross-distro GnuPG fork focused on OpenPGP compliance

Added to portage

2026-03-02

fwbuilder - 6.0.0_rc1_p20230723-r1
Ebuild name:

net-firewall/fwbuilder-6.0.0_rc1_p20230723-r1

Description

Firewall management GUI for iptables, PF, Cisco route

Added to portage

2026-03-02

gcc - 16.0.1_p20260301
Ebuild name:

sys-devel/gcc-16.0.1_p20260301

Description

The GNU Compiler Collection

Added to portage

2026-03-02

gherkin-official - 39.0.0
Ebuild name:

dev-python/gherkin-official-39.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-03-02

git-sources - 7.0_rc2
Ebuild name:

sys-kernel/git-sources-7.0_rc2

Description

The very latest -git version of the Linux kernel

Added to portage

2026-03-02

hamlib - 4.7.0
Ebuild name:

media-libs/hamlib-4.7.0

Description

Ham radio backend rig control libraries

Added to portage

2026-03-02

identify - 2.6.17
Ebuild name:

dev-python/identify-2.6.17

Description

File identification library for Python

Added to portage

2026-03-02

inline-snapshot - 0.32.4
Ebuild name:

dev-python/inline-snapshot-0.32.4

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-03-02

kguiaddons - 6.23.1
Ebuild name:

kde-frameworks/kguiaddons-6.23.1

Description

Framework providing assorted high-level user interface components

Added to portage

2026-03-02

kirigami - 6.23.1
Ebuild name:

kde-frameworks/kirigami-6.23.1

Description

Lightweight user interface framework for mobile and convergent appli

Added to portage

2026-03-02

kirigami-addons - 1.12.0
Ebuild name:

dev-libs/kirigami-addons-1.12.0

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-03-02

kservice - 6.23.1
Ebuild name:

kde-frameworks/kservice-6.23.1

Description

Advanced plugin and service introspection

Added to portage

2026-03-02

libfprint - 1.94.10
Ebuild name:

sys-auth/libfprint-1.94.10

Description

Library to add support for consumer fingerprint readers

Added to portage

2026-03-02

linkify-it-py - 2.1.0
Ebuild name:

dev-python/linkify-it-py-2.1.0

Description

Links recognition library with full unicode support

Added to portage

2026-03-02

mattermost-desktop-bin - 6.1.0
Ebuild name:

net-im/mattermost-desktop-bin-6.1.0

Description

Mattermost Desktop application

Added to portage

2026-03-02

md6sum - 1.0-r3
Ebuild name:

app-crypt/md6sum-1.0-r3

Description

A C implementation of MD6

Added to portage

2026-03-02

mhash - 0.9.9.9-r4
Ebuild name:

app-crypt/mhash-0.9.9.9-r4

Description

Library providing a uniform interface to a large number of hash algorith

Added to portage

2026-03-02

minisign - 0.12
Ebuild name:

app-crypt/minisign-0.12

Description

Dead simple tool to sign files and verify signatures

Added to portage

2026-03-02

mit-krb5 - 1.21.3
Ebuild name:

app-crypt/mit-krb5-1.21.3

Description

MIT Kerberos V

Added to portage

2026-03-02

mit-krb5 - 1.21.3-r1
Ebuild name:

app-crypt/mit-krb5-1.21.3-r1

Description

MIT Kerberos V

Added to portage

2026-03-02

mit-krb5 - 1.22.1
Ebuild name:

app-crypt/mit-krb5-1.22.1

Description

MIT Kerberos V

Added to portage

2026-03-02

mit-krb5 - 1.22.2
Ebuild name:

app-crypt/mit-krb5-1.22.2

Description

MIT Kerberos V

Added to portage

2026-03-02

mit-krb5-appl - 1.0.3-r4
Ebuild name:

app-crypt/mit-krb5-appl-1.0.3-r4

Description

Kerberized applications split from the main MIT Kerberos V distrib

Added to portage

2026-03-02

mit-krb5-appl - 1.0.3-r5
Ebuild name:

app-crypt/mit-krb5-appl-1.0.3-r5

Description

Kerberized applications split from the main MIT Kerberos V distrib

Added to portage

2026-03-02

mkp224o - 1.7.0
Ebuild name:

app-crypt/mkp224o-1.7.0

Description

Vanity address generator for v3 Tor hidden service addresses

Added to portage

2026-03-02

moccur-edit - 2.16
Ebuild name:

app-emacs/moccur-edit-2.16

Description

An improved interface to color-moccur for editing

Added to portage

2026-03-02

mocker - 0.5.0
Ebuild name:

app-emacs/mocker-0.5.0

Description

Simple mocking framework for Emacs

Added to portage

2026-03-02

monkeysphere - 0.44-r2
Ebuild name:

app-crypt/monkeysphere-0.44-r2

Description

Leverage the OpenPGP web of trust for OpenSSH and Web authentication

Added to portage

2026-03-02

moolticute - 1.03.0-r2
Ebuild name:

app-crypt/moolticute-1.03.0-r2

Description

Mooltipass crossplatform daemon/tools

Added to portage

2026-03-02

nose2 - 0.16.0
Ebuild name:

dev-python/nose2-0.16.0

Description

Unittest with plugins

Added to portage

2026-03-02

openapi-spec-validator - 0.8.4
Ebuild name:

dev-python/openapi-spec-validator-0.8.4

Description

OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 spec validator

Added to portage

2026-03-02

peewee - 4.0.1
Ebuild name:

dev-python/peewee-4.0.1

Description

Small Python ORM

Added to portage

2026-03-02

postfix - 3.11.0_rc4
Ebuild name:

mail-mta/postfix-3.11.0_rc4

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-03-02

postfix - 3.12_pre20260227
Ebuild name:

mail-mta/postfix-3.12_pre20260227

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-03-02

pulseaudio-qt - 1.8.0
Ebuild name:

media-libs/pulseaudio-qt-1.8.0

Description

Qt bindings for libpulse

Added to portage

2026-03-02

pyfakefs - 6.1.3
Ebuild name:

dev-python/pyfakefs-6.1.3

Description

A fake file system that mocks the Python file system modules

Added to portage

2026-03-02

pyproject-fmt - 2.17.0
Ebuild name:

dev-python/pyproject-fmt-2.17.0

Description

Format your pyproject.toml file

Added to portage

2026-03-02

python-dotenv - 1.2.2
Ebuild name:

dev-python/python-dotenv-1.2.2

Description

Manage .env files

Added to portage

2026-03-02

sphinx-autodoc-typehints - 3.9.2
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.9.2

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-03-02

squashfs-tools - 4.7.5
Ebuild name:

sys-fs/squashfs-tools-4.7.5

Description

Tools to create and extract Squashfs filesystems

Added to portage

2026-03-02

tables - 3.11.1
Ebuild name:

dev-python/tables-3.11.1

Description

Hierarchical datasets for Python

Added to portage

2026-03-02

tktable - 2.12.1
Ebuild name:

dev-tcltk/tktable-2.12.1

Description

full-featured 2D table widget

Added to portage

2026-03-02

tls - 2.0-r1
Ebuild name:

dev-tcltk/tls-2.0-r1

Description

TLS OpenSSL extension to Tcl

Added to portage

2026-03-02

tox - 4.47.0
Ebuild name:

dev-python/tox-4.47.0

Description

virtualenv-based automation of test activities

Added to portage

2026-03-02

uc-micro-py - 2.0.0
Ebuild name:

dev-python/uc-micro-py-2.0.0

Description

Micro subset of unicode data files for linkify-it-py projects

Added to portage

2026-03-02

xfce4-docklike-plugin - 0.5.1
Ebuild name:

xfce-extra/xfce4-docklike-plugin-0.5.1

Description

A modern, minimalist docklike taskbar for Xfce

Added to portage

2026-03-02

xfce4-panel - 4.20.7
Ebuild name:

xfce-base/xfce4-panel-4.20.7

Description

Panel for the Xfce desktop environment

Added to portage

2026-03-02

xfce4-screensaver - 4.20.2
Ebuild name:

xfce-extra/xfce4-screensaver-4.20.2

Description

Screen saver and locker (port of MATE screensaver)

Added to portage

2026-03-02

xfce4-session - 4.20.4
Ebuild name:

xfce-base/xfce4-session-4.20.4

Description

A session manager for the Xfce desktop environment

Added to portage

2026-03-02

xfce4-settings - 4.20.4
Ebuild name:

xfce-base/xfce4-settings-4.20.4

Description

Configuration system for the Xfce desktop environment

Added to portage

2026-03-02

xv - 6.2.0
Ebuild name:

media-gfx/xv-6.2.0

Description

Interactive image manipulation program supporting a wide variety of formats

Added to portage

2026-03-02

yarl - 1.23.0
Ebuild name:

dev-python/yarl-1.23.0

Description

Yet another URL library

Added to portage

2026-03-02

zeal - 0.8.0
Ebuild name:

app-text/zeal-0.8.0

Description

Offline documentation browser inspired by Dash

Added to portage

2026-03-02

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 108.4 ms