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:

89180

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-10-14
ant - 1.10.15-r2
Ebuild name:

dev-java/ant-1.10.15-r2

Description

Java-based build tool similar to 'make' that uses XML configuration files

Added to portage

2026-10-14

ant - 1.10.18
Ebuild name:

dev-java/ant-1.10.18

Description

Java-based build tool similar to 'make' that uses XML configuration files

Added to portage

2026-10-14

awscli - 2.38.0
Ebuild name:

app-admin/awscli-2.38.0

Description

Universal Command Line Environment for AWS

Added to portage

2026-10-14

boto3 - 1.43.113
Ebuild name:

dev-python/boto3-1.43.113

Description

The AWS SDK for Python

Added to portage

2026-10-14

botocore - 1.43.113
Ebuild name:

dev-python/botocore-1.43.113

Description

Low-level, data-driven core of boto 3

Added to portage

2026-10-14

bpf-linker - 0.12.0
Ebuild name:

dev-util/bpf-linker-0.12.0

Description

Simple BPF static linker

Added to portage

2026-10-14

bsh - 3.0.0_rc1
Ebuild name:

dev-java/bsh-3.0.0_rc1

Description

A small embeddable Java source interpreter

Added to portage

2026-10-14

bsh-bsf-engine - 3.0.0_rc1
Ebuild name:

dev-java/bsh-bsf-engine-3.0.0_rc1

Description

Beanshell BSF engine

Added to portage

2026-10-14

cramjam - 2.14.0
Ebuild name:

dev-python/cramjam-2.14.0

Description

Thin Python bindings to de/compression algorithms in Rust

Added to portage

2026-10-14

crengine-ng - 0.9.14.1
Ebuild name:

app-text/crengine-ng-0.9.14.1

Description

Cross-platform library designed to implement e-book readers

Added to portage

2026-10-14

curl - 8.23.0
Ebuild name:

net-misc/curl-8.23.0

Description

A Client that groks URLs

Added to portage

2026-10-14

firefox - 153.5.0
Ebuild name:

www-client/firefox-153.5.0

Description

Firefox Web Browser

Added to portage

2026-10-14

firefox-bin - 153.5.0
Ebuild name:

www-client/firefox-bin-153.5.0

Description

Firefox Web Browser

Added to portage

2026-10-14

firefox-l10n - 153.5.0
Ebuild name:

www-client/firefox-l10n-153.5.0

Description

Firefox Web Browser's translation files

Added to portage

2026-10-14

freetype - 2.15.0
Ebuild name:

media-libs/freetype-2.15.0

Description

High-quality and portable font engine

Added to portage

2026-10-14

gcc - 17.0.0_p20261011-r1
Ebuild name:

sys-devel/gcc-17.0.0_p20261011-r1

Description

The GNU Compiler Collection

Added to portage

2026-10-14

glibc - 2.43-r6
Ebuild name:

sys-libs/glibc-2.43-r6

Description

GNU libc C library

Added to portage

2026-10-14

glibc - 2.44-r4
Ebuild name:

sys-libs/glibc-2.44-r4

Description

GNU libc C library

Added to portage

2026-10-14

gpxsee - 16.17
Ebuild name:

sci-geosciences/gpxsee-16.17

Description

Viewer and analyzer that supports gpx, tcx, kml, fit, igc and nmea fil

Added to portage

2026-10-14

grafana-bin - 12.4.13
Ebuild name:

www-apps/grafana-bin-12.4.13

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB &

Added to portage

2026-10-14

grafana-bin - 13.1.8
Ebuild name:

www-apps/grafana-bin-13.1.8

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB &a

Added to portage

2026-10-14

grafana-bin - 13.2.4
Ebuild name:

www-apps/grafana-bin-13.2.4

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB &a

Added to portage

2026-10-14

haxe-mode - 0.3.3
Ebuild name:

app-emacs/haxe-mode-0.3.3

Description

Major mode for editing Haxe files

Added to portage

2026-10-14

hypothesis - 6.169.1
Ebuild name:

dev-python/hypothesis-6.169.1

Description

A library for property based testing

Added to portage

2026-10-14

incus - 7.5.1
Ebuild name:

app-containers/incus-7.5.1

Description

Modern, secure and powerful system container and virtual machine manager

Added to portage

2026-10-14

ispc - 1.32.0
Ebuild name:

dev-lang/ispc-1.32.0

Description

Intel SPMD Program Compiler

Added to portage

2026-10-14

jemalloc - 5.4.0-r2
Ebuild name:

dev-libs/jemalloc-5.4.0-r2

Description

Jemalloc is a general-purpose scalable concurrent allocator

Added to portage

2026-10-14

libpng - 1.6.59-r1
Ebuild name:

media-libs/libpng-1.6.59-r1

Description

Portable Network Graphics library

Added to portage

2026-10-14

libzip - 1.12-r1
Ebuild name:

dev-libs/libzip-1.12-r1

Description

Library for manipulating zip archives

Added to portage

2026-10-14

markdown - 3.11.1
Ebuild name:

dev-python/markdown-3.11.1

Description

Python implementation of the markdown markup language

Added to portage

2026-10-14

moarvm - 2026.09
Ebuild name:

dev-lang/moarvm-2026.09

Description

A 6model-based VM for NQP and Raku

Added to portage

2026-10-14

nodejs - 24.21.0-r1
Ebuild name:

net-libs/nodejs-24.21.0-r1

Description

A JavaScript runtime built on Chrome's V8 JavaScript engine

Added to portage

2026-10-14

nqp - 2026.09
Ebuild name:

dev-lang/nqp-2026.09

Description

Not Quite Perl, a Raku bootstrapping compiler

Added to portage

2026-10-14

openntpd - 7.9_p1
Ebuild name:

net-misc/openntpd-7.9_p1

Description

Lightweight NTP server ported from OpenBSD

Added to portage

2026-10-14

podman - 6.1.4
Ebuild name:

app-containers/podman-6.1.4

Description

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

Added to portage

2026-10-14

pudb - 2026.1
Ebuild name:

dev-python/pudb-2026.1

Description

A full-screen, console-based Python debugger

Added to portage

2026-10-14

python-utils - 4.1.2
Ebuild name:

dev-python/python-utils-4.1.2

Description

Collection of small Python functions & classes

Added to portage

2026-10-14

pyzotero - 1.16.0
Ebuild name:

dev-python/pyzotero-1.16.0

Description

A Python client for the Zotero API

Added to portage

2026-10-14

rakudo - 2026.09
Ebuild name:

dev-lang/rakudo-2026.09

Description

A compiler for the Raku programming language

Added to portage

2026-10-14

rutorrent - 5.3.16
Ebuild name:

www-apps/rutorrent-5.3.16

Description

ruTorrent is a front-end for the popular Bittorrent client rTorrent

Added to portage

2026-10-14

sphinx-autodoc-typehints - 3.13.10
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.13.10

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-10-14

sphinxcontrib-httpdomain - 2.2.0
Ebuild name:

dev-python/sphinxcontrib-httpdomain-2.2.0

Description

Sphinx domain for documenting HTTP APIs

Added to portage

2026-10-14

starlette - 1.8.0
Ebuild name:

dev-python/starlette-1.8.0

Description

The little ASGI framework that shines

Added to portage

2026-10-14

thunderbird - 153.5.0
Ebuild name:

mail-client/thunderbird-153.5.0

Description

Thunderbird Mail Client

Added to portage

2026-10-14

thunderbird - 158.0
Ebuild name:

mail-client/thunderbird-158.0

Description

Thunderbird Mail Client

Added to portage

2026-10-14

thunderbird-bin - 158.0
Ebuild name:

mail-client/thunderbird-bin-158.0

Description

Thunderbird Mail Client

Added to portage

2026-10-14

thunderbird-l10n - 158.0
Ebuild name:

mail-client/thunderbird-l10n-158.0

Description

Thunderbird mail client's translation files

Added to portage

2026-10-14

tox - 4.65.5
Ebuild name:

dev-python/tox-4.65.5

Description

virtualenv-based automation of test activities

Added to portage

2026-10-14

vnstat - 2.13-r3
Ebuild name:

net-analyzer/vnstat-2.13-r3

Description

Console-based network traffic monitor that keeps statistics of network

Added to portage

2026-10-14

wrapt - 2.5.1
Ebuild name:

dev-python/wrapt-2.5.1

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-10-14

2026-10-13
aioquic - 1.6.1
Ebuild name:

dev-python/aioquic-1.6.1

Description

An implementation of QUIC and HTTP/3

Added to portage

2026-10-13

ast-serialize - 0.13.0
Ebuild name:

dev-python/ast-serialize-0.13.0

Description

Python bindings for mypy AST serialization

Added to portage

2026-10-13

async-lru - 2.4.0
Ebuild name:

dev-python/async-lru-2.4.0

Description

Simple lru_cache for asyncio

Added to portage

2026-10-13

