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:

87088

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-07-21
aiohttp - 3.14.2
Ebuild name:

dev-python/aiohttp-3.14.2

Description

HTTP client/server for asyncio

Added to portage

2026-07-21

awkward - 2.11.0
Ebuild name:

dev-python/awkward-2.11.0

Description

Manipulate JSON-like data with NumPy-like idioms

Added to portage

2026-07-21

awscli - 1.45.52
Ebuild name:

app-admin/awscli-1.45.52

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-21

boto3 - 1.43.52
Ebuild name:

dev-python/boto3-1.43.52

Description

The AWS SDK for Python

Added to portage

2026-07-21

botocore - 1.43.52
Ebuild name:

dev-python/botocore-1.43.52

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-21

bracex - 3.0.1
Ebuild name:

dev-python/bracex-3.0.1

Description

Bash style brace expansion for Python

Added to portage

2026-07-21

cfn-lint - 1.53.1
Ebuild name:

dev-python/cfn-lint-1.53.1

Description

CloudFormation Linter

Added to portage

2026-07-21

container-libs - 0.68.0-r1
Ebuild name:

app-containers/container-libs-0.68.0-r1

Description

Several utilities from the containers project

Added to portage

2026-07-21

containers-shortnames - 2025.03.19_p20260615
Ebuild name:

app-containers/containers-shortnames-2025.03.19_p20260615

Description

Configures default shortnames (aliases) f

Added to portage

2026-07-21

dkms - 3.4.2
Ebuild name:

sys-kernel/dkms-3.4.2

Description

Dynamic Kernel Module Support

Added to portage

2026-07-21

dracut - 111-r2
Ebuild name:

sys-kernel/dracut-111-r2

Description

Generic initramfs generation tool

Added to portage

2026-07-21

faker - 40.32.0
Ebuild name:

dev-python/faker-40.32.0

Description

A Python package that generates fake data for you

Added to portage

2026-07-21

faust-cchardet - 3.0.0
Ebuild name:

dev-python/faust-cchardet-3.0.0

Description

High speed universal character encoding detector

Added to portage

2026-07-21

firefox - 153.0
Ebuild name:

www-client/firefox-153.0

Description

Firefox Web Browser

Added to portage

2026-07-21

firefox-l10n - 153.0
Ebuild name:

www-client/firefox-l10n-153.0

Description

Firefox Web Browser's translation files

Added to portage

2026-07-21

fuse-overlayfs - 1.17
Ebuild name:

sys-fs/fuse-overlayfs-1.17

Description

FUSE implementation for overlayfs

Added to portage

2026-07-21

ggml - 0.17.0
Ebuild name:

sci-ml/ggml-0.17.0

Description

Tensor library for machine learning

Added to portage

2026-07-21

gitpython - 3.1.53
Ebuild name:

dev-python/gitpython-3.1.53

Description

Library used to interact with Git repositories

Added to portage

2026-07-21

hypothesis - 6.157.2
Ebuild name:

dev-python/hypothesis-6.157.2

Description

A library for property based testing

Added to portage

2026-07-21

icalendar - 7.2.2
Ebuild name:

dev-python/icalendar-7.2.2

Description

RFC 5545 compatible parser and generator of iCalendar files

Added to portage

2026-07-21

imageio - 2.37.4
Ebuild name:

dev-python/imageio-2.37.4

Description

Python library for reading and writing image data

Added to portage

2026-07-21

imaplib2 - 3.6
Ebuild name:

dev-python/imaplib2-3.6

Description

Threaded Python IMAP4 client

Added to portage

2026-07-21

imaplib2 - 9999
Ebuild name:

dev-python/imaplib2-9999

Description

Threaded Python IMAP4 client

Added to portage

2026-07-21

jdbc-postgresql - 42.7.13
Ebuild name:

dev-java/jdbc-postgresql-42.7.13

Description

Java JDBC 4.2 (JRE 8+) driver for PostgreSQL database

Added to portage

2026-07-21

kimageformats - 6.28.1
Ebuild name:

kde-frameworks/kimageformats-6.28.1

Description

Framework providing additional format plugins for Qt's image I/

Added to portage

