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:

88700

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-09-26
astroid - 4.3.2
Ebuild name:

dev-python/astroid-4.3.2

Description

Abstract Syntax Tree for logilab packages

Added to portage

2026-09-26

awscli - 2.37.4
Ebuild name:

app-admin/awscli-2.37.4

Description

Universal Command Line Environment for AWS

Added to portage

2026-09-26

bitwarden-desktop-bin - 2026.9.0
Ebuild name:

app-admin/bitwarden-desktop-bin-2026.9.0

Description

Bitwarden password manager desktop client

Added to portage

2026-09-26

boto3 - 1.43.103
Ebuild name:

dev-python/boto3-1.43.103

Description

The AWS SDK for Python

Added to portage

2026-09-26

botocore - 1.43.103
Ebuild name:

dev-python/botocore-1.43.103

Description

Low-level, data-driven core of boto 3

Added to portage

2026-09-26

crash - 9.0.3
Ebuild name:

dev-util/crash-9.0.3

Description

Red Hat crash utility; used for analyzing kernel core dumps

Added to portage

2026-09-26

dbeaver-bin - 26.2.1
Ebuild name:

dev-db/dbeaver-bin-26.2.1

Description

Free universal database tool (community edition)

Added to portage

2026-09-26

dist-kernel - 6.18.54
Ebuild name:

virtual/dist-kernel-6.18.54

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-09-26

dist-kernel - 7.2.8
Ebuild name:

virtual/dist-kernel-7.2.8

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-09-26

fcitx - 5.1.23
Ebuild name:

app-i18n/fcitx-5.1.23

Description

Fcitx 5 is a generic input method framework

Added to portage

2026-09-26

fcitx-chinese-addons - 5.1.15
Ebuild name:

app-i18n/fcitx-chinese-addons-5.1.15

Description

Addons related to Chinese, including IME previous bundled insi

Added to portage

2026-09-26

fcitx-configtool - 5.1.16
Ebuild name:

app-i18n/fcitx-configtool-5.1.16

Description

Configuration module for Fcitx

Added to portage

2026-09-26

fcitx-qt - 5.1.16
Ebuild name:

app-i18n/fcitx-qt-5.1.16

Description

Qt library and IM module for fcitx5

Added to portage

2026-09-26

feh - 3.13.1
Ebuild name:

media-gfx/feh-3.13.1

Description

A fast, lightweight imageviewer using imlib2

Added to portage

2026-09-26

gentoo-kernel - 6.18.54
Ebuild name:

sys-kernel/gentoo-kernel-6.18.54

Description

Linux kernel built with Gentoo patches

Added to portage

2026-09-26

gentoo-kernel - 7.2.8
Ebuild name:

sys-kernel/gentoo-kernel-7.2.8

Description

Linux kernel built with Gentoo patches

Added to portage

2026-09-26

gentoo-kernel-bin - 6.18.54
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.54

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-09-26

gentoo-kernel-bin - 7.2.8
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.2.8

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-09-26

gentoo-kernel-modprep - 6.18.54
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.54

Description

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

Added to portage

2026-09-26

gentoo-kernel-modprep - 7.2.8
Ebuild name:

sys-kernel/gentoo-kernel-modprep-7.2.8

Description

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

Added to portage

2026-09-26

libime - 1.1.17
Ebuild name:

app-i18n/libime-1.1.17

Description

Fcitx5 Next generation of fcitx

Added to portage

2026-09-26

markdown - 3.11
Ebuild name:

dev-python/markdown-3.11

Description

Python implementation of the markdown markup language

Added to portage

2026-09-26

multipart - 2.0.1
Ebuild name:

dev-python/multipart-2.0.1

Description

Parser for multipart/form-data

Added to portage

2026-09-26

opentelemetry-api - 1.45.0
Ebuild name:

dev-python/opentelemetry-api-1.45.0

Description

OpenTelemetry Python API

Added to portage

2026-09-26

opentelemetry-sdk - 1.45.0
Ebuild name:

dev-python/opentelemetry-sdk-1.45.0

Description

OpenTelemetry Python SDK

Added to portage

2026-09-26

opentelemetry-semantic-conventions - 1.45.0
Ebuild name:

dev-python/opentelemetry-semantic-conventions-1.45.0

Description

OpenTelemetry Semantic Conventions

Added to portage

2026-09-26

platformdirs - 4.11.14
Ebuild name:

dev-python/platformdirs-4.11.14

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-09-26

platformdirs - 4.11.15
Ebuild name:

dev-python/platformdirs-4.11.15

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-09-26

pydata-sphinx-theme - 0.22.0
Ebuild name:

dev-python/pydata-sphinx-theme-0.22.0

Description

