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:

85722

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-06-09
audit - 4.1.4-r3
Ebuild name:

sys-process/audit-4.1.4-r3

Description

Userspace utilities for storing and processing auditing records

Added to portage

2026-06-09

awkward - 2.9.1
Ebuild name:

dev-python/awkward-2.9.1

Description

Manipulate JSON-like data with NumPy-like idioms

Added to portage

2026-06-09

awkward-cpp - 53
Ebuild name:

dev-python/awkward-cpp-53

Description

CPU kernels and compiled extensions for Awkward Array

Added to portage

2026-06-09

awscli - 1.45.25
Ebuild name:

app-admin/awscli-1.45.25

Description

Universal Command Line Environment for AWS

Added to portage

2026-06-09

binutils - 2.46.1
Ebuild name:

sys-devel/binutils-2.46.1

Description

Tools necessary to build programs

Added to portage

2026-06-09

binutils - 2.46.9999
Ebuild name:

sys-devel/binutils-2.46.9999

Description

Tools necessary to build programs

Added to portage

2026-06-09

binutils-hppa64 - 2.46.1
Ebuild name:

sys-devel/binutils-hppa64-2.46.1

Description

Tools necessary to build programs

Added to portage

2026-06-09

binutils-libs - 2.46.1
Ebuild name:

sys-libs/binutils-libs-2.46.1

Description

Core binutils libraries (libbfd, libopcodes, libiberty) for external

Added to portage

2026-06-09

boto3 - 1.43.25
Ebuild name:

dev-python/boto3-1.43.25

Description

The AWS SDK for Python

Added to portage

2026-06-09

botocore - 1.43.25
Ebuild name:

dev-python/botocore-1.43.25

Description

Low-level, data-driven core of boto 3

Added to portage

2026-06-09

flask-cors - 6.0.5
Ebuild name:

dev-python/flask-cors-6.0.5

Description

A Flask extension for Cross Origin Resource Sharing (CORS)

Added to portage

2026-06-09

glibc - 2.43.9999
Ebuild name:

sys-libs/glibc-2.43.9999

Description

GNU libc C library

Added to portage

2026-06-09

handbrake - 1.11.2
Ebuild name:

media-video/handbrake-1.11.2

Description

Open-source, GPL-licensed, multiplatform, multithreaded video transcod

Added to portage

2026-06-09

haruna - 1.7.1-r2
Ebuild name:

media-video/haruna-1.7.1-r2

Description

Video player built with Qt/QML and libmpv

Added to portage

2026-06-09

haruna - 1.8.1-r1
Ebuild name:

media-video/haruna-1.8.1-r1

Description

Video player built with Qt/QML and libmpv

Added to portage

2026-06-09

kdeconnect - 26.04.1-r1
Ebuild name:

kde-misc/kdeconnect-26.04.1-r1

Description

Adds communication between KDE Plasma and your smartphone

Added to portage

2026-06-09

kdeconnect - 26.04.2-r1
Ebuild name:

kde-misc/kdeconnect-26.04.2-r1

Description

Adds communication between KDE Plasma and your smartphone

Added to portage

2026-06-09

lego - 5.2.2
Ebuild name:

app-crypt/lego-5.2.2

Description

Let's Encrypt/ACME client (like certbot or acme.sh) and library written in Go

Added to portage

2026-06-09

magit - 4.5.0-r1
Ebuild name:

app-emacs/magit-4.5.0-r1

Description

A Git porcelain inside Emacs

Added to portage

2026-06-09

magit - 9999
Ebuild name:

app-emacs/magit-9999

Description

A Git porcelain inside Emacs

Added to portage

2026-06-09

magit-popup - 2.13.3-r1
Ebuild name:

app-emacs/magit-popup-2.13.3-r1

Description

Define prefix-infix-suffix command combos

Added to portage

2026-06-09

mailcrypt - 3.5.9-r3
Ebuild name:

app-emacs/mailcrypt-3.5.9-r3

Description

Provides a simple interface to public key cryptography with OpenPGP

Added to portage