2026-07-21

kirigami-addons - 1.13.1
Ebuild name:

dev-libs/kirigami-addons-1.13.1

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-07-21

lxc-templates - 3.0.4_p20260719
Ebuild name:

app-containers/lxc-templates-3.0.4_p20260719

Description

Old style template scripts for LXC

Added to portage

2026-07-21

modus-themes - 9999
Ebuild name:

app-emacs/modus-themes-9999

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-07-21

mpg123-el - 1.65
Ebuild name:

app-emacs/mpg123-el-1.65

Description

Emacs front-end to mpg123 audio player and OggVorbis audio player

Added to portage

2026-07-21

ophcrack - 3.8.0-r2
Ebuild name:

app-crypt/ophcrack-3.8.0-r2

Description

A time-memory-trade-off-cracker

Added to portage

2026-07-21

ophcrack-tables - 1.0-r2
Ebuild name:

app-crypt/ophcrack-tables-1.0-r2

Description

Tables available for ophcrack

Added to portage

2026-07-21

osslsigncode - 2.13
Ebuild name:

app-crypt/osslsigncode-2.13

Description

Platform-independent tool for Authenticode signing of EXE/CAB files

Added to portage

2026-07-21

osslsigncode - 2.9
Ebuild name:

app-crypt/osslsigncode-2.9

Description

Platform-independent tool for Authenticode signing of EXE/CAB files

Added to portage

2026-07-21

p11-kit - 0.26.2
Ebuild name:

app-crypt/p11-kit-0.26.2

Description

Provides a standard configuration setup for installing PKCS11

Added to portage

2026-07-21

passt - 2026.07.16
Ebuild name:

net-misc/passt-2026.07.16

Description

User-mode networking daemons for VMs and namespaces, replacement for Slir

Added to portage

2026-07-21

podman - 5.8.5
Ebuild name:

app-containers/podman-5.8.5

Description

A tool for managing OCI containers and pods with Docker-compatible CLI

Added to portage

2026-07-21

podman - 6.0.1
Ebuild name:

app-containers/podman-6.0.1

Description

A tool for managing OCI containers and pods with Docker-compatible CLI

Added to portage

2026-07-21

podman-tui - 1.11.3
Ebuild name:

app-containers/podman-tui-1.11.3

Description

Terminal UI frontend for Podman

Added to portage

2026-07-21

prometheus-podman-exporter - 1.21.2
Ebuild name:

app-metrics/prometheus-podman-exporter-1.21.2

Description

Exporter for podman giving containers, pods, images,

Added to portage

2026-07-21

pygraphviz - 2.0.1
Ebuild name:

dev-python/pygraphviz-2.0.1

Description

Python wrapper for the Graphviz Agraph data structure

Added to portage

2026-07-21

pyqtgraph - 0.14.0-r1
Ebuild name:

dev-python/pyqtgraph-0.14.0-r1

Description

A pure-python graphics and GUI library built on PyQt and numpy

Added to portage

2026-07-21

rfc6555 - 0.1.0
Ebuild name:

dev-python/rfc6555-0.1.0

Description

Implementation of the Happy Eyeballs Algorithm (RFC 6555)

Added to portage

2026-07-21

sqlglot - 30.13.0
Ebuild name:

dev-python/sqlglot-30.13.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2026-07-21

tox - 4.57.2
Ebuild name:

dev-python/tox-4.57.2

Description

virtualenv-based automation of test activities

Added to portage

2026-07-21

uchardet - 0.0.8_p20250825
Ebuild name:

app-i18n/uchardet-0.0.8_p20250825

Description

Encoding detector library

Added to portage

2026-07-21

urwid - 4.0.5
Ebuild name:

dev-python/urwid-4.0.5

Description

Curses-based user interface library for Python

Added to portage

2026-07-21

uv - 0.11.30
Ebuild name:

dev-python/uv-0.11.30

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-07-21

uv-build - 0.11.30
Ebuild name:

dev-python/uv-build-0.11.30

Description

PEP517 uv build backend

Added to portage

2026-07-21

xvfbwrapper - 0.2.28
Ebuild name:

dev-python/xvfbwrapper-0.2.28

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2026-07-21