Bootstrap-based Sphinx theme from the PyData community

Added to portage

2026-09-26

pykwalify - 1.8.0-r4
Ebuild name:

dev-python/pykwalify-1.8.0-r4

Description

Python lib/cli for JSON/YAML schema validation

Added to portage

2026-09-26

pypy - 3.12.8.0.0
Ebuild name:

dev-lang/pypy-3.12.8.0.0

Description

A fast, compliant alternative implementation of the Python () language

Added to portage

2026-09-26

pypy3-exe - 3.12.8.0.0
Ebuild name:

dev-lang/pypy3-exe-3.12.8.0.0

Description

PyPy3.12 executable (build from source)

Added to portage

2026-09-26

pypy3-exe-bin - 3.12.8.0.0
Ebuild name:

dev-lang/pypy3-exe-bin-3.12.8.0.0

Description

PyPy executable (pre-built version)

Added to portage

2026-09-26

qbittorrent - 5.1.4-r1
Ebuild name:

net-p2p/qbittorrent-5.1.4-r1

Description

BitTorrent client in C++ and Qt

Added to portage

2026-09-26

qbittorrent - 5.2.0-r1
Ebuild name:

net-p2p/qbittorrent-5.2.0-r1

Description

BitTorrent client in C++ and Qt

Added to portage

2026-09-26

qbittorrent - 5.2.3
Ebuild name:

net-p2p/qbittorrent-5.2.3

Description

BitTorrent client in C++ and Qt

Added to portage

2026-09-26

raspberrypi-firmware - 1.20260915
Ebuild name:

sys-boot/raspberrypi-firmware-1.20260915

Description

Raspberry Pi (all versions) bootloader and GPU firmware

Added to portage

2026-09-26

raspberrypi-image - 6.18.50_p20260915
Ebuild name:

sys-kernel/raspberrypi-image-6.18.50_p20260915

Description

Raspberry Pi (all versions) kernel and modules

Added to portage

2026-09-26

raspberrypi-sources - 6.18.50_p20260915
Ebuild name:

sys-kernel/raspberrypi-sources-6.18.50_p20260915

Description

Raspberry Pi kernel sources

Added to portage

2026-09-26

rime-data - 1.0.20260922
Ebuild name:

app-i18n/rime-data-1.0.20260922

Description

Added to portage

2026-09-26

rpi-eeprom - 28.32
Ebuild name:

dev-embedded/rpi-eeprom-28.32

Description

Updater for Raspberry Pi 4/5 bootloader and the VL805 USB controller

Added to portage

2026-09-26

scikit-build-core - 1.1.0
Ebuild name:

dev-python/scikit-build-core-1.1.0

Description

Build backend for CMake based projects

Added to portage

2026-09-26

sqlalchemy - 2.1.1
Ebuild name:

dev-python/sqlalchemy-2.1.1

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-09-26

stripe-mock - 0.205.0
Ebuild name:

dev-util/stripe-mock-0.205.0

Description

Mock HTTP server that responds like the real Stripe API

Added to portage

2026-09-26

tavern - 3.7.0
Ebuild name:

dev-python/tavern-3.7.0

Description

A tool, library, and Pytest plugin for testing RESTful APIs

Added to portage

2026-09-26

tox - 4.64.3
Ebuild name:

dev-python/tox-4.64.3

Description

virtualenv-based automation of test activities

Added to portage

2026-09-26

uvicorn - 0.54.0
Ebuild name:

dev-python/uvicorn-0.54.0

Description

Lightning-fast ASGI server implementation

Added to portage

2026-09-26

vanilla-kernel - 6.18.54
Ebuild name:

sys-kernel/vanilla-kernel-6.18.54

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-09-26

vanilla-kernel - 7.2.8
Ebuild name:

sys-kernel/vanilla-kernel-7.2.8

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-09-26

xdelta - 1.2.0
Ebuild name:

dev-util/xdelta-1.2.0

Description

Computes changes between binary or text files and creates deltas

Added to portage

2026-09-26

2026-09-25
airspy - 1.0.10-r1
Ebuild name:

net-wireless/airspy-1.0.10-r1

Description

Usemode driver and associated tools for airspy

Added to portage

2026-09-25

astyle - 3.6.18
Ebuild name:

dev-util/astyle-3.6.18

Description

Artistic Style is a re-indenter and reformatter for C, C++ and Java source c

Added to portage

2026-09-25

aws-c-common - 1.0.1-r1
Ebuild name:

dev-libs/aws-c-common-1.0.1-r1

Description

Core c99 package for AWS SDK for C

Added to portage

2026-09-25

bindgen - 0.73.2
Ebuild name:

dev-util/bindgen-0.73.2

Description

Automatically generate Rust FFI bindings to C and C++ libraries