2026-06-09

marginalia - 2.10
Ebuild name:

app-emacs/marginalia-2.10

Description

Marginalia in the minibuffer

Added to portage

2026-06-09

openpgp-keys-binutils - 20260609
Ebuild name:

sec-keys/openpgp-keys-binutils-20260609

Description

OpenPGP keys used to sign GNU Binutils releases

Added to portage

2026-06-09

paperwork - 2.2.5-r1
Ebuild name:

app-text/paperwork-2.2.5-r1

Description

a personal document manager for scanned documents (and PDFs)

Added to portage

2026-06-09

pdns - 5.1.1
Ebuild name:

net-dns/pdns-5.1.1

Description

The PowerDNS Daemon

Added to portage

2026-06-09

php - 8.5.7
Ebuild name:

dev-lang/php-8.5.7

Description

The PHP language runtime engine

Added to portage

2026-06-09

pikepdf - 10.8.0
Ebuild name:

dev-python/pikepdf-10.8.0

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-06-09

plumbum - 2.0.1
Ebuild name:

dev-python/plumbum-2.0.1

Description

A library for shell script-like programs in python

Added to portage

2026-06-09

postfix - 3.12_pre20260607
Ebuild name:

mail-mta/postfix-3.12_pre20260607

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-06-09

pypdf - 6.13.1
Ebuild name:

dev-python/pypdf-6.13.1

Description

Python library to work with PDF files

Added to portage

2026-06-09

pyzotero - 1.13.1
Ebuild name:

dev-python/pyzotero-1.13.1

Description

A Python client for the Zotero API

Added to portage

2026-06-09

sh - 2.3.0
Ebuild name:

dev-python/sh-2.3.0

Description

Python subprocess interface

Added to portage

2026-06-09

slixmpp - 1.16.0
Ebuild name:

dev-python/slixmpp-1.16.0

Description

Python 3 library for XMPP

Added to portage

2026-06-09

timu-caribbean-theme - 1.5
Ebuild name:

app-emacs/timu-caribbean-theme-1.5

Description

Color theme with cyan as a dominant color

Added to portage

2026-06-09

timu-caribbean-theme - 9999
Ebuild name:

app-emacs/timu-caribbean-theme-9999

Description

Color theme with cyan as a dominant color

Added to portage

2026-06-09

tornado - 6.5.7
Ebuild name:

dev-python/tornado-6.5.7

Description

Python web framework and asynchronous networking library

Added to portage

2026-06-09

transient - 0.13.4
Ebuild name:

app-emacs/transient-0.13.4

Description

Transient commands abstraction for GNU Emacs

Added to portage

2026-06-09

vertico - 2.10
Ebuild name:

app-emacs/vertico-2.10

Description

Vertical interactive completion

Added to portage

2026-06-09

wcwidth - 0.8.1
Ebuild name:

dev-python/wcwidth-0.8.1

Description

Measures number of Terminal column cells of wide-character codes

Added to portage

2026-06-09

ytmusicapi - 1.12.1-r1
Ebuild name:

dev-python/ytmusicapi-1.12.1-r1

Description

Unofficial API for YouTube Music

Added to portage

2026-06-09

2026-06-08
aiohttp - 3.14.1
Ebuild name:

dev-python/aiohttp-3.14.1

Description

HTTP client/server for asyncio

Added to portage

2026-06-08

array-api-compat - 1.15.0
Ebuild name:

dev-python/array-api-compat-1.15.0

Description

Array API standard compatibility wrapper over NumPy and others

Added to portage

2026-06-08

asyncssh - 2.23.1
Ebuild name:

dev-python/asyncssh-2.23.1

Description

Asynchronous SSHv2 client and server library

Added to portage

2026-06-08

beautifulsoup4 - 4.15.0
Ebuild name:

dev-python/beautifulsoup4-4.15.0

Description

Pythonic idioms for iterating, searching, and modifying an HTML/XM

Added to portage

2026-06-08

bugbite-cli - 0.0.15
Ebuild name:

dev-util/bugbite-cli-0.0.15