yarl - 1.24.5
Ebuild name:

dev-python/yarl-1.24.5

Description

Yet another URL library

Added to portage

2026-07-21

2026-07-20
acme-sh - 3.1.4
Ebuild name:

app-crypt/acme-sh-3.1.4

Description

A pure Unix shell script implementing ACME client protocol

Added to portage

2026-07-20

aws-c-auth - 0.10.4
Ebuild name:

dev-libs/aws-c-auth-0.10.4

Description

AWS C Auth C99 library implementation of AWS client-side authentication

Added to portage

2026-07-20

aws-c-cal - 0.9.14
Ebuild name:

dev-libs/aws-c-cal-0.9.14

Description

Crypto Abstraction Layer Cross-Platform C99 wrapper for cryptography prim

Added to portage

2026-07-20

aws-c-common - 0.14.2
Ebuild name:

dev-libs/aws-c-common-0.14.2

Description

Core c99 package for AWS SDK for C

Added to portage

2026-07-20

aws-c-compression - 0.3.2
Ebuild name:

dev-libs/aws-c-compression-0.3.2

Description

AWS C Compression cross-platform algorithms

Added to portage

2026-07-20

aws-c-event-stream - 0.7.1
Ebuild name:

dev-libs/aws-c-event-stream-0.7.1

Description

Core c99 package for AWS SDK for C

Added to portage

2026-07-20

aws-c-http - 0.11.0
Ebuild name:

dev-libs/aws-c-http-0.11.0

Description

AWS C Http C99 implementation of the HTTP/1.1 and HTTP/2 specifications

Added to portage

2026-07-20

aws-c-io - 0.27.4
Ebuild name:

dev-libs/aws-c-io-0.27.4

Description

AWS C IO It handles all IO and TLS work for application protocols

Added to portage

2026-07-20

aws-c-mqtt - 0.16.0
Ebuild name:

dev-libs/aws-c-mqtt-0.16.0

Description

AWS C MQTT C99 implementation

Added to portage

2026-07-20

aws-c-s3 - 0.13.1
Ebuild name:

dev-libs/aws-c-s3-0.13.1

Description

AWS C S3 async library

Added to portage

2026-07-20

aws-c-sdkutils - 0.2.7
Ebuild name:

dev-libs/aws-c-sdkutils-0.2.7

Description

AWS C SDKUTILS C99 library implementing AWS SDK specific utilities

Added to portage

2026-07-20

aws-checksums - 0.2.10
Ebuild name:

dev-libs/aws-checksums-0.2.10

Description

Cross-Platform HW accelerated CRC32c and CRC32 with fallback to SW

Added to portage

2026-07-20

aws-crt-cpp - 0.37.4
Ebuild name:

dev-cpp/aws-crt-cpp-0.37.4

Description

C++ wrapper around the aws-c-* libraries

Added to portage

2026-07-20

aws-sdk-cpp - 1.11.764
Ebuild name:

dev-cpp/aws-sdk-cpp-1.11.764

Description

AWS SDK for C++

Added to portage

2026-07-20

below - 9999
Ebuild name:

sys-process/below-9999

Description

An interactive tool to view and record historical system data

Added to portage

2026-07-20

bitarray - 3.9.1
Ebuild name:

dev-python/bitarray-3.9.1

Description

Efficient arrays of booleans -- C extension

Added to portage

2026-07-20

confuse - 2.2.1
Ebuild name:

dev-python/confuse-2.2.1

Description

Confuse is a configuration library for Python that uses YAML

Added to portage

2026-07-20

dulwich - 1.2.12
Ebuild name:

dev-python/dulwich-1.2.12

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2026-07-20

faust-cchardet - 2.2.1
Ebuild name:

dev-python/faust-cchardet-2.2.1

Description

High speed universal character encoding detector

Added to portage

2026-07-20

firefox-bin - 153.0
Ebuild name:

www-client/firefox-bin-153.0

Description

Firefox Web Browser

Added to portage

2026-07-20

fractal - 14.1
Ebuild name:

net-im/fractal-14.1

Description

Matrix messaging app for GNOME written in Rust

Added to portage

