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:

87122

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-07-23
7zip - 26.02-r1
Ebuild name:

app-arch/7zip-26.02-r1

Description

Free file archiver for extremely high compression

Added to portage

2026-07-23

bind - 9.20.26
Ebuild name:

net-dns/bind-9.20.26

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2026-07-23

cargo-nextest - 0.9.140
Ebuild name:

dev-util/cargo-nextest-0.9.140

Description

Next-generation test runner for Rust

Added to portage

2026-07-23

git-delete-merged-branches - 7.6.1
Ebuild name:

dev-vcs/git-delete-merged-branches-7.6.1

Description

Command-line tool to delete merged Git branches

Added to portage

2026-07-23

knot-resolver - 5.7.7
Ebuild name:

net-dns/knot-resolver-5.7.7

Description

A scaleable caching DNS resolver

Added to portage

2026-07-23

knot-resolver - 6.4.1
Ebuild name:

net-dns/knot-resolver-6.4.1

Description

Scaleable caching DNS resolver

Added to portage

2026-07-23

pdns-recursor - 5.3.9
Ebuild name:

net-dns/pdns-recursor-5.3.9

Description

The PowerDNS Recursor

Added to portage

2026-07-23

pdns-recursor - 5.4.4
Ebuild name:

net-dns/pdns-recursor-5.4.4

Description

The PowerDNS Recursor

Added to portage

2026-07-23

rnv - 1.7.11-r4
Ebuild name:

app-text/rnv-1.7.11-r4

Description

A lightweight Relax NG Compact Syntax validator

Added to portage

2026-07-23

unbound - 1.25.2
Ebuild name:

net-dns/unbound-1.25.2

Description

A validating, recursive and caching DNS resolver

Added to portage

2026-07-23

unionfs-fuse - 3.7-r1
Ebuild name:

sys-fs/unionfs-fuse-3.7-r1

Description

Self-syncing tree-merging file system based on FUSE

Added to portage

2026-07-23

2026-07-22
CSS-Minifier-XS - 0.140.0
Ebuild name:

dev-perl/CSS-Minifier-XS-0.140.0

Description

XS based CSS minifier

Added to portage

2026-07-22

Config-IniFiles - 3.1.0
Ebuild name:

dev-perl/Config-IniFiles-3.1.0

Description

Module for reading .ini-style configuration files

Added to portage

2026-07-22

DBI - 1.651.0
Ebuild name:

dev-perl/DBI-1.651.0

Description

Database independent interface for Perl

Added to portage

2026-07-22

JavaScript-Minifier-XS - 0.160.0
Ebuild name:

dev-perl/JavaScript-Minifier-XS-0.160.0

Description

XS based JavaScript minifier

Added to portage

2026-07-22

List-SomeUtils-XS - 0.590.0
Ebuild name:

dev-perl/List-SomeUtils-XS-0.590.0

Description

XS implementation for List

Added to portage

2026-07-22

archivemount - 1b
Ebuild name:

sys-fs/archivemount-1b

Description

Mount archives using libarchive and FUSE

Added to portage

2026-07-22

awscli - 1.45.53
Ebuild name:

app-admin/awscli-1.45.53

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-22

bind - 9.20.24
Ebuild name:

net-dns/bind-9.20.24

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2026-07-22

boto3 - 1.43.53
Ebuild name:

dev-python/boto3-1.43.53

Description

The AWS SDK for Python

Added to portage

2026-07-22

botocore - 1.43.53
Ebuild name:

dev-python/botocore-1.43.53

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-22

buildah - 1.44.1
Ebuild name:

app-containers/buildah-1.44.1

Description

A tool that facilitates building OCI images

Added to portage

2026-07-22

ceres-solver - 2.2.0-r2
Ebuild name:

sci-libs/ceres-solver-2.2.0-r2

Description

Nonlinear least-squares minimizer

Added to portage

2026-07-22

clazy - 1.17.1-r1
Ebuild name:

dev-util/clazy-1.17.1-r1

Description

Compiler plugin which allows clang to understand Qt semantics

Added to portage

2026-07-22

cryptsetup - 2.8.7
Ebuild name:

sys-fs/cryptsetup-2.8.7

Description

Tool to setup encrypted devices with dm-crypt

Added to portage

2026-07-22

dash - 0.5.13.5
Ebuild name:

app-shells/dash-0.5.13.5

Description

Debian Almquist Shell

Added to portage

2026-07-22

element - 1.12.24
Ebuild name:

www-apps/element-1.12.24

Description

A glossy Matrix collaboration client for the web

Added to portage

2026-07-22

fcgiwrap - 1.1.0_p20150419-r3
Ebuild name:

www-misc/fcgiwrap-1.1.0_p20150419-r3

Description

Simple FastCGI wrapper for CGI scripts (CGI support for nginx)

Added to portage

2026-07-22

filelock - 3.32.0
Ebuild name:

dev-python/filelock-3.32.0

Description

A platform independent file lock for Python

Added to portage

2026-07-22

fish - 4.8.1
Ebuild name:

app-shells/fish-4.8.1

Description

Friendly Interactive SHell

Added to portage

2026-07-22

freerdp - 3.30.0
Ebuild name:

net-misc/freerdp-3.30.0

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-07-22

google-auth - 2.56.2
Ebuild name:

dev-python/google-auth-2.56.2

Description

Google Authentication Library

Added to portage

2026-07-22

hcloud - 2.23.0
Ebuild name:

dev-python/hcloud-2.23.0

Description

Official Hetzner Cloud python library

Added to portage

2026-07-22

jupyterlab - 4.5.10
Ebuild name:

dev-python/jupyterlab-4.5.10

Description

JupyterLab computational environment

Added to portage

2026-07-22

jupyterlab - 4.6.2
Ebuild name:

dev-python/jupyterlab-4.6.2

Description

JupyterLab computational environment

Added to portage

2026-07-22

kdeconnect - 26.04.3-r2
Ebuild name:

kde-misc/kdeconnect-26.04.3-r2

Description

Adds communication between KDE Plasma and your smartphone

Added to portage

2026-07-22

kdenetwork-meta - 26.04.3-r1
Ebuild name:

kde-apps/kdenetwork-meta-26.04.3-r1

Description

kdenetwork - merge this to pull in all kdenetwork-derived packa

Added to portage

2026-07-22

kirigami-app-components - 1.0.1
Ebuild name:

dev-libs/kirigami-app-components-1.0.1

Description

Kirigami addons and modules necessary to do a full featured

Added to portage

2026-07-22

libmysofa - 1.3.5
Ebuild name:

media-libs/libmysofa-1.3.5

Description

Library for reading AES SOFA (Spatially Oriented Format for Acoustics) f

Added to portage

2026-07-22

meson - 1.12.0_rc2
Ebuild name:

dev-build/meson-1.12.0_rc2

Description

Open source build system

Added to portage

2026-07-22

modus-themes - 5.2.0
Ebuild name:

app-emacs/modus-themes-5.2.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-07-22

modus-themes - 5.3.0
Ebuild name:

app-emacs/modus-themes-5.3.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-07-22

pkgconf - 3.0.4
Ebuild name:

dev-util/pkgconf-3.0.4

Description

pkg-config compatible replacement with no dependencies other than C99

Added to portage

2026-07-22

platformdirs - 4.11.0
Ebuild name:

dev-python/platformdirs-4.11.0

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-07-22

podman - 6.0.2
Ebuild name:

app-containers/podman-6.0.2

Description

A tool for managing OCI containers and pods with Docker-compatible CLI

Added to portage

2026-07-22

postfix - 3.12_pre20260721
Ebuild name:

mail-mta/postfix-3.12_pre20260721

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-07-22

pyproject-api - 1.11.0
Ebuild name:

dev-python/pyproject-api-1.11.0

Description

API to interact with the python pyproject.toml based projects

Added to portage

2026-07-22

pyshp - 3.1.5
Ebuild name:

sci-libs/pyshp-3.1.5

Description

Pure Python read/write support for ESRI Shapefile format

Added to portage

2026-07-22

pytest-env - 1.7.0
Ebuild name:

dev-python/pytest-env-1.7.0