atpublic - 9.0.0
Ebuild name:

dev-python/atpublic-9.0.0

Description

A decorator to populate __all__ and the module globals

Added to portage

2026-10-13

aws-sam-translator - 1.115.0
Ebuild name:

dev-python/aws-sam-translator-1.115.0

Description

A library that transform SAM templates into AWS CloudFormatio

Added to portage

2026-10-13

awscli - 2.37.13
Ebuild name:

app-admin/awscli-2.37.13

Description

Universal Command Line Environment for AWS

Added to portage

2026-10-13

bas - 2.7
Ebuild name:

dev-lang/bas-2.7

Description

An interpreter for the classic dialect of the programming language BASIC

Added to portage

2026-10-13

bitcoin-core - 32.0_rc4
Ebuild name:

net-p2p/bitcoin-core-32.0_rc4

Description

Reference implementation of the Bitcoin cryptocurrency

Added to portage

2026-10-13

bluetui - 0.8.2
Ebuild name:

net-wireless/bluetui-0.8.2

Description

TUI for managing bluetooth on Linux

Added to portage

2026-10-13

boto3 - 1.43.112
Ebuild name:

dev-python/boto3-1.43.112

Description

The AWS SDK for Python

Added to portage

2026-10-13

botocore - 1.43.112
Ebuild name:

dev-python/botocore-1.43.112

Description

Low-level, data-driven core of boto 3

Added to portage

2026-10-13

bpf-toolchain - 16.2.0_p1
Ebuild name:

sys-devel/bpf-toolchain-16.2.0_p1

Description

All-in-one bpf toolchain for building DTrace and systemd without

Added to portage

2026-10-13

cargo-nextest - 0.9.148
Ebuild name:

dev-util/cargo-nextest-0.9.148

Description

Next-generation test runner for Rust

Added to portage

2026-10-13

closure-compiler-bin - 20261005
Ebuild name:

dev-lang/closure-compiler-bin-20261005

Description

JavaScript optimizing compiler

Added to portage

2026-10-13

cmd2 - 4.3.0
Ebuild name:

dev-python/cmd2-4.3.0

Description

Extra features for standard library's cmd module

Added to portage

2026-10-13

cpp-httplib - 0.60.1
Ebuild name:

dev-cpp/cpp-httplib-0.60.1

Description

C++ HTTP/HTTPS server and client library

Added to portage

2026-10-13

easyeffects - 8.3.0
Ebuild name:

media-sound/easyeffects-8.3.0

Description

Limiter, auto volume and many other plugins for PipeWire applications

Added to portage

2026-10-13

exabgp - 5.0.14
Ebuild name:

net-misc/exabgp-5.0.14

Description

The BGP swiss army knife of networking

Added to portage

2026-10-13

firefox - 158.0
Ebuild name:

www-client/firefox-158.0

Description

Firefox Web Browser

Added to portage

2026-10-13

firefox-l10n - 158.0
Ebuild name:

www-client/firefox-l10n-158.0

Description

Firefox Web Browser's translation files

Added to portage

2026-10-13

flufl-lock - 10.0.0
Ebuild name:

dev-python/flufl-lock-10.0.0

Description

NFS-safe file locking with timeouts for POSIX systems

Added to portage

2026-10-13

freerdp - 3.32.2
Ebuild name:

net-misc/freerdp-3.32.2

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-10-13

git-delete-merged-branches - 7.7.0
Ebuild name:

dev-vcs/git-delete-merged-branches-7.7.0

Description

Command-line tool to delete merged Git branches

Added to portage

2026-10-13

gobject-introspection - 1.86.0-r1
Ebuild name:

dev-libs/gobject-introspection-1.86.0-r1

Description

Introspection system for GObject-based libraries

Added to portage

2026-10-13

google-auth - 2.62.0
Ebuild name:

dev-python/google-auth-2.62.0

Description

Google Authentication Library

Added to portage

2026-10-13

ijson - 3.6.0
Ebuild name:

dev-python/ijson-3.6.0

Description

Iterative JSON parser with a Pythonic interface

Added to portage

2026-10-13

installer - 1.1.0
Ebuild name:

dev-python/installer-1.1.0

Description

A library for installing Python wheels

Added to portage

2026-10-13

javacc - 8.1.0
Ebuild name:

dev-java/javacc-8.1.0

Description

Core module of JavaCC

Added to portage

2026-10-13

javacc-java - 8.1.0
Ebuild name:

dev-java/javacc-java-8.1.0

Description

Java code generator module of JavaCC

Added to portage

