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:

87512

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-08-08
dist-kernel - 6.1.182
Ebuild name:

virtual/dist-kernel-6.1.182

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-08-08

dist-kernel - 6.12.102
Ebuild name:

virtual/dist-kernel-6.12.102

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-08-08

dist-kernel - 6.6.150
Ebuild name:

virtual/dist-kernel-6.6.150

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-08-08

dropbox - 264.4.3385
Ebuild name:

net-misc/dropbox-264.4.3385

Description

Dropbox daemon (pretends to be GUI-less)

Added to portage

2026-08-08

gentoo-kernel - 6.1.182
Ebuild name:

sys-kernel/gentoo-kernel-6.1.182

Description

Linux kernel built with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel - 6.12.102
Ebuild name:

sys-kernel/gentoo-kernel-6.12.102

Description

Linux kernel built with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel - 6.6.150
Ebuild name:

sys-kernel/gentoo-kernel-6.6.150

Description

Linux kernel built with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel-bin - 6.1.182
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.182

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel-bin - 6.12.102
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.102

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel-bin - 6.6.150
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.6.150

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-08-08

gentoo-kernel-modprep - 6.1.182
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.1.182

Description

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

Added to portage

2026-08-08

gentoo-kernel-modprep - 6.12.102
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.12.102

Description

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

Added to portage

2026-08-08

gentoo-kernel-modprep - 6.6.150
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.6.150

Description

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

Added to portage

2026-08-08

openhab-bin - 5.2.1
Ebuild name:

app-misc/openhab-bin-5.2.1

Description

An open-source automation software for your home

Added to portage

2026-08-08

tesseract - 5.5.3
Ebuild name:

app-text/tesseract-5.5.3

Description

An OCR Engine, originally developed at HP, now open source

Added to portage

2026-08-08

vanilla-kernel - 6.1.182
Ebuild name:

sys-kernel/vanilla-kernel-6.1.182

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-08-08

vanilla-kernel - 6.12.102
Ebuild name:

sys-kernel/vanilla-kernel-6.12.102

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-08-08

vanilla-kernel - 6.6.150
Ebuild name:

sys-kernel/vanilla-kernel-6.6.150

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-08-08

2026-08-07
aardvark-dns - 2.1.0
Ebuild name:

app-containers/aardvark-dns-2.1.0

Description

A container-focused DNS server

Added to portage

2026-08-07

apr-util - 1.6.4
Ebuild name:

dev-libs/apr-util-1.6.4

Description

Apache Portable Runtime Utility Library

Added to portage

2026-08-07

argcomplete - 3.7.2
Ebuild name:

dev-python/argcomplete-3.7.2

Description

Bash tab completion for argparse

Added to portage

2026-08-07

ast-serialize - 0.7.0
Ebuild name:

dev-python/ast-serialize-0.7.0

Description

Python bindings for mypy AST serialization

Added to portage

2026-08-07

awscli-bin - 2.36.17
Ebuild name:

app-admin/awscli-bin-2.36.17

Description

command line interface for Amazon Web Services

Added to portage

2026-08-07

bcachefs-tools - 1.39.0
Ebuild name:

sys-fs/bcachefs-tools-1.39.0

Description

Tools for bcachefs

Added to portage

2026-08-07

boto3 - 1.43.66
Ebuild name:

dev-python/boto3-1.43.66

Description

The AWS SDK for Python

Added to portage

2026-08-07

botocore - 1.43.66
Ebuild name:

dev-python/botocore-1.43.66

Description

Low-level, data-driven core of boto 3

Added to portage

2026-08-07

c-blosc2 - 3.3.2
Ebuild name:

dev-libs/c-blosc2-3.3.2

Description

Blocking, shuffling and lossless compression library

Added to portage

2026-08-07

cadvisor - 0.60.5
Ebuild name:

app-containers/cadvisor-0.60.5

Description

Analyzes resource usage and performance characteristics of running c

Added to portage

2026-08-07

cmd2 - 4.2.0
Ebuild name:

dev-python/cmd2-4.2.0

Description

Extra features for standard library's cmd module

Added to portage

2026-08-07

cosign - 3.1.3
Ebuild name:

app-containers/cosign-3.1.3

Description

container signing utility

Added to portage

2026-08-07

coverage - 7.15.4
Ebuild name:

dev-python/coverage-7.15.4

