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:

84524

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.6 (45 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-04-20
amule - 2.3.3-r8
Ebuild name:

net-p2p/amule-2.3.3-r8

Description

aMule, the all-platform eMule p2p client

Added to portage

2026-04-20

bluez-alsa - 4.3.1-r2
Ebuild name:

media-sound/bluez-alsa-4.3.1-r2

Description

Bluetooth Audio ALSA Backend

Added to portage

2026-04-20

filelock - 3.29.0
Ebuild name:

dev-python/filelock-3.29.0

Description

A platform independent file lock for Python

Added to portage

2026-04-20

firefox-bin - 150.0
Ebuild name:

www-client/firefox-bin-150.0

Description

Firefox Web Browser

Added to portage

2026-04-20

gcc - 16.0.1_p20260419
Ebuild name:

sys-devel/gcc-16.0.1_p20260419

Description

The GNU Compiler Collection

Added to portage

2026-04-20

gentoo-sources - 5.10.253
Ebuild name:

sys-kernel/gentoo-sources-5.10.253

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 5.15.203
Ebuild name:

sys-kernel/gentoo-sources-5.15.203

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.1.169
Ebuild name:

sys-kernel/gentoo-sources-6.1.169

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.12.82
Ebuild name:

sys-kernel/gentoo-sources-6.12.82

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.18.23
Ebuild name:

sys-kernel/gentoo-sources-6.18.23

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.19.13
Ebuild name:

sys-kernel/gentoo-sources-6.19.13

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.6.135
Ebuild name:

sys-kernel/gentoo-sources-6.6.135

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

ghostty - 1.3.1
Ebuild name:

x11-terms/ghostty-1.3.1

Description

Fast, feature-rich, and cross-platform terminal emulator

Added to portage

2026-04-20

ghostty-terminfo - 1.3.1
Ebuild name:

x11-terms/ghostty-terminfo-1.3.1

Description

Terminfo for ghostty, a fast, feature-rich, and cross-platform ter

Added to portage

2026-04-20

hash-slinger - 3.5
Ebuild name:

net-dns/hash-slinger-3.5

Description

Various tools to generate DNS records like SSHFP, TLSA, OPENPGPKEY, IPSECK

Added to portage

2026-04-20

img2pdf - 0.6.3
Ebuild name:

media-gfx/img2pdf-0.6.3

Description

Losslessly convert raster images to PDF

Added to portage

2026-04-20

irker - 2.25
Ebuild name:

net-irc/irker-2.25

Description

Submission tools for IRC notifications

Added to portage

2026-04-20

libtmux - 0.55.1
Ebuild name:

dev-python/libtmux-0.55.1

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2026-04-20

lyx - 2.5.1
Ebuild name:

app-office/lyx-2.5.1

Description

WYSIWYM (What You See Is What You Mean) document processor based on LaTeX

Added to portage

2026-04-20

mate-calc - 1.28.0-r2
Ebuild name:

mate-extra/mate-calc-1.28.0-r2

Description

Calculator for MATE

Added to portage

2026-04-20

md5deep - 4.4
Ebuild name:

app-crypt/md5deep-4.4

Description

Expanded md5sum program with recursive and comparison options

Added to portage

2026-04-20

md6sum - 1.0-r3
Ebuild name:

app-crypt/md6sum-1.0-r3

Description

A C implementation of MD6

Added to portage

2026-04-20

mhash - 0.9.9.9-r4
Ebuild name:

app-crypt/mhash-0.9.9.9-r4

Description

Library providing a uniform interface to a large number of hash algorith

Added to portage

2026-04-20

minisign - 0.12
Ebuild name:

app-crypt/minisign-0.12

Description

Dead simple tool to sign files and verify signatures

Added to portage

2026-04-20

minted - 3.4.0-r1
Ebuild name:

dev-tex/minted-3.4.0-r1

Description

LaTeX package for source code syntax highlighting

Added to portage

2026-04-20

nbxmpp - 7.2.0
Ebuild name:

dev-python/nbxmpp-7.2.0

Description

Python library to use Jabber/XMPP networks in a non-blocking way

Added to portage

2026-04-20

nikola - 8.3.3-r1
Ebuild name:

www-apps/nikola-8.3.3-r1

Description

A static website and blog generator

Added to portage

2026-04-20

pybind11 - 3.0.4
Ebuild name:

dev-python/pybind11-3.0.4

Description

AST-based Python refactoring library

Added to portage

2026-04-20

pygobject - 3.56.2
Ebuild name:

dev-python/pygobject-3.56.2

Description

Python bindings for GObject Introspection

Added to portage

2026-04-20

safeeyes - 3.4.1
Ebuild name:

x11-misc/safeeyes-3.4.1

Description

Linux alternative to EyeLeo

Added to portage

2026-04-20

skopeo - 1.22.2
Ebuild name:

app-containers/skopeo-1.22.2

Description

Work with remote container images registries

Added to portage

2026-04-20

starship - 1.25.0
Ebuild name:

app-shells/starship-1.25.0

Description

The minimal, blazing-fast, and infinitely customizable prompt for any sh

Added to portage

2026-04-20

testdisk - 7.2-r1
Ebuild name:

app-admin/testdisk-7.2-r1

Description

Checks and undeletes partitions + PhotoRec, signature based recovery tool

Added to portage

2026-04-20

vlc - 4.0.0_pre20260418
Ebuild name:

media-video/vlc-4.0.0_pre20260418

Description

Media player and framework with support for most multimedia files

Added to portage

2026-04-20

2026-04-19
authlib - 1.7.0
Ebuild name:

dev-python/authlib-1.7.0

Description

A Python library in building OAuth and OpenID Connect servers and clients

Added to portage

2026-04-19

chrome-binary-plugins - 149.0.7795.2_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-149.0.7795.2_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-04-19

chromium - 149.0.7795.2
Ebuild name:

www-client/chromium-149.0.7795.2

Description

Open-source version of Google Chrome web browser

Added to portage

2026-04-19

dash - 0.5.13.3
Ebuild name:

app-shells/dash-0.5.13.3

Description

Debian Almquist Shell

Added to portage

2026-04-19

diskimage-builder - 3.41.0
Ebuild name:

app-emulation/diskimage-builder-3.41.0

Description

Golden Disk Image builder

Added to portage

2026-04-19

epiphany - 49.8.1
Ebuild name:

www-client/epiphany-49.8.1

Description

GNOME webbrowser based on Webkit

Added to portage

2026-04-19

fheroes2 - 1.1.15
Ebuild name:

games-engines/fheroes2-1.1.15

Description

Recreation of HoMM2 game engine

Added to portage

2026-04-19

fstobdf - 1.0.8
Ebuild name:

x11-apps/fstobdf-1.0.8

Description

generate BDF font from X font server

Added to portage

2026-04-19

gcc - 15.2.1_p20260418
Ebuild name:

sys-devel/gcc-15.2.1_p20260418

Description

The GNU Compiler Collection

Added to portage

2026-04-19

gimp - 3.2.4
Ebuild name:

media-gfx/gimp-3.2.4

Description

GNU Image Manipulation Program

Added to portage

2026-04-19

git-extras - 7.4.0
Ebuild name:

dev-vcs/git-extras-7.4.0

Description

Git utilities -- repo summary, repl, changelog population, and many more

Added to portage

2026-04-19

glycin - 2.1.1
Ebuild name:

media-libs/glycin-2.1.1

Description

Sandboxed and extendable image loading library

Added to portage

2026-04-19

gmmlib - 22.10.0
Ebuild name:

media-libs/gmmlib-22.10.0

Description

Intel Graphics Memory Management Library

Added to portage

2026-04-19

gnome-calculator - 49.2-r1
Ebuild name:

gnome-extra/gnome-calculator-49.2-r1

Description

A calculator application for GNOME

Added to portage

2026-04-19

google-chrome-unstable - 149.0.7795.2
Ebuild name:

www-client/google-chrome-unstable-149.0.7795.2

Description

The web browser from Google

Added to portage

2026-04-19

hamlib - 4.7.1
Ebuild name:

media-libs/hamlib-4.7.1

Description

Ham radio backend rig control libraries

Added to portage

2026-04-19

iceauth - 1.0.11
Ebuild name:

x11-apps/iceauth-1.0.11

Description

ICE authority file utility

Added to portage

2026-04-19

ico - 1.0.7
Ebuild name:

x11-apps/ico-1.0.7

Description

animate an icosahedron or other polyhedron

Added to portage

2026-04-19

installkernel - 67
Ebuild name:

sys-kernel/installkernel-67

Description

Gentoo fork of installkernel script from debianutils

Added to portage

2026-04-19

joserfc - 1.6.4
Ebuild name:

dev-python/joserfc-1.6.4

Description

A Python library for JOSE RFCs JWS, JWE, JWK, JWA, JWT

Added to portage

2026-04-19

labwc - 0.9.7
Ebuild name:

gui-wm/labwc-0.9.7

Description

Openbox alternative for wayland

Added to portage

2026-04-19

lego - 4.34.0
Ebuild name:

app-crypt/lego-4.34.0

Description

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

Added to portage

2026-04-19

libadwaita - 1.8.5.1
Ebuild name:

gui-libs/libadwaita-1.8.5.1

Description

Building blocks for modern GNOME applications

Added to portage

2026-04-19

libva-intel-media-driver - 26.1.6
Ebuild name:

media-libs/libva-intel-media-driver-26.1.6

Description

Intel Media Driver for VA-API (iHD)

Added to portage

2026-04-19

listres - 1.0.7
Ebuild name:

x11-apps/listres-1.0.7

Description

list resources in widgets

Added to portage

2026-04-19

lmod - 9.0.8
Ebuild name:

sys-cluster/lmod-9.0.8

Description

Environment Module System based on Lua

Added to portage

2026-04-19

lmod - 9.1.2
Ebuild name:

sys-cluster/lmod-9.1.2

Description

Environment Module System based on Lua

Added to portage

2026-04-19

lmod - 9.2
Ebuild name:

sys-cluster/lmod-9.2

Description

Environment Module System based on Lua

Added to portage

2026-04-19

lxml - 6.1.0
Ebuild name:

dev-python/lxml-6.1.0

Description

A Pythonic binding for the libxml2 and libxslt libraries

Added to portage

2026-04-19

mhash - 0.9.9.9-r4
Ebuild name:

app-crypt/mhash-0.9.9.9-r4

Description

Library providing a uniform interface to a large number of hash algorith

Added to portage

2026-04-19

mkfontscale - 1.2.4
Ebuild name:

x11-apps/mkfontscale-1.2.4

Description

create an index of scalable font files for X

Added to portage

2026-04-19

moto - 5.1.22-r1
Ebuild name:

dev-python/moto-5.1.22-r1

Description

Mock library for boto

Added to portage

2026-04-19

obs-studio - 32.0.4-r1
Ebuild name:

media-video/obs-studio-32.0.4-r1

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-04-19

obs-studio - 32.1.0-r1
Ebuild name:

media-video/obs-studio-32.1.0-r1

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-04-19

odamex - 12.2.0
Ebuild name:

games-engines/odamex-12.2.0

Description

Online multiplayer free software engine for DOOM

Added to portage

2026-04-19

openpgp-keys-erwinwaterlander - 20260418
Ebuild name:

sec-keys/openpgp-keys-erwinwaterlander-20260418

Description

OpenPGP key used by Erwin Waterlander

Added to portage

2026-04-19

openpgp-keys-roymarples - 20260418
Ebuild name:

sec-keys/openpgp-keys-roymarples-20260418

Description

OpenPGP key used by Roy Marples

Added to portage

2026-04-19

openssl-compat - 3.6.2
Ebuild name:

dev-libs/openssl-compat-3.6.2

Description

Full-strength general purpose cryptography library (including SSL and

Added to portage

2026-04-19

pyephem - 4.2.1
Ebuild name:

sci-astronomy/pyephem-4.2.1

Description

Astronomical routines for the Python programming language

Added to portage

2026-04-19

pysnmp - 7.1.24
Ebuild name:

dev-python/pysnmp-7.1.24

Description

Python SNMP library

Added to portage

2026-04-19

python-linux-procfs - 0.7.4
Ebuild name:

dev-python/python-linux-procfs-0.7.4

Description

Python classes to extract information from the Linux kernel /p

Added to portage

2026-04-19

quesoglc - 0.7.2-r2
Ebuild name:

media-libs/quesoglc-0.7.2-r2

Description

Free implementation of the OpenGL Character Renderer (GLC)

Added to portage

2026-04-19

scm - 5.6.4-r1
Ebuild name:

dev-scheme/scm-5.6.4-r1

Description

SCM is a Scheme implementation from the author of slib

Added to portage

2026-04-19

seedfiles - 1.4.1
Ebuild name:

sys-apps/seedfiles-1.4.1

Description

Portable drop-in reimplementation of systemd-tmpfiles

Added to portage

2026-04-19

simplejson - 4.0.1
Ebuild name:

dev-python/simplejson-4.0.1

Description

Simple, fast, extensible JSON encoder/decoder for Python

Added to portage

2026-04-19

simplescreenrecorder - 0.4.4_p20251228
Ebuild name:

media-video/simplescreenrecorder-0.4.4_p20251228

Description

Simple Screen Recorder

Added to portage

2026-04-19

vivaldi-snapshot - 7.10.4009.3
Ebuild name:

www-client/vivaldi-snapshot-7.10.4009.3

Description

A browser for our friends

Added to portage

2026-04-19

wine-staging - 11.7
Ebuild name:

app-emulation/wine-staging-11.7

Description

Free implementation of Windows(tm) on Unix, with Wine-Staging patch

Added to portage

2026-04-19

xbiff - 1.0.6
Ebuild name:

x11-apps/xbiff-1.0.6

Description

mailbox flag for X

Added to portage

2026-04-19

xconsole - 1.1.1
Ebuild name:

x11-apps/xconsole-1.1.1

Description

monitor system console messages with X

Added to portage

2026-04-19

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