2026-10-13

jedi - 0.20.1
Ebuild name:

dev-python/jedi-0.20.1

Description

Autocompletion library for Python

Added to portage

2026-10-13

jj - 0.46.0
Ebuild name:

dev-vcs/jj-0.46.0

Description

Jujutsu - an experimental version control system

Added to portage

2026-10-13

kup - 0.10.0
Ebuild name:

kde-plasma/kup-0.10.0

Description

Backup scheduler for the Plasma desktop

Added to portage

2026-10-13

lsp-plugins - 1.2.35
Ebuild name:

media-libs/lsp-plugins-1.2.35

Description

Linux Studio Plugins

Added to portage

2026-10-13

mycli - 2.29.4
Ebuild name:

dev-db/mycli-2.29.4

Description

CLI for MySQL Database with auto-completion and syntax highlighting

Added to portage

2026-10-13

nodejs - 26.11.1-r1
Ebuild name:

net-libs/nodejs-26.11.1-r1

Description

A JavaScript runtime built on Chrome's V8 JavaScript engine

Added to portage

2026-10-13

opal-utils - 7.1
Ebuild name:

sys-apps/opal-utils-7.1

Description

OPAL firmware utilities

Added to portage

2026-10-13

opentmux - 0.1
Ebuild name:

app-misc/opentmux-0.1

Description

Terminal multiplexer, slop-free fork of app-misc/tmux

Added to portage

2026-10-13

opentmux - 9999
Ebuild name:

app-misc/opentmux-9999

Description

Terminal multiplexer, slop-free fork of app-misc/tmux

Added to portage

2026-10-13

pekwm - 0.4.4
Ebuild name:

x11-wm/pekwm-0.4.4

Description

Lightweight window manager initially based on aewm++

Added to portage

2026-10-13

pkixssh - 20.0.1
Ebuild name:

net-misc/pkixssh-20.0.1

Description

OpenSSH fork with X.509 v3 certificate support

Added to portage

2026-10-13

pre-commit - 4.7.0
Ebuild name:

dev-vcs/pre-commit-4.7.0

Description

A framework for managing and maintaining multi-language Git pre-commit hoo

Added to portage

2026-10-13

pytest-check - 3.0.1
Ebuild name:

dev-python/pytest-check-3.0.1

Description

pytest plugin that allows multiple failures per test

Added to portage

2026-10-13

radicale - 3.8.3
Ebuild name:

www-apps/radicale-3.8.3

Description

A simple CalDAV calendar server

Added to portage

2026-10-13

ruff - 0.17.0
Ebuild name:

dev-util/ruff-0.17.0

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-10-13

simdjson - 5.0.4
Ebuild name:

dev-libs/simdjson-5.0.4

Description

SIMD accelerated C++ JSON library

Added to portage

2026-10-13

tokenizers - 0.23.3
Ebuild name:

sci-ml/tokenizers-0.23.3

Description

Implementation of today's most used tokenizers

Added to portage

2026-10-13

tomcat - 10.1.61
Ebuild name:

www-servers/tomcat-10.1.61

Description

Tomcat Servlet-6.0/JSP-3.1/EL-5.0/WebSocket-2.1/JASPIC-3.0 Container

Added to portage

2026-10-13

tomcat - 11.0.27
Ebuild name:

www-servers/tomcat-11.0.27

Description

Tomcat Servlet-6.1/JSP-4.0/EL-6.0/WebSocket-2.2/JASPIC-3.1 Container

Added to portage

2026-10-13

tomcat - 9.0.123
Ebuild name:

www-servers/tomcat-9.0.123

Description

Tomcat Servlet-4.0/JSP-2.3/EL-3.0/WebSocket-1.1/JASPIC-1.1 Container

Added to portage

2026-10-13

tree-sitter-erlang - 0.21.0
Ebuild name:

dev-libs/tree-sitter-erlang-0.21.0

Description

Erlang programming language grammar for Tree-sitter

Added to portage

2026-10-13

truststore - 0.10.5
Ebuild name:

dev-python/truststore-0.10.5

Description

Verify certificates using native system trust stores

Added to portage

2026-10-13

wsjtx_improved - 3.2.0_p20260908
Ebuild name:

media-radio/wsjtx_improved-3.2.0_p20260908

Description

Weak signal ham radio communication with improvements

Added to portage

2026-10-13

yq - 4.4.5
Ebuild name:

app-misc/yq-4.4.5

Description

Command-line YAML processor - jq wrapper for YAML documents

Added to portage

2026-10-13

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