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:

89133

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-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

closure-compiler-bin - 20261005
Ebuild name:

dev-lang/closure-compiler-bin-20261005

Description

JavaScript optimizing compiler

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

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

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

johntheripper-jumbo - 9999
Ebuild name:

app-crypt/johntheripper-jumbo-9999

Description

Fast password cracker, community enhanced version

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

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

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

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

2026-10-12
aioquic - 1.5.0
Ebuild name:

dev-python/aioquic-1.5.0

Description

An implementation of QUIC and HTTP/3

Added to portage

2026-10-12

ansible-compat - 26.10.0
Ebuild name:

dev-python/ansible-compat-26.10.0

Description

Contains functions that facilitate working with various versions

Added to portage

2026-10-12

aws-sdk-cpp - 1.11.909
Ebuild name:

dev-cpp/aws-sdk-cpp-1.11.909

Description

AWS SDK for C++

Added to portage

2026-10-12

beartype - 0.23.1
Ebuild name:

dev-python/beartype-0.23.1

Description

Unbearably fast runtime type checking in pure Python

Added to portage

2026-10-12

bitarray - 3.12.1
Ebuild name:

dev-python/bitarray-3.12.1

Description

Efficient arrays of booleans -- C extension

Added to portage

2026-10-12

bracex - 3.1
Ebuild name:

dev-python/bracex-3.1

Description

Bash style brace expansion for Python

Added to portage

2026-10-12

btrfs-assistant - 2.3.2
Ebuild name:

app-admin/btrfs-assistant-2.3.2

Description

GUI management tool to make managing a Btrfs filesystem easier

Added to portage

2026-10-12

cen64-jg - 0.4.1
Ebuild name:

games-emulation/cen64-jg-0.4.1

Description

Jolly Good fork of CEN64

Added to portage

2026-10-12

cen64-jg - 9999
Ebuild name:

games-emulation/cen64-jg-9999

Description

Jolly Good fork of CEN64

Added to portage

2026-10-12

dealii - 9.7.1-r1
Ebuild name:

sci-libs/dealii-9.7.1-r1

Description

Solving partial differential equations with the finite element method

Added to portage

2026-10-12

dealii - 9.8.0-r1
Ebuild name:

sci-libs/dealii-9.8.0-r1

Description

Solving partial differential equations with the finite element method

Added to portage

2026-10-12

dist-kernel - 6.18.56
Ebuild name:

virtual/dist-kernel-6.18.56

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-10-12

dist-kernel - 7.2.10
Ebuild name:

virtual/dist-kernel-7.2.10

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-10-12

docker - 29.9.0
Ebuild name:

app-containers/docker-29.9.0

Description

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

Added to portage

2026-10-12

docker-cli - 29.9.0
Ebuild name:

app-containers/docker-cli-29.9.0

Description

the command line binary for docker

Added to portage

2026-10-12

doxygen - 1.17.0-r1
Ebuild name:

app-text/doxygen-1.17.0-r1

Description

Documentation system for most programming languages

Added to portage

2026-10-12

doxygen - 1.18.0-r1
Ebuild name:

app-text/doxygen-1.18.0-r1

Description

Documentation system for most programming languages

Added to portage

2026-10-12

duckdb - 1.5.6
Ebuild name:

dev-db/duckdb-1.5.6

Description

high-performance analytical database system

Added to portage

2026-10-12

filelock - 4.1.1
Ebuild name:

dev-python/filelock-4.1.1

Description

A platform independent file lock for Python

Added to portage

2026-10-12

firefox-bin - 158.0
Ebuild name:

www-client/firefox-bin-158.0

Description

Firefox Web Browser

Added to portage

2026-10-12

gcc - 14.4.1_p20261008
Ebuild name:

sys-devel/gcc-14.4.1_p20261008

Description

The GNU Compiler Collection

Added to portage

2026-10-12

gcc - 15.3.1_p20261009
Ebuild name:

sys-devel/gcc-15.3.1_p20261009

Description

The GNU Compiler Collection

Added to portage

2026-10-12

gcc - 16.2.1_p20261010
Ebuild name:

sys-devel/gcc-16.2.1_p20261010

Description

The GNU Compiler Collection

Added to portage

2026-10-12

gcc - 17.0.0_p20261011
Ebuild name:

sys-devel/gcc-17.0.0_p20261011

Description

The GNU Compiler Collection

Added to portage

2026-10-12

gentoo-kernel - 6.18.56
Ebuild name:

sys-kernel/gentoo-kernel-6.18.56

Description

Linux kernel built with Gentoo patches

Added to portage

2026-10-12

gentoo-kernel - 7.2.10
Ebuild name:

sys-kernel/gentoo-kernel-7.2.10

Description

Linux kernel built with Gentoo patches

Added to portage

2026-10-12

gentoo-kernel-bin - 6.18.56
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.56

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-10-12

gentoo-kernel-bin - 7.2.10
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.2.10

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-10-12

gentoo-kernel-modprep - 6.18.56
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.56

Description

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

Added to portage

2026-10-12

gentoo-kernel-modprep - 7.2.10
Ebuild name:

sys-kernel/gentoo-kernel-modprep-7.2.10

Description

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

Added to portage

2026-10-12

git-sources - 7.3_rc7
Ebuild name:

sys-kernel/git-sources-7.3_rc7

Description

The very latest -git version of the Linux kernel

Added to portage

2026-10-12

go - 1.26.9
Ebuild name:

dev-lang/go-1.26.9

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2026-10-12

go - 1.27.2
Ebuild name:

dev-lang/go-1.27.2

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2026-10-12

haskell-mode - 17.5_p20260206
Ebuild name:

app-emacs/haskell-mode-17.5_p20260206

Description

Mode for editing (and running) Haskell programs in Emacs

Added to portage

2026-10-12

hypothesis - 6.169.0
Ebuild name:

dev-python/hypothesis-6.169.0

Description

A library for property based testing

Added to portage

2026-10-12

inline-snapshot - 0.36.1
Ebuild name:

dev-python/inline-snapshot-0.36.1

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-10-12

jacksum - 4.0.2
Ebuild name:

app-crypt/jacksum-4.0.2

Description

Java utility for working with checksums, CRCs, and message digests (hashes)

Added to portage

2026-10-12

jgemu - 1.0.0-r2
Ebuild name:

games-emulation/jgemu-1.0.0-r2

Description

Meta ebuild for the Jolly Good API

Added to portage

2026-10-12

jna - 5.19.1
Ebuild name:

dev-java/jna-5.19.1

Description

Java Native Access

Added to portage

2026-10-12

jsonpath-ng - 1.10.1
Ebuild name:

dev-python/jsonpath-ng-1.10.1

Description

Python JSONPath Next-Generation

Added to portage

2026-10-12

keystoneauth1 - 5.18.1
Ebuild name:

dev-python/keystoneauth1-5.18.1

Description

This package contains tools for authenticating to an OpenStack-base

Added to portage

2026-10-12

libhubbub - 9999
Ebuild name:

net-libs/libhubbub-9999

Description

HTML5 compliant parsing library, written in C

Added to portage

2026-10-12

libnsbmp - 9999
Ebuild name:

media-libs/libnsbmp-9999

Description

Decoding library for BMP and ICO image file formats, written in C

Added to portage

2026-10-12

libnsfb - 9999
Ebuild name:

dev-libs/libnsfb-9999

Description

C library for framebuffer abstraction

Added to portage

2026-10-12

libnspsl - 9999
Ebuild name:

media-libs/libnspsl-9999

Description

Public Suffix List (PSL) for the NetSurf browser

Added to portage

2026-10-12

libparserutils - 9999
Ebuild name:

dev-libs/libparserutils-9999

Description

C library for building efficient parsers

Added to portage

2026-10-12

librosprite - 9999
Ebuild name:

media-libs/librosprite-9999

Description

Framebuffer abstraction library, written in C

Added to portage

2026-10-12

libwapcaplet - 9999
Ebuild name:

dev-libs/libwapcaplet-9999

Description

string internment library, written in C

Added to portage

2026-10-12

libxmp - 4.7.4
Ebuild name:

media-libs/libxmp-4.7.4

Description

Library that renders module files to PCM data

Added to portage

2026-10-12

lollypop - 1.4.48
Ebuild name:

media-sound/lollypop-1.4.48

Description

Modern music player for GNOME

Added to portage

2026-10-12

ls-qpack - 2.6.4
Ebuild name:

dev-libs/ls-qpack-2.6.4

Description

QPACK compression library for use with HTTP/3

Added to portage

2026-10-12

ls-qpack - 2.7.0
Ebuild name:

dev-libs/ls-qpack-2.7.0

Description

QPACK compression library for use with HTTP/3

Added to portage

2026-10-12

moto - 5.2.4
Ebuild name:

dev-python/moto-5.2.4

Description

Mock library for boto

Added to portage

2026-10-12

mumps - 5.6.2-r1
Ebuild name:

sci-libs/mumps-5.6.2-r1

Description

MUltifrontal Massively Parallel sparse direct matrix Solver

Added to portage

2026-10-12

nbconvert - 7.17.2
Ebuild name:

dev-python/nbconvert-7.17.2

Description

Converting Jupyter Notebooks

Added to portage

2026-10-12

netsurf-buildsystem - 9999
Ebuild name:

dev-build/netsurf-buildsystem-9999

Description

Build system used for netsurf and its libraries

Added to portage

2026-10-12

nsgenbind - 9999
Ebuild name:

dev-libs/nsgenbind-9999

Description

Generate Javascript-to-DOM bindings from w3c webidl files

Added to portage

2026-10-12

paraview - 6.2.0
Ebuild name:

sci-visualization/paraview-6.2.0

Description

Powerful scientific data visualization application

Added to portage

2026-10-12

patiencediff - 1.0.0
Ebuild name:

dev-python/patiencediff-1.0.0

Description

Python implementation of the patiencediff algorithm

Added to portage

2026-10-12

pikepdf - 10.17.0
Ebuild name:

dev-python/pikepdf-10.17.0

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-10-12

platformdirs - 4.13.0
Ebuild name:

dev-python/platformdirs-4.13.0

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-10-12

ps2eps - 1.70
Ebuild name:

app-text/ps2eps-1.70

Description

Generate Encapsulated Postscript Format files from one-page Postscript documen

Added to portage

2026-10-12

pycryptodome - 3.24.1
Ebuild name:

dev-python/pycryptodome-3.24.1

Description

A self-contained cryptographic library for Python

Added to portage

2026-10-12

pydantic - 2.14.1
Ebuild name:

dev-python/pydantic-2.14.1

Description

Data parsing and validation using Python type hints

Added to portage

2026-10-12

pyglet - 2.1.19
Ebuild name:

dev-python/pyglet-2.1.19

Description

Cross-platform windowing and multimedia library for Python

Added to portage

2026-10-12

pylint - 4.1.3
Ebuild name:

dev-python/pylint-4.1.3

Description

Python code static checker

Added to portage

2026-10-12

pylsqpack - 1.0.0
Ebuild name:

dev-python/pylsqpack-1.0.0

Description

Python wrapper for the ls-qpack QPACK library

Added to portage

2026-10-12

pypdf - 6.20.1
Ebuild name:

dev-python/pypdf-6.20.1

Description

Python library to work with PDF files

Added to portage

2026-10-12

pyrfc3339 - 2.1.1
Ebuild name:

dev-python/pyrfc3339-2.1.1

Description

Generates and parses RFC 3339 timestamps

Added to portage

2026-10-12

pyspelling - 2.13
Ebuild name:

dev-python/pyspelling-2.13

Description

Spell checker automation tool

Added to portage

2026-10-12

pytest-check - 3.0.0
Ebuild name:

dev-python/pytest-check-3.0.0

Description

pytest plugin that allows multiple failures per test

Added to portage

2026-10-12

python-utils - 4.1.1
Ebuild name:

dev-python/python-utils-4.1.1

Description

Collection of small Python functions & classes

Added to portage

2026-10-12

pyzstd - 0.20.0
Ebuild name:

dev-python/pyzstd-0.20.0