Description

Code coverage measurement for Python

Added to portage

2026-08-07

discord - 1.0.152
Ebuild name:

net-im/discord-1.0.152

Description

All-in-one voice and text chat for gamers

Added to portage

2026-08-07

dist-kernel - 6.18.43
Ebuild name:

virtual/dist-kernel-6.18.43

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-08-07

dist-kernel - 7.1.7
Ebuild name:

virtual/dist-kernel-7.1.7

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-08-07

docker - 29.7.2
Ebuild name:

app-containers/docker-29.7.2

Description

The core functions you need to create Docker images and run Docker con

Added to portage

2026-08-07

docker-buildx - 0.36.1
Ebuild name:

app-containers/docker-buildx-0.36.1

Description

Docker CLI plugin for extended build capabilities with BuildKit

Added to portage

2026-08-07

docker-cli - 29.7.2
Ebuild name:

app-containers/docker-cli-29.7.2

Description

the command line binary for docker

Added to portage

2026-08-07

docker-compose - 5.4.0
Ebuild name:

app-containers/docker-compose-5.4.0

Description

Multi-container orchestration for Docker

Added to portage

2026-08-07

docker-credential-helpers - 0.9.8
Ebuild name:

app-containers/docker-credential-helpers-0.9.8

Description

Suite of programs to use native stores to keep Docke

Added to portage

2026-08-07

fj-cli - 0.6.0
Ebuild name:

dev-util/fj-cli-0.6.0

Description

CLI tool for Forgejo

Added to portage

2026-08-07

fontconfig - 2.18.3
Ebuild name:

media-libs/fontconfig-2.18.3

Description

A library for configuring and customizing font access

Added to portage

2026-08-07

gcc - 13.4.1_p20260805
Ebuild name:

sys-devel/gcc-13.4.1_p20260805

Description

The GNU Compiler Collection

Added to portage

2026-08-07

gcc - 14.4.1_p20260806
Ebuild name:

sys-devel/gcc-14.4.1_p20260806

Description

The GNU Compiler Collection

Added to portage

2026-08-07

gcc - 16.2.0
Ebuild name:

sys-devel/gcc-16.2.0

Description

The GNU Compiler Collection

Added to portage

2026-08-07

gcc - 16.3.9999
Ebuild name:

sys-devel/gcc-16.3.9999

Description

The GNU Compiler Collection

Added to portage

2026-08-07

gentoo-kernel - 6.18.43
Ebuild name:

sys-kernel/gentoo-kernel-6.18.43

Description

Linux kernel built with Gentoo patches

Added to portage

2026-08-07

gentoo-kernel - 7.1.7
Ebuild name:

sys-kernel/gentoo-kernel-7.1.7

Description

Linux kernel built with Gentoo patches

Added to portage

2026-08-07

gentoo-kernel-bin - 6.18.43
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.43

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-08-07

gentoo-kernel-bin - 7.1.7
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.1.7

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-08-07

gentoo-kernel-modprep - 6.18.43
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.43

Description

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

Added to portage

2026-08-07

gentoo-kernel-modprep - 7.1.7
Ebuild name:

sys-kernel/gentoo-kernel-modprep-7.1.7

Description

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

Added to portage

2026-08-07

gentoo-sources - 6.1.182
Ebuild name:

sys-kernel/gentoo-sources-6.1.182

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-08-07

gentoo-sources - 6.12.102
Ebuild name:

sys-kernel/gentoo-sources-6.12.102

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-08-07

gentoo-sources - 6.18.43
Ebuild name:

sys-kernel/gentoo-sources-6.18.43

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-08-07

gentoo-sources - 6.6.150
Ebuild name:

sys-kernel/gentoo-sources-6.6.150

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-08-07

gentoo-sources - 7.1.7
Ebuild name:

sys-kernel/gentoo-sources-7.1.7

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-08-07

glslang - 1.4.357.0
Ebuild name:

dev-util/glslang-1.4.357.0

Description

Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generat

Added to portage

2026-08-07

google-api-core - 2.34.0
Ebuild name:

dev-python/google-api-core-2.34.0

Description

Core Library for Google Client Libraries

Added to portage

2026-08-07

google-auth - 2.56.3
Ebuild name:

dev-python/google-auth-2.56.3

Description

Google Authentication Library

Added to portage

2026-08-07

