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:

89294

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-18
libzip - 1.12.1
Ebuild name:

dev-libs/libzip-1.12.1

Description

Library for manipulating zip archives

Added to portage

2026-10-18

rocm-core - 10.1.0
Ebuild name:

dev-libs/rocm-core-10.1.0

Description

Library that provides ROCm release version and install path information

Added to portage

2026-10-18

rocm-device-libs - 10.1.0
Ebuild name:

dev-libs/rocm-device-libs-10.1.0

Description

Radeon Open Compute Device Libraries

Added to portage

2026-10-18

roct-thunk-interface - 10.1.0
Ebuild name:

dev-libs/roct-thunk-interface-10.1.0

Description

Radeon Open Compute Thunk Interface

Added to portage

2026-10-18

sddm - 0.21.0_p20260819-r1
Ebuild name:

x11-misc/sddm-0.21.0_p20260819-r1

Description

Simple Desktop Display Manager

Added to portage

2026-10-18

2026-10-17
aioquic - 1.7.0
Ebuild name:

dev-python/aioquic-1.7.0

Description

An implementation of QUIC and HTTP/3

Added to portage

2026-10-17

alephone-durandal - 20260930-r1
Ebuild name:

games-fps/alephone-durandal-20260930-r1

Description

Aleph One - Marathon 2 (Durandal)

Added to portage

2026-10-17

alephone-infinity - 20260930-r1
Ebuild name:

games-fps/alephone-infinity-20260930-r1

Description

Aleph One - Marathon Infinity

Added to portage

2026-10-17

alephone-marathon - 20260930-r1
Ebuild name:

games-fps/alephone-marathon-20260930-r1

Description

Aleph One - Marathon (M1A1)

Added to portage

2026-10-17

ast-serialize - 0.13.1
Ebuild name:

dev-python/ast-serialize-0.13.1

Description

Python bindings for mypy AST serialization

Added to portage

2026-10-17

aws-crt-cpp - 0.44.0
Ebuild name:

dev-cpp/aws-crt-cpp-0.44.0

Description

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

Added to portage

2026-10-17

awscrt - 0.38.0
Ebuild name:

dev-python/awscrt-0.38.0

Description

A common runtime for AWS Python projects

Added to portage

2026-10-17

berkeleydb - 18.1.16
Ebuild name:

dev-python/berkeleydb-18.1.16

Description

Python bindings for Oracle Berkeley DB

Added to portage

2026-10-17

btrfs-assistant - 3.0.0
Ebuild name:

app-admin/btrfs-assistant-3.0.0

Description

GUI management tool to make managing a Btrfs filesystem easier

Added to portage

2026-10-17

claude-code - 2.1.301
Ebuild name:

dev-util/claude-code-2.1.301

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-10-17

cli-helpers - 2.15.2
Ebuild name:

dev-python/cli-helpers-2.15.2

Description

Python helpers for common CLI tasks

Added to portage

2026-10-17

cnijfilter2 - 6.90
Ebuild name:

net-print/cnijfilter2-6.90

Description

IJ Printer Driver

Added to portage

2026-10-17

createrepo_c - 1.2.5
Ebuild name:

app-arch/createrepo_c-1.2.5

Description

C implementation of createrepo

Added to portage

2026-10-17

darktable - 5.6.2
Ebuild name:

media-gfx/darktable-5.6.2

Description

A virtual lighttable and darkroom for photographers

Added to portage

2026-10-17

distlib - 0.4.4
Ebuild name:

dev-python/distlib-0.4.4

Description

Low-level components of distutils2/packaging

Added to portage

2026-10-17

django-otp - 1.7.5
Ebuild name:

dev-python/django-otp-1.7.5

Description

Django framework adding two-factor authentication using one-time passwo

Added to portage

2026-10-17

elasticsearch - 9.5.5
Ebuild name:

app-misc/elasticsearch-9.5.5

Description

Free and Open, Distributed, RESTful Search Engine

Added to portage

2026-10-17

fastapi - 0.143.3
Ebuild name:

dev-python/fastapi-0.143.3

Description

High performance framework, easy to learn, fast to code, ready for produ

Added to portage

2026-10-17

ggml - 0.27.0
Ebuild name:

sci-ml/ggml-0.27.0

Description

Tensor library for machine learning

Added to portage

2026-10-17

graphviz-dot-mode - 0.4_p20181118
Ebuild name:

app-emacs/graphviz-dot-mode-0.4_p20181118

Description

Emacs mode for editing and previewing Graphviz dot graphs

Added to portage

2026-10-17

graphviz-dot-mode - 0.5.0
Ebuild name:

app-emacs/graphviz-dot-mode-0.5.0

Description

Emacs mode for editing and previewing Graphviz dot graphs

Added to portage

2026-10-17

groovy-emacs-modes - 2.1
Ebuild name:

app-emacs/groovy-emacs-modes-2.1

Description

Groovy major mode, grails minor mode, and a groovy inferior mode

Added to portage

2026-10-17

hypothesis - 6.170.1
Ebuild name:

dev-python/hypothesis-6.170.1

Description

A library for property based testing

Added to portage

2026-10-17

incus - 7.0.2
Ebuild name:

app-containers/incus-7.0.2

Description

Modern, secure and powerful system container and virtual machine manager

Added to portage

2026-10-17

jellyfin-bin - 12.2-r1
Ebuild name:

www-apps/jellyfin-bin-12.2-r1

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2026-10-17