Description

Support for Zstandard (zstd) compression

Added to portage

2026-10-12

rust - 1.99.0
Ebuild name:

dev-lang/rust-1.99.0

Description

Systems programming language originally developed by Mozilla

Added to portage

2026-10-12

rust-bin - 1.99.0
Ebuild name:

dev-lang/rust-bin-1.99.0

Description

Added to portage

2026-10-12

rust-common - 1.99.0
Ebuild name:

dev-lang/rust-common-1.99.0

Description

Common files shared between multiple slots of Rust

Added to portage

2026-10-12

rust-std - 1.99.0
Ebuild name:

sys-devel/rust-std-1.99.0

Description

Rust standard library, standalone (for crossdev)

Added to portage

2026-10-12

sip - 6.17.1
Ebuild name:

dev-python/sip-6.17.1

Description

Python bindings generator for C/C++ libraries

Added to portage

2026-10-12

soupsieve - 3.0.2
Ebuild name:

dev-python/soupsieve-3.0.2

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-10-12

soupsieve - 3.0.3
Ebuild name:

dev-python/soupsieve-3.0.3

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-10-12

source-highlight - 9999
Ebuild name:

dev-util/source-highlight-9999

Description

Generate highlighted source code as an (x)html document

Added to portage

2026-10-12

texttable - 1.7.1
Ebuild name:

dev-python/texttable-1.7.1

Description

Module to create simple ASCII tables

Added to portage

2026-10-12

tmux - 3.8
Ebuild name:

app-misc/tmux-3.8

Description

Terminal multiplexer

Added to portage

2026-10-12

tox - 4.65.3
Ebuild name:

dev-python/tox-4.65.3

Description

virtualenv-based automation of test activities

Added to portage

2026-10-12

tox - 4.65.4
Ebuild name:

dev-python/tox-4.65.4

Description

virtualenv-based automation of test activities

Added to portage

2026-10-12

tree-sitter - 0.27.1
Ebuild name:

dev-libs/tree-sitter-0.27.1

Description

Tree-sitter is a parser generator tool and an incremental parsing libra

Added to portage

2026-10-12

tree-sitter-cli - 0.27.1
Ebuild name:

dev-util/tree-sitter-cli-0.27.1

Description

Command-line tool for creating and testing tree-sitter grammars

Added to portage

2026-10-12

trilinos - 16.2.2
Ebuild name:

sci-libs/trilinos-16.2.2

Description

Scientific library collection for large scale problems

Added to portage

2026-10-12

trilinos - 17.1.2
Ebuild name:

sci-libs/trilinos-17.1.2

Description

Scientific library collection for large scale problems

Added to portage

2026-10-12

trilinos - 17.2.1
Ebuild name:

sci-libs/trilinos-17.2.1

Description

Scientific library collection for large scale problems

Added to portage

2026-10-12

upterm - 0.37.0
Ebuild name:

app-misc/upterm-0.37.0

Description

Instant Terminal Sharing

Added to portage

2026-10-12

utidylib - 1.1.0
Ebuild name:

dev-python/utidylib-1.1.0

Description

TidyLib Python wrapper

Added to portage

2026-10-12

validators - 0.36.0
Ebuild name:

dev-python/validators-0.36.0

Description

Python Data Validation for Humans

Added to portage

2026-10-12

valkey - 6.2.0
Ebuild name:

dev-python/valkey-6.2.0

Description

Python client for Valkey forked from redis-py

Added to portage

2026-10-12

vanilla-kernel - 6.18.56
Ebuild name:

sys-kernel/vanilla-kernel-6.18.56

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-10-12

vanilla-kernel - 7.2.10
Ebuild name:

sys-kernel/vanilla-kernel-7.2.10

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-10-12

virtualenv - 21.14.7
Ebuild name:

dev-python/virtualenv-21.14.7

Description

Virtual Python Environment builder

Added to portage

2026-10-12

zedis - 0.13.0
Ebuild name:

dev-db/zedis-0.13.0

Description

Blazing-fast native Redis GUI built with Rust and GPUI

Added to portage

2026-10-12

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