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:

86178

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.5 (69 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-06-22
active - 0.2.1
Ebuild name:

dev-haskell/active-0.2.1

Description

Abstractions for animation

Added to portage

2026-06-22

adjunctions - 4.4.4
Ebuild name:

dev-haskell/adjunctions-4.4.4

Description

Adjunctions and representable functors

Added to portage

2026-06-22

aeson - 2.1.2.1-r1
Ebuild name:

dev-haskell/aeson-2.1.2.1-r1

Description

Fast JSON parsing and encoding

Added to portage

2026-06-22

aeson - 2.2.3.0-r2
Ebuild name:

dev-haskell/aeson-2.2.3.0-r2

Description

Fast JSON parsing and encoding

Added to portage

2026-06-22

alex - 3.5.1.0
Ebuild name:

dev-haskell/alex-3.5.1.0

Description

Alex is a tool for generating lexical analysers in Haskell

Added to portage

2026-06-22

appar - 0.1.8-r1
Ebuild name:

dev-haskell/appar-0.1.8-r1

Description

A simple applicative parser

Added to portage

2026-06-22

asciidoc - 0.1.0.3
Ebuild name:

dev-haskell/asciidoc-0.1.0.3

Description

AsciiDoc parser

Added to portage

2026-06-22

async - 2.2.5-r1
Ebuild name:

dev-haskell/async-2.2.5-r1

Description

Run IO operations asynchronously and wait for their results

Added to portage

2026-06-22

atari800 - 6.1.0
Ebuild name:

games-emulation/atari800-6.1.0

Description

Emulator of Atari 8-bit computer systems and 5200 game console

Added to portage

2026-06-22

attoparsec-aeson - 2.2.2.0
Ebuild name:

dev-haskell/attoparsec-aeson-2.2.2.0

Description

Parsing of aeson's Value with attoparsec

Added to portage

2026-06-22

attoparsec-iso8601 - 1.1.0.1
Ebuild name:

dev-haskell/attoparsec-iso8601-1.1.0.1

Description

Parsing of ISO 8601 dates, originally from aeson

Added to portage

2026-06-22

auto-update - 0.2.6
Ebuild name:

dev-haskell/auto-update-0.2.6

Description

Efficiently run periodic, on-demand actions

Added to portage

2026-06-22

aws - 0.25.2
Ebuild name:

dev-haskell/aws-0.25.2

Description

Amazon Web Services (AWS) for Haskell

Added to portage

2026-06-22

base-compat - 0.13.1
Ebuild name:

dev-haskell/base-compat-0.13.1

Description

A compatibility layer for base

Added to portage

2026-06-22

base-compat-batteries - 0.13.1
Ebuild name:

dev-haskell/base-compat-batteries-0.13.1

Description

base-compat with extra batteries

Added to portage

2026-06-22

base-orphans - 0.9.3
Ebuild name:

dev-haskell/base-orphans-0.9.3

Description

Backwards-compatible orphan instances for base

Added to portage

2026-06-22

base-unicode-symbols - 0.2.4.2-r1
Ebuild name:

dev-haskell/base-unicode-symbols-0.2.4.2-r1

Description

Unicode alternatives for common functions and operators

Added to portage

2026-06-22

base64 - 1.0
Ebuild name:

dev-haskell/base64-1.0

Description

A modern Base64 library

Added to portage

2026-06-22

base64-bytestring - 1.2.1.0-r1
Ebuild name:

dev-haskell/base64-bytestring-1.2.1.0-r1

Description

Fast base64 encoding and decoding for ByteStrings

Added to portage

2026-06-22

bimap - 0.5.0
Ebuild name:

dev-haskell/bimap-0.5.0

Description

Bidirectional mapping between two key types

Added to portage

2026-06-22

blaze-builder - 0.4.2.3
Ebuild name:

dev-haskell/blaze-builder-0.4.2.3

Description

Efficient buffered output

Added to portage

2026-06-22

blaze-html - 0.9.2.0
Ebuild name:

dev-haskell/blaze-html-0.9.2.0

Description

A blazingly fast HTML combinator library for Haskell

Added to portage

2026-06-22

blaze-markup - 0.8.3.0
Ebuild name:

dev-haskell/blaze-markup-0.8.3.0

Description

A blazingly fast markup combinator library for Haskell

Added to portage

2026-06-22

blaze-svg - 0.3.7
Ebuild name:

dev-haskell/blaze-svg-0.3.7

Description

SVG combinator library

Added to portage

2026-06-22

boolean - 0.2.4
Ebuild name:

dev-haskell/boolean-0.2.4

Description

Generalized booleans and numbers

Added to portage

2026-06-22

boring - 0.2.2
Ebuild name:

dev-haskell/boring-0.2.2

Description

Boring and Absurd types

Added to portage

2026-06-22

brick - 2.10
Ebuild name:

dev-haskell/brick-2.10

Description

A declarative terminal user interface library

Added to portage

2026-06-22

bsb-http-chunked - 0.0.0.4-r2
Ebuild name:

dev-haskell/bsb-http-chunked-0.0.0.4-r2

Description

Chunked HTTP transfer encoding for bytestring builders

Added to portage

2026-06-22

byteorder - 1.0.4-r1
Ebuild name:

dev-haskell/byteorder-1.0.4-r1

Description

Exposes the native endianness or byte ordering of the system

Added to portage

2026-06-22

bytes - 0.17.4
Ebuild name:

dev-haskell/bytes-0.17.4

Description

Sharing code for serialization between binary and cereal

Added to portage

2026-06-22

bytestring-builder - 0.10.8.2.0-r1
Ebuild name:

dev-haskell/bytestring-builder-0.10.8.2.0-r1

Description

The new bytestring builder, packaged outside of GHC

Added to portage

2026-06-22

dnscrypt-proxy - 2.1.16
Ebuild name:

net-dns/dnscrypt-proxy-2.1.16

Description

Flexible DNS proxy, with support for encrypted DNS protocols

Added to portage

2026-06-22

dnscrypt-proxy - 2.1.16-r1
Ebuild name:

net-dns/dnscrypt-proxy-2.1.16-r1

Description

Flexible DNS proxy, with support for encrypted DNS protocols

Added to portage

2026-06-22

ffmpeg - 4.4.8
Ebuild name:

media-video/ffmpeg-4.4.8

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-22

ffmpeg-compat - 4.4.8
Ebuild name:

media-video/ffmpeg-compat-4.4.8

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-22

gcc - 17.0.0_p20260621
Ebuild name:

sys-devel/gcc-17.0.0_p20260621

Description

The GNU Compiler Collection

Added to portage

2026-06-22

haskell-updater - 1.5.0.0
Ebuild name:

app-admin/haskell-updater-1.5.0.0

Description

Rebuild Haskell dependencies in Gentoo

Added to portage

2026-06-22

hypothesis - 6.155.7
Ebuild name:

dev-python/hypothesis-6.155.7

Description

A library for property based testing

Added to portage

2026-06-22

magit-popup - 2.13.3-r1
Ebuild name:

app-emacs/magit-popup-2.13.3-r1

Description

Define prefix-infix-suffix command combos

Added to portage

2026-06-22

mistune - 3.3.1
Ebuild name:

dev-python/mistune-3.3.1

Description

The fastest markdown parser in pure Python

Added to portage

2026-06-22

nh3 - 0.3.6
Ebuild name:

dev-python/nh3-0.3.6

Description

Ammonia HTML sanitizer Python binding

Added to portage

2026-06-22

nuitka - 4.1.3
Ebuild name:

dev-python/nuitka-4.1.3

Description

Python to native compiler

Added to portage

2026-06-22

numpy - 2.5.0
Ebuild name:

dev-python/numpy-2.5.0

Description

Fast array and numerical python library

Added to portage

2026-06-22

pandoc-cli - 3.10
Ebuild name:

app-text/pandoc-cli-3.10

Description

Conversion between documentation formats

Added to portage

2026-06-22

pipewire - 1.6.7
Ebuild name:

media-video/pipewire-1.6.7

Description

Multimedia processing graphs

Added to portage

2026-06-22

pkgcore - 0.12.35
Ebuild name:

sys-apps/pkgcore-0.12.35

Description

a framework for package management

Added to portage

2026-06-22

xdelta - 3.2.0
Ebuild name:

dev-util/xdelta-3.2.0

Description

Computes changes between binary or text files and creates deltas

Added to portage

2026-06-22

xfce4-settings - 4.21.2
Ebuild name:

xfce-base/xfce4-settings-4.21.2

Description

Configuration system for the Xfce desktop environment

Added to portage

2026-06-22

xfdesktop - 4.21.0
Ebuild name:

xfce-base/xfdesktop-4.21.0

Description

Desktop manager for the Xfce desktop environment

Added to portage

2026-06-22

zeroconf - 0.149.17
Ebuild name:

dev-python/zeroconf-0.149.17

Description

Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi com

Added to portage

2026-06-22

2026-06-21
cereal - 1.3.2-r4
Ebuild name:

dev-libs/cereal-1.3.2-r4

Description

Header-only C++11 serialization library

Added to portage

2026-06-21

coverage - 7.14.2
Ebuild name:

dev-python/coverage-7.14.2

Description

Code coverage measurement for Python

Added to portage

2026-06-21

dash - 0.5.13.4-r2
Ebuild name:

app-shells/dash-0.5.13.4-r2

Description

Debian Almquist Shell

Added to portage

2026-06-21

eselect-pinentry - 0.7.5
Ebuild name:

app-eselect/eselect-pinentry-0.7.5

Description

Manage /usr/bin/pinentry symlink

Added to portage

2026-06-21

ffmpeg - 6.1.6
Ebuild name:

media-video/ffmpeg-6.1.6

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-21

ffmpeg-compat - 6.1.6
Ebuild name:

media-video/ffmpeg-compat-6.1.6

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-21

firefox - 152.0.1
Ebuild name:

www-client/firefox-152.0.1

Description

Firefox Web Browser

Added to portage

2026-06-21

firefox-bin - 152.0.1
Ebuild name:

www-client/firefox-bin-152.0.1

Description

Firefox Web Browser

Added to portage

2026-06-21

firefox-l10n - 152.0.1
Ebuild name:

www-client/firefox-l10n-152.0.1

Description

Firefox Web Browser's translation files

Added to portage

2026-06-21

freedroid - 1.9.1
Ebuild name:

games-rpg/freedroid-1.9.1

Description

The original Freedroid, a clone of the C64 classic Paradroid

Added to portage

2026-06-21

gcc - 16.1.1_p20260620
Ebuild name:

sys-devel/gcc-16.1.1_p20260620

Description

The GNU Compiler Collection

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.1.176
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.1.176

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.12.94
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.12.94

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.18.36
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.36

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.6.143
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.6.143

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-06-21

global - 6.6.15
Ebuild name:

dev-util/global-6.6.15

Description

Tag system to find an object location in various sources

Added to portage

2026-06-21

jq - 1.8.2
Ebuild name:

app-misc/jq-1.8.2

Description

A lightweight and flexible command-line JSON processor

Added to portage

2026-06-21

kquickimageeditor - 0.6.2
Ebuild name:

media-libs/kquickimageeditor-0.6.2

Description

QtQuick components providing basic image editing capabilities

Added to portage

2026-06-21

lttng-modules - 2.14.6
Ebuild name:

dev-util/lttng-modules-2.14.6

Description

LTTng Kernel Tracer Modules

Added to portage

2026-06-21

lttng-tools - 2.14.2
Ebuild name:

dev-util/lttng-tools-2.14.2

Description

Linux Trace Toolkit - next generation

Added to portage

2026-06-21

mycli - 1.76.0
Ebuild name:

dev-db/mycli-1.76.0

Description

CLI for MySQL Database with auto-completion and syntax highlighting

Added to portage

2026-06-21

naev - 0.13.5
Ebuild name:

games-strategy/naev-0.13.5

Description

2D space trading and combat game, in a similar vein to Escape Velocity

Added to portage

2026-06-21

openpgp-keys-jeremiegalarneau - 20260620
Ebuild name:

sec-keys/openpgp-keys-jeremiegalarneau-20260620

Description

OpenPGP keys used by Jérémie Galarneau

Added to portage

2026-06-21

openrc - 0.63.2
Ebuild name:

sys-apps/openrc-0.63.2

Description

OpenRC manages the services, startup and shutdown of a host

Added to portage

2026-06-21

postgrey - 1.37_p20230714-r2
Ebuild name:

mail-filter/postgrey-1.37_p20230714-r2

Description

Postgrey is a Postfix policy server implementing greylisting

Added to portage

2026-06-21

pysolfc - 3.6.0
Ebuild name:

games-board/pysolfc-3.6.0

Description

Exciting collection of more than 1000 solitaire card games

Added to portage

2026-06-21

python-engineio - 4.13.3
Ebuild name:

dev-python/python-engineio-4.13.3

Description

Python implementation of the Engine.IO realtime server

Added to portage

2026-06-21

qbs - 3.3.0
Ebuild name:

dev-util/qbs-3.3.0

Description

Modern build tool for software projects

Added to portage

2026-06-21

qxlsx - 1.5.1.1
Ebuild name:

dev-libs/qxlsx-1.5.1.1

Description

Excel file(*.xlsx) reader/writer library using Qt

Added to portage

2026-06-21

rapidyaml - 0.15.2
Ebuild name:

dev-cpp/rapidyaml-0.15.2

Description

Library to parse and emit YAML, and do it fast

Added to portage

2026-06-21

rq - 2.10.0
Ebuild name:

dev-python/rq-2.10.0

Description

Simple, lightweight library for creating and processing background jobs

Added to portage

2026-06-21

scummvm - 2026.3.0
Ebuild name:

games-engines/scummvm-2026.3.0

Description

Reimplementation of various game engines for adventures and role-pla

Added to portage

2026-06-21

shutter - 0.99.7
Ebuild name:

x11-misc/shutter-0.99.7

Description

Feature-rich screenshot program

Added to portage

2026-06-21

signxml - 5.0.0
Ebuild name:

dev-python/signxml-5.0.0

Description

Python XML Signature and XAdES library

Added to portage

2026-06-21

systemd - 261-r1
Ebuild name:

sys-apps/systemd-261-r1

Description

System and service manager for Linux

Added to portage

2026-06-21

testfixtures - 12.2.0
Ebuild name:

dev-python/testfixtures-12.2.0

Description

A collection of helpers and mock objects for unit tests and doc test

Added to portage

2026-06-21

tibs - 0.10.0
Ebuild name:

dev-python/tibs-0.10.0

Description

A sleek Python library for your binary data

Added to portage

2026-06-21

ueberzugpp - 2.9.10
Ebuild name:

media-gfx/ueberzugpp-2.9.10

Description

Drop in replacement for ueberzug written in C++

Added to portage

2026-06-21

vips - 8.18.3
Ebuild name:

media-libs/vips-8.18.3

Description

VIPS Image Processing Library

Added to portage

2026-06-21

virtualbox-modules - 7.2.10-r1
Ebuild name:

app-emulation/virtualbox-modules-7.2.10-r1

Description

Kernel Modules for Virtualbox

Added to portage

2026-06-21

wrapt - 2.2.2
Ebuild name:

dev-python/wrapt-2.2.2

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-06-21

yaspin - 3.4.0
Ebuild name:

dev-python/yaspin-3.4.0

Description

Yet Another Terminal Spinner

Added to portage

2026-06-21

zsnes - 2.1.1
Ebuild name:

games-emulation/zsnes-2.1.1

Description

Fork of the classic Super Nintendo emulator

Added to portage

2026-06-21

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