google-auth-httplib2 - 0.4.1
Ebuild name:

dev-python/google-auth-httplib2-0.4.1

Description

httplib2 Transport for Google Auth

Added to portage

2026-08-07

googleapis-common-protos - 1.75.1
Ebuild name:

dev-python/googleapis-common-protos-1.75.1

Description

Python classes generated from the common protos in the g

Added to portage

2026-08-07

jj - 0.44.0
Ebuild name:

dev-vcs/jj-0.44.0

Description

Jujutsu - an experimental version control system

Added to portage

2026-08-07

knot-resolver - 5.7.8
Ebuild name:

net-dns/knot-resolver-5.7.8

Description

Scaleable caching DNS resolver

Added to portage

2026-08-07

knot-resolver - 6.4.2
Ebuild name:

net-dns/knot-resolver-6.4.2

Description

Scaleable caching DNS resolver

Added to portage

2026-08-07

librt - 0.14.0
Ebuild name:

dev-python/librt-0.14.0

Description

Mypyc runtime library

Added to portage

2026-08-07

lv - 0.15.0-r1
Ebuild name:

app-emacs/lv-0.15.0-r1

Description

Other echo area

Added to portage

2026-08-07

lyskom-elisp-client - 0.48_p20200226
Ebuild name:

app-emacs/lyskom-elisp-client-0.48_p20200226

Description

Elisp client for the LysKOM conference system

Added to portage

2026-08-07

m-buffer - 0.16.1
Ebuild name:

app-emacs/m-buffer-0.16.1

Description

List Oriented Buffer Operations for Emacs

Added to portage

2026-08-07

macrostep - 0.9.5
Ebuild name:

app-emacs/macrostep-0.9.5

Description

Interactive macro-expander for Emacs

Added to portage

2026-08-07

macrostep-geiser - 0.2.0_p20210717
Ebuild name:

app-emacs/macrostep-geiser-0.2.0_p20210717

Description

Emacs macrostep back-end powered by geiser

Added to portage

2026-08-07

magit - 4.5.0-r1
Ebuild name:

app-emacs/magit-4.5.0-r1

Description

A Git porcelain inside Emacs

Added to portage

2026-08-07

magit - 4.6.0
Ebuild name:

app-emacs/magit-4.6.0

Description

A Git porcelain inside Emacs

Added to portage

2026-08-07

magit - 4.7.0
Ebuild name:

app-emacs/magit-4.7.0

Description

A Git porcelain inside Emacs

Added to portage

2026-08-07

magit - 9999
Ebuild name:

app-emacs/magit-9999

Description

A Git porcelain inside Emacs

Added to portage

2026-08-07

mame - 0.289-r3
Ebuild name:

games-emulation/mame-0.289-r3

Description

Multiple Arcade Machine Emulator

Added to portage

2026-08-07

nbformat - 5.11.0
Ebuild name:

dev-python/nbformat-5.11.0

Description

Reference implementation of the Jupyter Notebook format

Added to portage

2026-08-07

netavark - 2.1.0
Ebuild name:

app-containers/netavark-2.1.0

Description

A container network stack

Added to portage

2026-08-07

nspr - 4.40
Ebuild name:

dev-libs/nspr-4.40

Description

Netscape Portable Runtime

Added to portage

2026-08-07

nvidia-drivers - 595.44.14
Ebuild name:

x11-drivers/nvidia-drivers-595.44.14

Description

NVIDIA Accelerated Graphics Driver

Added to portage

2026-08-07

openpgp-keys-apache-httpd - 20260807
Ebuild name:

sec-keys/openpgp-keys-apache-httpd-20260807

Description

OpenPGP keys used to sign Apache httpd

Added to portage

2026-08-07

pika - 1.4.4
Ebuild name:

dev-python/pika-1.4.4

Description

Pure-Python implementation of the AMQP

Added to portage

2026-08-07

pkgcore - 0.12.37-r1
Ebuild name:

sys-apps/pkgcore-0.12.37-r1

Description

a framework for package management

Added to portage

2026-08-07

proto-plus - 1.28.3
Ebuild name:

dev-python/proto-plus-1.28.3

Description

Beautiful, Pythonic protocol buffers

Added to portage

2026-08-07

pybind11 - 3.1.0
Ebuild name:

dev-python/pybind11-3.1.0

Description

AST-based Python refactoring library

