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:

85298

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-05-23
2026-05-22
aurorae - 6.6.5-r1
Ebuild name:

kde-plasma/aurorae-6.6.5-r1

Description

Themeable window decoration for KWin

Added to portage

2026-05-22

awscli - 1.45.13
Ebuild name:

app-admin/awscli-1.45.13

Description

Universal Command Line Environment for AWS

Added to portage

2026-05-22

boto3 - 1.43.13
Ebuild name:

dev-python/boto3-1.43.13

Description

The AWS SDK for Python

Added to portage

2026-05-22

botocore - 1.43.13
Ebuild name:

dev-python/botocore-1.43.13

Description

Low-level, data-driven core of boto 3

Added to portage

2026-05-22

cachetools - 7.1.4
Ebuild name:

dev-python/cachetools-7.1.4

Description

Extensible memoizing collections and decorators

Added to portage

2026-05-22

cfn-lint - 1.51.1
Ebuild name:

dev-python/cfn-lint-1.51.1

Description

CloudFormation Linter

Added to portage

2026-05-22

cmake - 4.3.3
Ebuild name:

dev-build/cmake-4.3.3

Description

Cross platform Make

Added to portage

2026-05-22

directx-headers - 1.619.1
Ebuild name:

dev-util/directx-headers-1.619.1

Description

DirectX header files and WSL stubs

Added to portage

2026-05-22

discover - 6.6.5-r1
Ebuild name:

kde-plasma/discover-6.6.5-r1

Description

KDE Plasma resources management GUI

Added to portage

2026-05-22

dist-kernel - 6.1.173_p3
Ebuild name:

virtual/dist-kernel-6.1.173_p3

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-22

dist-kernel - 6.12.90_p2
Ebuild name:

virtual/dist-kernel-6.12.90_p2

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-22

dist-kernel - 6.18.32_p2
Ebuild name:

virtual/dist-kernel-6.18.32_p2

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-22

dist-kernel - 6.6.140_p2
Ebuild name:

virtual/dist-kernel-6.6.140_p2

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-22

dist-kernel - 7.0.9_p2
Ebuild name:

virtual/dist-kernel-7.0.9_p2

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-22

dssp - 4.6.1
Ebuild name:

sci-chemistry/dssp-4.6.1

Description

The protein secondary structure standard

Added to portage

2026-05-22

dulwich - 1.2.4
Ebuild name:

dev-python/dulwich-1.2.4

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2026-05-22

firefox - 151.0.1
Ebuild name:

www-client/firefox-151.0.1

Description

Firefox Web Browser

Added to portage

2026-05-22

firefox-bin - 140.11.0
Ebuild name:

www-client/firefox-bin-140.11.0

Description

Firefox Web Browser

Added to portage

2026-05-22

firefox-bin - 151.0.1
Ebuild name:

www-client/firefox-bin-151.0.1

Description

Firefox Web Browser

Added to portage

2026-05-22

firefox-l10n - 151.0.1
Ebuild name:

www-client/firefox-l10n-151.0.1

Description

Firefox Web Browser's translation files

Added to portage

2026-05-22

gentoo-kernel - 6.1.173_p3
Ebuild name:

sys-kernel/gentoo-kernel-6.1.173_p3

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel - 6.12.90_p2
Ebuild name:

sys-kernel/gentoo-kernel-6.12.90_p2

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel - 6.18.32_p2
Ebuild name:

sys-kernel/gentoo-kernel-6.18.32_p2

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel - 6.6.140_p2
Ebuild name:

sys-kernel/gentoo-kernel-6.6.140_p2

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel - 7.0.9_p2
Ebuild name:

sys-kernel/gentoo-kernel-7.0.9_p2

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel-bin - 6.1.173_p3
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.173_p3

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel-bin - 6.12.90_p2
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.90_p2

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel-bin - 6.18.32_p2
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.32_p2

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel-bin - 6.6.140_p2
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.6.140_p2

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-22

gentoo-kernel-bin - 7.0.9_p2
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.0.9_p2

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-22

gentoo-sources - 6.1.173-r3
Ebuild name:

sys-kernel/gentoo-sources-6.1.173-r3

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-22

gentoo-sources - 6.12.90-r3
Ebuild name:

sys-kernel/gentoo-sources-6.12.90-r3

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-22

gentoo-sources - 6.18.32-r3
Ebuild name:

sys-kernel/gentoo-sources-6.18.32-r3

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-22

gentoo-sources - 6.6.140-r3
Ebuild name:

sys-kernel/gentoo-sources-6.6.140-r3

Description

Full sources including the Gentoo patchset for the . kernel tr

Added to portage

2026-05-22

gentoo-sources - 7.0.9-r4
Ebuild name:

sys-kernel/gentoo-sources-7.0.9-r4

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-22

gr-scopy - 0.0_p20220602-r2
Ebuild name:

net-wireless/gr-scopy-0.0_p20220602-r2

Description

Scopy IIO blocks for GNU Radio

Added to portage

2026-05-22

idna - 3.16
Ebuild name:

dev-python/idna-3.16

Description

Internationalized Domain Names in Applications (IDNA)

Added to portage

2026-05-22

intune-portal - 1.2604.19
Ebuild name:

sys-apps/intune-portal-1.2604.19

Description

Microsoft Intune Company Portal to access a corporate environment

Added to portage

2026-05-22

kirigami-addons - 1.12.1
Ebuild name:

dev-libs/kirigami-addons-1.12.1

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-05-22

krita - 6.0.2_pre20260521
Ebuild name:

media-gfx/krita-6.0.2_pre20260521

Description

Free digital painting application. Digital Painting, Creative Fre

Added to portage

2026-05-22

kwin - 6.6.5-r1
Ebuild name:

kde-plasma/kwin-6.6.5-r1

Description

Flexible, composited Window Manager for windowing systems on Linux

Added to portage

2026-05-22

libXi - 1.8.3
Ebuild name:

x11-libs/libXi-1.8.3

Description

X.Org Xi library

Added to portage

2026-05-22

libcifpp - 10.0.4
Ebuild name:

sci-libs/libcifpp-10.0.4

Description

Code to work with mmCIF and PDB files

Added to portage

2026-05-22

libplasma - 6.6.5-r1
Ebuild name:

kde-plasma/libplasma-6.6.5-r1

Description

Plasma library and runtime components based upon KF6 and Qt6

Added to portage

2026-05-22

mesa - 26.1.1
Ebuild name:

media-libs/mesa-26.1.1

Description

OpenGL-like graphic library for Linux

Added to portage

2026-05-22

mesa_clc - 26.1.1
Ebuild name:

dev-util/mesa_clc-26.1.1

Description

mesa_clc tool used for building OpenCL C to SPIR-V

Added to portage

2026-05-22

mlt - 7.38.0
Ebuild name:

media-libs/mlt-7.38.0

Description

Open source multimedia framework for television broadcasting

Added to portage

2026-05-22

multiple-cursors - 1.5.0
Ebuild name:

app-emacs/multiple-cursors-1.5.0

Description

Multiple cursors for Emacs

Added to portage

2026-05-22

oneDNN - 3.11.2
Ebuild name:

sci-ml/oneDNN-3.11.2

Description

oneAPI Deep Neural Network Library

Added to portage

2026-05-22

onlyoffice-bin - 9.4.0
Ebuild name:

app-office/onlyoffice-bin-9.4.0

Description