2026-07-20

gcc - 17.0.0_p20260719
Ebuild name:

sys-devel/gcc-17.0.0_p20260719

Description

The GNU Compiler Collection

Added to portage

2026-07-20

gherkin-official - 42.0.0
Ebuild name:

dev-python/gherkin-official-42.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-07-20

git-sources - 7.2_rc4
Ebuild name:

sys-kernel/git-sources-7.2_rc4

Description

The very latest -git version of the Linux kernel

Added to portage

2026-07-20

gpredict - 2.5.2
Ebuild name:

media-radio/gpredict-2.5.2

Description

Real-time satellite tracking and orbit prediction application

Added to portage

2026-07-20

gulrak-filesystem - 1.5.16
Ebuild name:

dev-cpp/gulrak-filesystem-1.5.16

Description

Header-only single-file std compatible helper library

Added to portage

2026-07-20

helvum - 0.6.2
Ebuild name:

media-sound/helvum-0.6.2

Description

A GTK patchbay for pipewire

Added to portage

2026-07-20

htop - 3.5.2
Ebuild name:

sys-process/htop-3.5.2

Description

Interactive process viewer

Added to portage

2026-07-20

hypothesis - 6.157.0
Ebuild name:

dev-python/hypothesis-6.157.0

Description

A library for property based testing

Added to portage

2026-07-20

joserfc - 1.7.4
Ebuild name:

dev-python/joserfc-1.7.4

Description

A Python library for JOSE RFCs JWS, JWE, JWK, JWA, JWT

Added to portage

2026-07-20

jupyter-builder - 1.1.1-r1
Ebuild name:

dev-python/jupyter-builder-1.1.1-r1

Description

JupyterLab build tools

Added to portage

2026-07-20

kddockwidgets - 2.4.1
Ebuild name:

gui-libs/kddockwidgets-2.4.1

Description

KDAB's Dock Widget Framework for Qt

Added to portage

2026-07-20

libxmp - 4.7.1
Ebuild name:

media-libs/libxmp-4.7.1

Description

Library that renders module files to PCM data

Added to portage

2026-07-20

lowdown - 3.1.1
Ebuild name:

app-text/lowdown-3.1.1

Description

Markdown translator producing HTML5, roff documents in the ms and man format

Added to portage

2026-07-20

mpd - 0.24.12-r1
Ebuild name:

media-sound/mpd-0.24.12-r1

Description

The Music Player Daemon (mpd)

Added to portage

2026-07-20

onak - 0.6.4
Ebuild name:

app-crypt/onak-0.6.4

Description

onak is an OpenPGP keyserver

Added to portage

2026-07-20

openrdap - 0.10.1
Ebuild name:

net-misc/openrdap-0.10.1

Description

RDAP command line client

Added to portage

2026-07-20

pebble - 5.2.1
Ebuild name:

dev-python/pebble-5.2.1

Description

Threading and multiprocessing eye-candy

Added to portage

2026-07-20

pyshp - 3.1.4
Ebuild name:

sci-libs/pyshp-3.1.4

Description

Pure Python read/write support for ESRI Shapefile format

Added to portage

2026-07-20

ruff - 0.15.22
Ebuild name:

dev-util/ruff-0.15.22

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-07-20

sdl2-mixer - 2.8.1-r4
Ebuild name:

media-libs/sdl2-mixer-2.8.1-r4

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

sdl2-mixer - 2.8.2-r1
Ebuild name:

media-libs/sdl2-mixer-2.8.2-r1

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

soupsieve - 2.9
Ebuild name:

dev-python/soupsieve-2.9

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-07-20

stb - 20260415-r1
Ebuild name:

dev-libs/stb-20260415-r1

Description

Single-file C/C++ libraries for various purposes

Added to portage

2026-07-20

term-ansicolor - 1.11.3-r1
Ebuild name:

dev-ruby/term-ansicolor-1.11.3-r1

Description

Small Ruby library that colors strings using ANSI escape sequence

Added to portage

2026-07-20

winbox - 4.3
Ebuild name:

app-admin/winbox-4.3

Description

Management Software for MikroTik RouterOS

Added to portage

2026-07-20

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