Added to portage

2026-08-07

pypdf - 6.15.0
Ebuild name:

dev-python/pypdf-6.15.0

Description

Python library to work with PDF files

Added to portage

2026-08-07

safetensors - 0.8.0
Ebuild name:

sci-ml/safetensors-0.8.0

Description

Simple, safe way to store and distribute tensors

Added to portage

2026-08-07

shader-slang - 2026.14.1-r2
Ebuild name:

dev-util/shader-slang-2026.14.1-r2

Description

Making it easier to work with shaders

Added to portage

2026-08-07

shaderc - 2026.3
Ebuild name:

media-libs/shaderc-2026.3

Description

Collection of tools, libraries and tests for shader compilation

Added to portage

2026-08-07

soci - 4.1.4
Ebuild name:

dev-db/soci-4.1.4

Description

SOCI - The C++ Database Access Library

Added to portage

2026-08-07

soupsieve - 2.9.2
Ebuild name:

dev-python/soupsieve-2.9.2

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-08-07

spirv-headers - 1.4.357.0
Ebuild name:

dev-util/spirv-headers-1.4.357.0

Description

Machine-readable files for the SPIR-V Registry

Added to portage

2026-08-07

spirv-tools - 1.4.357.0
Ebuild name:

dev-util/spirv-tools-1.4.357.0

Description

Provides an API and commands for processing SPIR-V modules

Added to portage

2026-08-07

transformers - 5.12.1
Ebuild name:

sci-ml/transformers-5.12.1

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2026-08-07

transformers - 5.13.1
Ebuild name:

sci-ml/transformers-5.13.1

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2026-08-07

transformers - 5.14.1
Ebuild name:

sci-ml/transformers-5.14.1

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2026-08-07

vanilla-kernel - 6.18.43
Ebuild name:

sys-kernel/vanilla-kernel-6.18.43

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-08-07

vanilla-kernel - 7.1.7
Ebuild name:

sys-kernel/vanilla-kernel-7.1.7

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-08-07

vanilla-sources - 6.1.182
Ebuild name:

sys-kernel/vanilla-sources-6.1.182

Description

Full sources for the Linux kernel

Added to portage

2026-08-07

vanilla-sources - 6.12.102
Ebuild name:

sys-kernel/vanilla-sources-6.12.102

Description

Full sources for the Linux kernel

Added to portage

2026-08-07

vanilla-sources - 6.18.43
Ebuild name:

sys-kernel/vanilla-sources-6.18.43

Description

Full sources for the Linux kernel

Added to portage

2026-08-07

vanilla-sources - 6.6.150
Ebuild name:

sys-kernel/vanilla-sources-6.6.150

Description

Full sources for the Linux kernel

Added to portage

2026-08-07

vanilla-sources - 7.1.7
Ebuild name:

sys-kernel/vanilla-sources-7.1.7

Description

Full sources for the Linux kernel

Added to portage

2026-08-07

vips - 8.18.5
Ebuild name:

media-libs/vips-8.18.5

Description

VIPS Image Processing Library

Added to portage

2026-08-07

vulkan-headers - 1.4.357.0
Ebuild name:

dev-util/vulkan-headers-1.4.357.0

Description

Vulkan Header files and API registry

Added to portage

2026-08-07

vulkan-layers - 1.4.357.0
Ebuild name:

media-libs/vulkan-layers-1.4.357.0

Description

Vulkan Validation Layers

Added to portage

2026-08-07

vulkan-loader - 1.4.357.0
Ebuild name:

media-libs/vulkan-loader-1.4.357.0

Description

Vulkan Installable Client Driver (ICD) Loader

Added to portage

2026-08-07

vulkan-tools - 1.4.357.0
Ebuild name:

dev-util/vulkan-tools-1.4.357.0

Description

Official Vulkan Tools and Utilities for Windows, Linux, Android, an

Added to portage

2026-08-07

vulkan-utility-libraries - 1.4.357.0
Ebuild name:

dev-util/vulkan-utility-libraries-1.4.357.0

Description

Share code across various Vulkan repositories

Added to portage

2026-08-07

wordpress - 7.0.3
Ebuild name:

www-apps/wordpress-7.0.3

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2026-08-07

wrapt - 2.4.0_rc1
Ebuild name:

dev-python/wrapt-2.4.0_rc1

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-08-07

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