Description

A command line tool for bug, issue, and ticket mangling

Added to portage

2026-06-08

caddy - 2.11.4
Ebuild name:

www-servers/caddy-2.11.4

Description

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HT

Added to portage

2026-06-08

cdemu - 3.3.1
Ebuild name:

app-cdr/cdemu-3.3.1

Description

Command-line tool for controlling cdemu-daemon

Added to portage

2026-06-08

cdemu-daemon - 3.3.1
Ebuild name:

app-cdr/cdemu-daemon-3.3.1

Description

Daemon of the CDEmu optical media image mounting suite

Added to portage

2026-06-08

citus - 13.3.0
Ebuild name:

dev-db/citus-13.3.0

Description

Open-source postgresql extension for clustering/multi-node setups

Added to portage

2026-06-08

citus - 14.1.0
Ebuild name:

dev-db/citus-14.1.0

Description

Open-source postgresql extension for clustering/multi-node setups

Added to portage

2026-06-08

coredns - 1.14.3
Ebuild name:

net-dns/coredns-1.14.3

Description

CoreDNS is a DNS server that chains plugins

Added to portage

2026-06-08

cosign - 3.1.0
Ebuild name:

app-containers/cosign-3.1.0

Description

container signing utility

Added to portage

2026-06-08

duckdb - 1.5.3
Ebuild name:

dev-db/duckdb-1.5.3

Description

high-performance analytical database system

Added to portage

2026-06-08

fakeredis - 2.36.1
Ebuild name:

dev-python/fakeredis-2.36.1

Description

Fake implementation of redis API for testing purposes

Added to portage

2026-06-08

flask-cors - 6.0.4
Ebuild name:

dev-python/flask-cors-6.0.4

Description

A Flask extension for Cross Origin Resource Sharing (CORS)

Added to portage

2026-06-08

gallery-dl - 1.32.2
Ebuild name:

net-misc/gallery-dl-1.32.2

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-06-08

gcc - 17.0.0_p20260607
Ebuild name:

sys-devel/gcc-17.0.0_p20260607

Description

The GNU Compiler Collection

Added to portage

2026-06-08

gcc - 17.0.0_p20260607-r1
Ebuild name:

sys-devel/gcc-17.0.0_p20260607-r1

Description

The GNU Compiler Collection

Added to portage

2026-06-08

gcdemu - 3.3.1
Ebuild name:

app-cdr/gcdemu-3.3.1

Description

Gtk+ GUI for controlling cdemu-daemon

Added to portage

2026-06-08

git-sources - 7.1_rc7
Ebuild name:

sys-kernel/git-sources-7.1_rc7

Description

The very latest -git version of the Linux kernel

Added to portage

2026-06-08

gnuradio - 3.11_pre20260606
Ebuild name:

net-wireless/gnuradio-3.11_pre20260606

Description

Toolkit that provides signal processing blocks to implement

Added to portage

2026-06-08

gr-fosphor - 0.0_p20260330-r1
Ebuild name:

net-analyzer/gr-fosphor-0.0_p20260330-r1

Description

gnuradio fosphor block (GPU spectrum display)

Added to portage

2026-06-08

haproxy - 3.4.0
Ebuild name:

net-proxy/haproxy-3.4.0

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-06-08

haproxy - 3.4.9999
Ebuild name:

net-proxy/haproxy-3.4.9999

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-06-08

jellyfin-bin - 10.11.11
Ebuild name:

www-apps/jellyfin-bin-10.11.11

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2026-06-08

kafka-bin - 4.2.1
Ebuild name:

net-misc/kafka-bin-4.2.1

Description

A high-throughput distributed messaging system

Added to portage

2026-06-08

kafka-bin - 4.3.0
Ebuild name:

net-misc/kafka-bin-4.3.0

Description

A high-throughput distributed messaging system

Added to portage

2026-06-08

libmirage - 3.3.2
Ebuild name:

dev-libs/libmirage-3.3.2

Description

CD and DVD image access library

Added to portage

2026-06-08