A free and open source office and productivity suite (binary versio

Added to portage

2026-05-22

opentelemetry-api - 1.42.1
Ebuild name:

dev-python/opentelemetry-api-1.42.1

Description

OpenTelemetry Python API

Added to portage

2026-05-22

opentelemetry-sdk - 1.42.1
Ebuild name:

dev-python/opentelemetry-sdk-1.42.1

Description

OpenTelemetry Python SDK

Added to portage

2026-05-22

opentelemetry-semantic-conventions - 1.42.1
Ebuild name:

dev-python/opentelemetry-semantic-conventions-1.42.1

Description

OpenTelemetry Semantic Conventions

Added to portage

2026-05-22

oxygen-icons - 6.2.0
Ebuild name:

kde-frameworks/oxygen-icons-6.2.0

Description

Oxygen SVG icon theme

Added to portage

2026-05-22

pdm - 2.27.0
Ebuild name:

dev-python/pdm-2.27.0

Description

Python package and dependency manager supporting the latest PEP standards

Added to portage

2026-05-22

pikepdf - 10.7.1
Ebuild name:

dev-python/pikepdf-10.7.1

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-05-22

plasma-desktop - 6.6.5-r1
Ebuild name:

kde-plasma/plasma-desktop-6.6.5-r1

Description

KDE Plasma desktop

Added to portage

2026-05-22

plasma-workspace - 6.6.5-r1
Ebuild name:

kde-plasma/plasma-workspace-6.6.5-r1

Description

KDE Plasma workspace

Added to portage

2026-05-22

pyjwt - 2.13.0
Ebuild name:

dev-python/pyjwt-2.13.0

Description

JSON Web Token implementation in Python

Added to portage

2026-05-22

pypdf - 6.12.0
Ebuild name:

dev-python/pypdf-6.12.0

Description

Python library to work with PDF files

Added to portage

2026-05-22

pytest-socket - 0.8.0
Ebuild name:

dev-python/pytest-socket-0.8.0

Description

Pytest Plugin to disable socket calls during tests

Added to portage

2026-05-22

python-engineio - 4.13.2
Ebuild name:

dev-python/python-engineio-4.13.2

Description

Python implementation of the Engine.IO realtime server

Added to portage

2026-05-22

qdmr - 0.15.0
Ebuild name:

net-wireless/qdmr-0.15.0

Description

GUI application for configuring and programming cheap DMR radios

Added to portage

2026-05-22

quassel - 0.14.50_pre20260521
Ebuild name:

net-irc/quassel-0.14.50_pre20260521

Description

Qt/KDE IRC client supporting a remote daemon for 24/7 connectiv

Added to portage

2026-05-22

responses - 0.26.1
Ebuild name:

dev-python/responses-0.26.1

Description

Utility for mocking out the Python Requests library

Added to portage

2026-05-22

sanlock - 3.8.5-r2
Ebuild name:

sys-cluster/sanlock-3.8.5-r2

Description

shared storage lock manager

Added to portage

2026-05-22

sanlock - 4.2.0-r1
Ebuild name:

sys-cluster/sanlock-4.2.0-r1

Description

shared storage lock manager

Added to portage

2026-05-22

sanlock - 5.1.0
Ebuild name:

sys-cluster/sanlock-5.1.0

Description

shared storage lock manager

Added to portage

2026-05-22

srs - 6.0.184
Ebuild name:

media-video/srs-6.0.184

Description

Simple Realtime media Server

Added to portage

2026-05-22

starlette - 1.0.1
Ebuild name:

dev-python/starlette-1.0.1

Description

The little ASGI framework that shines

Added to portage

2026-05-22

thunderbird-bin - 140.11.0
Ebuild name:

mail-client/thunderbird-bin-140.11.0

Description

Thunderbird Mail Client

Added to portage

2026-05-22

thunderbird-bin - 151.0
Ebuild name:

mail-client/thunderbird-bin-151.0

Description

Thunderbird Mail Client

Added to portage

2026-05-22

uv - 0.11.16
Ebuild name:

dev-python/uv-0.11.16

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-05-22

uv-build - 0.11.16
Ebuild name:

dev-python/uv-build-0.11.16

Description

PEP517 uv build backend

Added to portage

2026-05-22

vanilla-kernel - 7.0.7
Ebuild name:

sys-kernel/vanilla-kernel-7.0.7

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-22

vector - 1.8.1
Ebuild name:

dev-python/vector-1.8.1

Description

Vector classes and utilities

Added to portage

2026-05-22

wrapt - 2.2.0
Ebuild name:

dev-python/wrapt-2.2.0

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-05-22

xdg-desktop-portal-kde - 6.6.5-r1
Ebuild name:

kde-plasma/xdg-desktop-portal-kde-6.6.5-r1

Description

Backend implementation for xdg-desktop-portal that is us

Added to portage

2026-05-22

xev - 1.2.7
Ebuild name:

x11-apps/xev-1.2.7

Description

Print contents of X events

Added to portage

2026-05-22

zeroconf - 0.149.16
Ebuild name:

dev-python/zeroconf-0.149.16

Description

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

Added to portage

2026-05-22

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