jsonpath-ng - 1.11.0
Ebuild name:

dev-python/jsonpath-ng-1.11.0

Description

Python JSONPath Next-Generation

Added to portage

2026-10-17

kde-cli-tools - 6.8.0-r1
Ebuild name:

kde-plasma/kde-cli-tools-6.8.0-r1

Description

Tools based on KDE Frameworks 6 to better interact with the syste

Added to portage

2026-10-17

libmodulemd - 2.15.3
Ebuild name:

sys-libs/libmodulemd-2.15.3

Description

C Library for manipulating Fedora Modularity metadata files

Added to portage

2026-10-17

mkl - 2026.2.0.881
Ebuild name:

sci-libs/mkl-2026.2.0.881

Description

Intel Math Kernel Library

Added to portage

2026-10-17

mu - 1.14.4-r1
Ebuild name:

net-mail/mu-1.14.4-r1

Description

Set of tools to deal with Maildirs, in particular, searching and indexing

Added to portage

2026-10-17

mumps - 5.8.2
Ebuild name:

sci-libs/mumps-5.8.2

Description

MUltifrontal Massively Parallel sparse direct matrix Solver

Added to portage

2026-10-17

ncspot - 1.5.0
Ebuild name:

media-sound/ncspot-1.5.0

Description

ncurses Spotify client written in Rust using librespot

Added to portage

2026-10-17

nrpe - 4.1.3
Ebuild name:

net-analyzer/nrpe-4.1.3

Description

Nagios Remote Plugin Executor

Added to portage

2026-10-17

objgraph - 3.7.0
Ebuild name:

dev-python/objgraph-3.7.0

Description

Draws Python object reference graphs with graphviz

Added to portage

2026-10-17

ollama - 0.40.5
Ebuild name:

sci-ml/ollama-0.40.5

Description

Get up and running with Llama 3, Mistral, Gemma, and other language models

Added to portage

2026-10-17

openntpd - 7.9_p1-r1
Ebuild name:

net-misc/openntpd-7.9_p1-r1

Description

Lightweight NTP server ported from OpenBSD

Added to portage

2026-10-17

pecl-memcached - 3.4.0-r1
Ebuild name:

dev-php/pecl-memcached-3.4.0-r1

Description

Interface PHP with memcached via libmemcached library

Added to portage

2026-10-17

pillow - 13.0.0
Ebuild name:

dev-python/pillow-13.0.0

Description

Python Imaging Library (fork)

Added to portage

2026-10-17

pkgcore - 0.12.47
Ebuild name:

sys-apps/pkgcore-0.12.47

Description

a framework for package management

Added to portage

2026-10-17

pkginfo - 1.13.3
Ebuild name:

dev-python/pkginfo-1.13.3

Description

Provides an API for querying the distutils metadata written in a PKG-INFO

Added to portage

2026-10-17

platformio - 6.2.0-r1
Ebuild name:

dev-embedded/platformio-6.2.0-r1

Description

An open source ecosystem for IoT development

Added to portage

2026-10-17

portalocker - 4.4.1
Ebuild name:

dev-python/portalocker-4.4.1

Description

A library for Python file locking

Added to portage

2026-10-17

pyqt-builder - 1.20.1
Ebuild name:

dev-python/pyqt-builder-1.20.1

Description

The PEP 517 compliant PyQt build system

Added to portage

2026-10-17

rocm-cmake - 10.1.0
Ebuild name:

dev-build/rocm-cmake-10.1.0

Description

Radeon Open Compute CMake Modules

Added to portage

2026-10-17

s2n-tls - 1.7.12
Ebuild name:

dev-libs/s2n-tls-1.7.12

Description

s2n-tls is a C99 implementation of the TLS/SSL protocols

Added to portage

2026-10-17

sdl3-image - 3.4.8
Ebuild name:

media-libs/sdl3-image-3.4.8

Description

A simple library to load images of various formats as SDL surfaces

Added to portage

2026-10-17

sphinx-autodoc-typehints - 3.17.1
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.17.1

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-10-17

spidermonkey - 140.17.0
Ebuild name:

dev-lang/spidermonkey-140.17.0

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-10-17

spidermonkey - 153.5.0
Ebuild name:

dev-lang/spidermonkey-153.5.0

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-10-17

sqlalchemy - 2.0.55
Ebuild name:

dev-python/sqlalchemy-2.0.55

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-10-17

sqlalchemy - 2.1.5
Ebuild name:

dev-python/sqlalchemy-2.1.5

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-10-17

ssh-audit - 3.9.0_p20261011
Ebuild name:

net-analyzer/ssh-audit-3.9.0_p20261011

Description

SSH server auditing (banner, key exchange, encryption, mac,

Added to portage

2026-10-17

superqt - 0.9.0
Ebuild name:

dev-python/superqt-0.9.0

Description

Missing widgets and components for PyQt/PySide

Added to portage

2026-10-17

union - 6.8.0-r1
Ebuild name:

kde-plasma/union-6.8.0-r1

Description

Style engine providing a unified style description to separate output sty

Added to portage

2026-10-17

wine-vanilla - 11.20
Ebuild name:

app-emulation/wine-vanilla-11.20

Description

Free implementation of Windows(tm) on Unix, without external patch

Added to portage

2026-10-17

zchunk - 1.5.4
Ebuild name:

app-arch/zchunk-1.5.4

Description

File format designed for highly efficient deltas with good compression

Added to portage

2026-10-17

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