libslirp - 4.9.3
Ebuild name:

net-libs/libslirp-4.9.3

Description

A TCP-IP emulator used to provide virtual networking services

Added to portage

2026-06-08

libxfce4ui - 4.21.8
Ebuild name:

xfce-base/libxfce4ui-4.21.8

Description

Unified widget and session management libs for Xfce

Added to portage

2026-06-08

marginalia - 2.11
Ebuild name:

app-emacs/marginalia-2.11

Description

Marginalia in the minibuffer

Added to portage

2026-06-08

openpgp-keys-dougmassay - 20260608
Ebuild name:

sec-keys/openpgp-keys-dougmassay-20260608

Description

OpenPGP key used by Doug Massay

Added to portage

2026-06-08

passt - 2026.05.26
Ebuild name:

net-misc/passt-2026.05.26

Description

User-mode networking daemons for VMs and namespaces, replacement for Slir

Added to portage

2026-06-08

platyps - 0.14.2-r1
Ebuild name:

app-shells/platyps-0.14.2-r1

Description

Generate PowerShell external help files from Markdown

Added to portage

2026-06-08

postgresql - 19_beta1
Ebuild name:

dev-db/postgresql-19_beta1

Description

PostgreSQL RDBMS

Added to portage

2026-06-08

pytest-aiohttp - 1.1.1
Ebuild name:

dev-python/pytest-aiohttp-1.1.1

Description

pytest plugin for aiohttp support

Added to portage

2026-06-08

python-debian - 1.1.1
Ebuild name:

dev-python/python-debian-1.1.1

Description

Python modules to work with Debian-related data formats

Added to portage

2026-06-08

qbe - 1.3-r1
Ebuild name:

sys-devel/qbe-1.3-r1

Description

Pure-C embeddable compiler backend

Added to portage

2026-06-08

rsync - 3.4.4
Ebuild name:

net-misc/rsync-3.4.4

Description

File transfer program to keep remote files into sync

Added to portage

2026-06-08

sanlock - 5.1.0-r2
Ebuild name:

sys-cluster/sanlock-5.1.0-r2

Description

shared storage lock manager

Added to portage

2026-06-08

sigil - 2.8.0
Ebuild name:

app-text/sigil-2.8.0

Description

Multi-platform WYSIWYG ebook editor for ePub format

Added to portage

2026-06-08

sqlite - 3.53.2-r1
Ebuild name:

dev-db/sqlite-3.53.2-r1

Description

SQL database engine

Added to portage

2026-06-08

stalwart-mail - 0.16.8
Ebuild name:

net-mail/stalwart-mail-0.16.8

Description

Stalwart Mail Server

Added to portage

2026-06-08

syd - 3.55.0
Ebuild name:

sys-apps/syd-3.55.0

Description

seccomp and landlock based application sandbox with support for namespaces

Added to portage

2026-06-08

timescaledb - 2.27.2
Ebuild name:

dev-db/timescaledb-2.27.2

Description

Open-source time-series SQL database

Added to portage

2026-06-08

virt-firmware - 26.2-r1
Ebuild name:

app-emulation/virt-firmware-26.2-r1

Description

Tools for ovmf/armvirt firmware volumes

Added to portage

2026-06-08

vscode-dark-plus-emacs-theme - 2.1.0_p20260606
Ebuild name:

app-emacs/vscode-dark-plus-emacs-theme-2.1.0_p20260606

Description

Accurate port of the default Visual Studio C

Added to portage

2026-06-08

websocat - 1.14.1
Ebuild name:

net-misc/websocat-1.14.1

Description

Command-line client for WebSockets, like netcat, with socat-like functions

Added to portage

2026-06-08

xfce4-panel - 4.21.2
Ebuild name:

xfce-base/xfce4-panel-4.21.2

Description

Panel for the Xfce desktop environment

Added to portage

2026-06-08

zedis - 0.4.2
Ebuild name:

dev-db/zedis-0.4.2

Description

Blazing-fast native Redis GUI built with Rust and GPUI

Added to portage

2026-06-08

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