Description

pytest plugin that allows you to add environment variables

Added to portage

2026-07-22

python-discovery - 1.5.0
Ebuild name:

dev-python/python-discovery-1.5.0

Description

Python interpreter discovery

Added to portage

2026-07-22

scrcpy - 4.1
Ebuild name:

app-mobilephone/scrcpy-4.1

Description

Display and control your Android device

Added to portage

2026-07-22

scx - 1.1.2
Ebuild name:

sys-kernel/scx-1.1.2

Description

sched_ext schedulers and tools

Added to portage

2026-07-22

scx-loader - 1.1.2
Ebuild name:

sys-kernel/scx-loader-1.1.2

Description

DBUS on-demand loader of sched-ext schedulers

Added to portage

2026-07-22

seatd - 0.9.3-r1
Ebuild name:

sys-auth/seatd-0.9.3-r1

Description

Minimal seat management daemon and universal library

Added to portage

2026-07-22

servefile - 0.5.4-r4
Ebuild name:

www-servers/servefile-0.5.4-r4

Description

Serve a single file via HTTP

Added to portage

2026-07-22

setuptools-scm - 10.2.1
Ebuild name:

dev-python/setuptools-scm-10.2.1

Description

Manage versions by scm tags via setuptools

Added to portage

2026-07-22

skim - 5.4.0
Ebuild name:

app-misc/skim-5.4.0

Description

Command-line fuzzy finder

Added to portage

2026-07-22

soupsieve - 2.9.1
Ebuild name:

dev-python/soupsieve-2.9.1

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-07-22

sphinx-autodoc-typehints - 3.13.0
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.13.0

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-07-22

subliminal - 2.7.0
Ebuild name:

media-video/subliminal-2.7.0

Description

Python library to search and download subtitles

Added to portage

2026-07-22

svneverever - 1.7.2-r3
Ebuild name:

dev-vcs/svneverever-1.7.2-r3

Description

Tool collecting path entries across SVN history

Added to portage

2026-07-22

throttled - 0.12-r1
Ebuild name:

sys-power/throttled-0.12-r1

Description

Daemon to work around throttling issues on some Intel laptops

Added to portage

2026-07-22

tox - 4.58.0
Ebuild name:

dev-python/tox-4.58.0

Description

virtualenv-based automation of test activities

Added to portage

2026-07-22

uv - 0.11.31
Ebuild name:

dev-python/uv-0.11.31

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-07-22

uv-build - 0.11.31
Ebuild name:

dev-python/uv-build-0.11.31

Description

PEP517 uv build backend

Added to portage

2026-07-22

virtualenv - 21.7.0
Ebuild name:

dev-python/virtualenv-21.7.0

Description

Virtual Python Environment builder

Added to portage

2026-07-22

wordpress - 6.8.6
Ebuild name:

www-apps/wordpress-6.8.6

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2026-07-22

wordpress - 6.9.5
Ebuild name:

www-apps/wordpress-6.9.5

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2026-07-22

xclipboard - 1.1.6
Ebuild name:

x11-apps/xclipboard-1.1.6

Description

interchange between cut buffer and selection

Added to portage

2026-07-22

xclock - 1.2.1
Ebuild name:

x11-apps/xclock-1.2.1

Description

analog / digital clock for X

Added to portage

2026-07-22

xkbprint - 1.0.8
Ebuild name:

x11-apps/xkbprint-1.0.8

Description

Print an XKB keyboard description

Added to portage

2026-07-22

xload - 1.2.1
Ebuild name:

x11-apps/xload-1.2.1

Description

system load average display for X

Added to portage

2026-07-22

xmodmap - 1.0.12
Ebuild name:

x11-apps/xmodmap-1.0.12

Description

utility for modifying keymaps and pointer button mappings in X

Added to portage

2026-07-22

xwininfo - 1.1.7
Ebuild name:

x11-apps/xwininfo-1.1.7

Description

window information utility for X

Added to portage

2026-07-22

zim - 0.77.1
Ebuild name:

x11-misc/zim-0.77.1

Description

A desktop wiki

Added to portage

2026-07-22

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