Added to portage

2026-09-25

c-blosc2 - 3.3.5
Ebuild name:

dev-libs/c-blosc2-3.3.5

Description

Blocking, shuffling and lossless compression library

Added to portage

2026-09-25

chafa - 1.18.3
Ebuild name:

media-gfx/chafa-1.18.3

Description

versatile and fast Unicode/ASCII/ANSI graphics renderer

Added to portage

2026-09-25

containerd - 2.4.1
Ebuild name:

app-containers/containerd-2.4.1

Description

A daemon to control runC

Added to portage

2026-09-25

cvmfs - 2.14.1
Ebuild name:

net-fs/cvmfs-2.14.1

Description

HTTP read-only file system for distributing software

Added to portage

2026-09-25

difftastic - 0.71.0
Ebuild name:

dev-util/difftastic-0.71.0

Description

A structural diff that understands syntax

Added to portage

2026-09-25

django-js-asset - 4.2.0
Ebuild name:

dev-python/django-js-asset-4.2.0

Description

Script tag with additional attributes for django.forms.Media

Added to portage

2026-09-25

dokuwiki - 20260714c-r1
Ebuild name:

www-apps/dokuwiki-20260714c-r1

Description

DokuWiki is a simple to use Wiki aimed at a small company's document

Added to portage

2026-09-25

fetchmail - 6.6.8
Ebuild name:

net-mail/fetchmail-6.6.8

Description

the legendary remote-mail retrieval and forwarding utility

Added to portage

2026-09-25

gallery-dl - 1.32.13
Ebuild name:

net-misc/gallery-dl-1.32.13

Description

Download image galleries and collections from several image hosting sit

Added to portage

2026-09-25

gentoo-sources - 6.18.54
Ebuild name:

sys-kernel/gentoo-sources-6.18.54

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-09-25

gentoo-sources - 7.2.8
Ebuild name:

sys-kernel/gentoo-sources-7.2.8

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-09-25

ggml - 0.25.3
Ebuild name:

sci-ml/ggml-0.25.3

Description

Tensor library for machine learning

Added to portage

2026-09-25

github-cli - 2.101.0
Ebuild name:

dev-util/github-cli-2.101.0

Description

GitHub CLI

Added to portage

2026-09-25

gitlab-cli - 1.119.0
Ebuild name:

dev-util/gitlab-cli-1.119.0

Description

the official gitlab command line interface

Added to portage

2026-09-25

golangci-lint - 2.14.0
Ebuild name:

dev-go/golangci-lint-2.14.0

Description

Fast linters runner for Go

Added to portage

2026-09-25

google-api-core - 2.39.0
Ebuild name:

dev-python/google-api-core-2.39.0

Description

Core Library for Google Client Libraries

Added to portage

2026-09-25

google-auth - 2.58.1
Ebuild name:

dev-python/google-auth-2.58.1

Description

Google Authentication Library

Added to portage

2026-09-25

googleapis-common-protos - 1.75.4
Ebuild name:

dev-python/googleapis-common-protos-1.75.4

Description

Python classes generated from the common protos in the g

Added to portage

2026-09-25

haproxy - 3.0.28
Ebuild name:

net-proxy/haproxy-3.0.28

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-09-25

haproxy - 3.2.24
Ebuild name:

net-proxy/haproxy-3.2.24

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-09-25

haproxy - 3.4.5
Ebuild name:

net-proxy/haproxy-3.4.5

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-09-25

linode-cli - 5.69.0
Ebuild name:

app-admin/linode-cli-5.69.0

Description

Official command-line interface for interacting with the Linode API

Added to portage

2026-09-25

linode-metadata - 0.4.0
Ebuild name:

dev-python/linode-metadata-0.4.0

Description

Python bindings for the Linode Metadata Service

Added to portage

2026-09-25

magit - 4.7.1
Ebuild name:

app-emacs/magit-4.7.1

Description

A Git porcelain inside Emacs

Added to portage

2026-09-25

netpbm - 11.15.8
Ebuild name:

media-libs/netpbm-11.15.8

Description

A set of utilities for converting to/from the netpbm (and related) format

Added to portage

2026-09-25

netpbm - 11.2.30
Ebuild name:

media-libs/netpbm-11.2.30

Description

A set of utilities for converting to/from the netpbm (and related) format

Added to portage

2026-09-25

ollama - 0.34.4
Ebuild name:

sci-ml/ollama-0.34.4

Description

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

Added to portage

2026-09-25

openjdk-bin - 27_p35
Ebuild name:

dev-java/openjdk-bin-27_p35

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-09-25

openjdk-bin - 28_alpha16
Ebuild name:

dev-java/openjdk-bin-28_alpha16

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-09-25

package-build - 5.0.3
Ebuild name:

app-emacs/package-build-5.0.3

Description

Tools for assembling a package archive

Added to portage

2026-09-25

phonenumbers - 9.0.40
Ebuild name:

dev-python/phonenumbers-9.0.40

Description

Python port of Google's libphonenumber

Added to portage

2026-09-25

prusaslicer - 2.9.6-r1
Ebuild name:

media-gfx/prusaslicer-2.9.6-r1

Description

A mesh slicer to generate G-code for fused-filament-fabrication (3D

Added to portage

2026-09-25

pybugz - 0.15
Ebuild name:

www-client/pybugz-0.15

Description

Command line interface to (Gentoo) Bugzilla

Added to portage

2026-09-25

pycargoebuild - 0.17.1
Ebuild name:

app-portage/pycargoebuild-0.17.1

Description

A generator for Rust/Cargo ebuilds written in Python

Added to portage

2026-09-25

pymongo - 4.18.2
Ebuild name:

dev-python/pymongo-4.18.2

Description

Python driver for MongoDB

Added to portage

2026-09-25

pytz - 2026.4
Ebuild name:

dev-python/pytz-2026.4

Description

World timezone definitions for Python

Added to portage

2026-09-25

ruff - 0.16.9
Ebuild name:

dev-util/ruff-0.16.9

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-09-25

sqlalchemy - 2.1.0
Ebuild name:

dev-python/sqlalchemy-2.1.0

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-09-25

stripe-mock - 0.204.0
Ebuild name:

dev-util/stripe-mock-0.204.0

Description

Mock HTTP server that responds like the real Stripe API

Added to portage

2026-09-25

systemd-utils - 262
Ebuild name:

sys-apps/systemd-utils-262

Description

Utilities split out from systemd for OpenRC users

Added to portage

2026-09-25

tox - 4.64.2
Ebuild name:

dev-python/tox-4.64.2

Description

virtualenv-based automation of test activities

Added to portage

2026-09-25

untangle-https-backup - 0.2.0
Ebuild name:

app-backup/untangle-https-backup-0.2.0

Description

Back up Untangle configurations via the web admin UI

Added to portage

2026-09-25

uv - 0.12.19
Ebuild name:

dev-python/uv-0.12.19

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-09-25

uv-build - 0.12.19
Ebuild name:

dev-python/uv-build-0.12.19

Description

PEP517 uv build backend

Added to portage

2026-09-25

vanilla-sources - 6.18.54
Ebuild name:

sys-kernel/vanilla-sources-6.18.54

Description

Full sources for the Linux kernel

Added to portage

2026-09-25

vanilla-sources - 7.2.8
Ebuild name:

sys-kernel/vanilla-sources-7.2.8

Description

Full sources for the Linux kernel

Added to portage

2026-09-25

vertico - 2.15
Ebuild name:

app-emacs/vertico-2.15

Description

Vertical interactive completion

Added to portage

2026-09-25

virtualenv - 21.12.1
Ebuild name:

dev-python/virtualenv-21.12.1

Description

Virtual Python Environment builder

Added to portage

2026-09-25

ytmusicapi - 1.12.3
Ebuild name:

dev-python/ytmusicapi-1.12.3

Description

Unofficial API for YouTube Music

Added to portage

2026-09-25

zabbix - 6.0.48-r1
Ebuild name:

net-analyzer/zabbix-6.0.48-r1

Description

ZABBIX is software for monitoring of your applications, network and s

Added to portage

2026-09-25

zabbix - 7.0.30-r1
Ebuild name:

net-analyzer/zabbix-7.0.30-r1

Description

ZABBIX is software for monitoring of your applications, network and s

Added to portage

2026-09-25

zabbix - 7.0.31-r1
Ebuild name:

net-analyzer/zabbix-7.0.31-r1

Description

ZABBIX is software for monitoring of your applications, network and s

Added to portage

2026-09-25

zabbix - 7.4.14-r1
Ebuild name:

net-analyzer/zabbix-7.4.14-r1

Description

ZABBIX is software for monitoring of your applications, network and s

Added to portage

2026-09-25

zabbix - 7.4.15-r1
Ebuild name:

net-analyzer/zabbix-7.4.15-r1

Description

ZABBIX is software for monitoring of your applications, network and s

Added to portage

2026-09-25

zedis - 0.11.1
Ebuild name:

dev-db/zedis-0.11.1

Description

Blazing-fast native Redis GUI built with Rust and GPUI

Added to portage

2026-09-25

zsnes - 2.3.2
Ebuild name:

games-emulation/zsnes-2.3.2

Description

Fork of the classic Super Nintendo emulator

Added to portage

2026-09-25

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