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:

86413

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-30
acl - 2.4.0
Ebuild name:

sys-apps/acl-2.4.0

Description

Access control list utilities, libraries, and headers

Added to portage

2026-06-30

attr - 2.6.0
Ebuild name:

sys-apps/attr-2.6.0

Description

Extended attributes tools

Added to portage

2026-06-30

bleachbit - 6.0.0
Ebuild name:

sys-apps/bleachbit-6.0.0

Description

Clean junk to free disk space and to maintain privacy

Added to portage

2026-06-30

burp - 3.3.0
Ebuild name:

app-backup/burp-3.3.0

Description

Network backup and restore client and server for Unix and Windows

Added to portage

2026-06-30

element - 1.12.22
Ebuild name:

www-apps/element-1.12.22

Description

A glossy Matrix collaboration client for the web

Added to portage

2026-06-30

git - 2.55.0
Ebuild name:

dev-vcs/git-2.55.0

Description

Stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2026-06-30

intel-metrics-discovery - 1.16.189
Ebuild name:

dev-libs/intel-metrics-discovery-1.16.189

Description

A user mode library that provides access to GPU performan

Added to portage

2026-06-30

intel-metrics-library - 1.0.234
Ebuild name:

dev-libs/intel-metrics-library-1.0.234

Description

User mode driver helper library that provides access to GPU

Added to portage

2026-06-30

just - 1.54.0
Ebuild name:

dev-build/just-1.54.0

Description

Just a command runner (with syntax inspired by 'make')

Added to portage

2026-06-30

keepassxc - 2.8.0_pre20260629
Ebuild name:

app-admin/keepassxc-2.8.0_pre20260629

Description

KeePassXC - KeePass Cross-platform Community Edition

Added to portage

2026-06-30

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

mercurial - 7.2.3
Ebuild name:

dev-vcs/mercurial-7.2.3

Description

Scalable distributed SCM

Added to portage

2026-06-30

nextcloud - 32.0.12
Ebuild name:

www-apps/nextcloud-32.0.12

Description

Personal cloud that runs on your own server

Added to portage

2026-06-30

nextcloud - 33.0.6
Ebuild name:

www-apps/nextcloud-33.0.6

Description

Personal cloud that runs on your own server

Added to portage

2026-06-30

nextcloud - 34.0.1
Ebuild name:

www-apps/nextcloud-34.0.1

Description

Personal cloud that runs on your own server

Added to portage

2026-06-30

openpgp-keys-acl - 20260629
Ebuild name:

sec-keys/openpgp-keys-acl-20260629

Description

OpenPGP keys used by sys-apps/acl

Added to portage

2026-06-30

openpgp-keys-bleachbit - 20250910
Ebuild name:

sec-keys/openpgp-keys-bleachbit-20250910

Description

OpenPGP keys used by the BleachBit developer

Added to portage

2026-06-30

platformio - 6.1.19-r2
Ebuild name:

dev-embedded/platformio-6.1.19-r2

Description

An open source ecosystem for IoT development

Added to portage

2026-06-30

rutorrent - 5.3.4
Ebuild name:

www-apps/rutorrent-5.3.4

Description

ruTorrent is a front-end for the popular Bittorrent client rTorrent

Added to portage

2026-06-30

shared-mime-info - 2.5.1
Ebuild name:

x11-misc/shared-mime-info-2.5.1

Description

The Shared MIME-info Database specification

Added to portage

2026-06-30

stellarium - 26.2
Ebuild name:

sci-astronomy/stellarium-26.2

Description

3D photo-realistic skies in real time

Added to portage

2026-06-30

tar - 1.35-r1
Ebuild name:

app-arch/tar-1.35-r1

Description

Use this to make tarballs

Added to portage

2026-06-30

xmlsec - 1.3.12
Ebuild name:

dev-libs/xmlsec-1.3.12

Description

Command line tool for signing, verifying, encrypting and decrypting XML

Added to portage

2026-06-30

zen-sources - 7.1.2
Ebuild name:

sys-kernel/zen-sources-7.1.2

Description

The Zen Kernel Live Sources

Added to portage

2026-06-30

zim - 0.77.0
Ebuild name:

x11-misc/zim-0.77.0

Description

A desktop wiki

Added to portage

2026-06-30

2026-06-29
apscheduler - 3.11.3
Ebuild name:

dev-python/apscheduler-3.11.3

Description

In-process task scheduler with Cron-like capabilities

Added to portage

2026-06-29

botan - 3.12.0
Ebuild name:

dev-libs/botan-3.12.0

Description

C++ crypto library

Added to portage

2026-06-29

bracex - 2.7
Ebuild name:

dev-python/bracex-2.7

Description

Bash style brace expansion for Python

Added to portage

2026-06-29

clang - 23.0.0_pre20260628
Ebuild name:

dev-python/clang-23.0.0_pre20260628

Description

Python bindings for llvm-core/clang

Added to portage

2026-06-29

clang - 23.0.0_pre20260628
Ebuild name:

llvm-core/clang-23.0.0_pre20260628

Description

C language family frontend for LLVM

Added to portage

2026-06-29

clang-common - 23.0.0_pre20260628
Ebuild name:

llvm-core/clang-common-23.0.0_pre20260628

Description

Common files shared between multiple slots of clang

Added to portage

2026-06-29

compiler-rt - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/compiler-rt-23.0.0_pre20260628

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-06-29

compiler-rt-sanitizers - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-23.0.0_pre20260628

Description

Compiler runtime libraries for clang (sanit

Added to portage

2026-06-29

courier - 2.0.2
Ebuild name:

mail-mta/courier-2.0.2

Description

An MTA designed specifically for maildirs

Added to portage

2026-06-29

courier-authlib - 0.73.1
Ebuild name:

net-libs/courier-authlib-0.73.1

Description

Courier authentication library

Added to portage

2026-06-29

elementpath - 5.1.3
Ebuild name:

dev-python/elementpath-5.1.3

Description

XPath 1.0/2.0 parsers and selectors for ElementTree and lxml

Added to portage

2026-06-29

flang - 23.0.0_pre20260628
Ebuild name:

llvm-core/flang-23.0.0_pre20260628

Description

LLVM's Fortran frontend

Added to portage

2026-06-29

flang-rt - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/flang-rt-23.0.0_pre20260628

Description

LLVM's Fortran runtime

Added to portage

2026-06-29

freecad - 1.1.1
Ebuild name:

media-gfx/freecad-1.1.1

Description

Qt based Computer Aided Design application

Added to portage

2026-06-29

gcc - 17.0.0_p20260628
Ebuild name:

sys-devel/gcc-17.0.0_p20260628

Description

The GNU Compiler Collection

Added to portage

2026-06-29

gdbus-codegen - 2.88.2
Ebuild name:

dev-util/gdbus-codegen-2.88.2

Description

GDBus code and documentation generator

Added to portage

2026-06-29

gentoo-zsh-completions - 20260628.1
Ebuild name:

app-shells/gentoo-zsh-completions-20260628.1

Description

Gentoo specific zsh completion support (includes emerg

Added to portage

2026-06-29

git-sources - 7.2_rc1
Ebuild name:

sys-kernel/git-sources-7.2_rc1

Description

The very latest -git version of the Linux kernel

Added to portage

2026-06-29

glib - 2.88.2
Ebuild name:

dev-libs/glib-2.88.2

Description

The GLib library of C routines

Added to portage

2026-06-29

glib-utils - 2.88.2
Ebuild name:

dev-util/glib-utils-2.88.2

Description

Build utilities for GLib using projects

Added to portage

2026-06-29

glibmm - 2.88.1
Ebuild name:

dev-cpp/glibmm-2.88.1

Description

C++ interface for glib2

Added to portage

2026-06-29

js8call - 3.0.2
Ebuild name:

media-radio/js8call-3.0.2

Description

Weak signal ham radio communication

Added to portage

2026-06-29

kubo - 0.41.0
Ebuild name:

net-p2p/kubo-0.41.0

Description

Main implementation of IPFS

Added to portage

2026-06-29

ldns - 1.9.2
Ebuild name:

net-libs/ldns-1.9.2

Description

Library that aims to simplify DNS programming in C

Added to portage

2026-06-29

libclc - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libclc-23.0.0_pre20260628

Description

OpenCL C library

Added to portage

2026-06-29

libcxx - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libcxx-23.0.0_pre20260628

Description

New implementation of the C++ standard library, targeting C

Added to portage

2026-06-29

libcxxabi - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libcxxabi-23.0.0_pre20260628

Description

Low level support for a standard C++ library

Added to portage

2026-06-29

libgcc - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libgcc-23.0.0_pre20260628

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2026-06-29

libtmux - 0.60.0
Ebuild name:

dev-python/libtmux-0.60.0

Description

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

Added to portage

2026-06-29

libunwind - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/libunwind-23.0.0_pre20260628

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-06-29

lit - 23.0.0_pre20260628
Ebuild name:

dev-python/lit-23.0.0_pre20260628

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-06-29

lld - 23.0.0_pre20260628
Ebuild name:

llvm-core/lld-23.0.0_pre20260628

Description

The LLVM linker (link editor)

Added to portage

2026-06-29

lldb - 23.0.0_pre20260628
Ebuild name:

llvm-core/lldb-23.0.0_pre20260628

Description

The LLVM debugger

Added to portage

2026-06-29

llvm - 23.0.0_pre20260628
Ebuild name:

dev-ml/llvm-23.0.0_pre20260628

Description

OCaml bindings for LLVM

Added to portage

2026-06-29

llvm - 23.0.0_pre20260628
Ebuild name:

llvm-core/llvm-23.0.0_pre20260628

Description

Low Level Virtual Machine

Added to portage

2026-06-29

llvm-common - 23.0.0_pre20260628
Ebuild name:

llvm-core/llvm-common-23.0.0_pre20260628

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-06-29

mlir - 23.0.0_pre20260628
Ebuild name:

llvm-core/mlir-23.0.0_pre20260628

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-06-29

moor - 2.15.1
Ebuild name:

sys-apps/moor-2.15.1

Description

Pager designed to do the right thing without any configuration

Added to portage

2026-06-29

nghttp3 - 1.17.0
Ebuild name:

net-libs/nghttp3-1.17.0

Description

HTTP/3 library written in C

Added to portage

2026-06-29

ngtcp2 - 1.24.0
Ebuild name:

net-libs/ngtcp2-1.24.0

Description

Implementation of the IETF QUIC Protocol

Added to portage

2026-06-29

ondselsolver - 1.0.1_p20260211
Ebuild name:

sci-libs/ondselsolver-1.0.1_p20260211

Description

Assembly Constraints and Multibody Dynamics code

Added to portage

2026-06-29

openmp - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/openmp-23.0.0_pre20260628

Description

OpenMP runtime libraries for LLVM/clang compiler

Added to portage

2026-06-29

openmp-amdgcn-amd-amdhsa - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/openmp-amdgcn-amd-amdhsa-23.0.0_pre20260628

Description

OpenMP target library for amdgcn devices

Added to portage

2026-06-29

openmp-nvptx64-nvidia-cuda - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/openmp-nvptx64-nvidia-cuda-23.0.0_pre20260628

Description

OpenMP target library for nvptx64 devic

Added to portage

2026-06-29

openmp-spirv64-intel - 23.0.0_pre20260628
Ebuild name:

llvm-runtimes/openmp-spirv64-intel-23.0.0_pre20260628

Description

OpenMP target library for spirv64 Intel devic

Added to portage

2026-06-29

pandas - 3.0.4
Ebuild name:

dev-python/pandas-3.0.4

Description

Powerful data structures for data analysis and statistics

Added to portage

2026-06-29

peewee - 4.1.1
Ebuild name:

dev-python/peewee-4.1.1

Description

Small Python ORM

Added to portage

2026-06-29

polly - 23.0.0_pre20260628
Ebuild name:

llvm-core/polly-23.0.0_pre20260628

Description

Polyhedral optimizations for LLVM

Added to portage

2026-06-29

pyglet - 2.1.15
Ebuild name:

dev-python/pyglet-2.1.15

Description

Cross-platform windowing and multimedia library for Python

Added to portage

2026-06-29

quimup - 2.1.2
Ebuild name:

media-sound/quimup-2.1.2

Description

Qt client for the music player daemon (MPD)

Added to portage

2026-06-29

rebulk - 4.2.2
Ebuild name:

dev-python/rebulk-4.2.2

Description

Python library that performs advanced searches in strings

Added to portage

2026-06-29

regex - 2026.6.28
Ebuild name:

dev-python/regex-2026.6.28

Description

Alternative regular expression module to replace re

Added to portage

2026-06-29

sqlite - 3.53.3
Ebuild name:

dev-db/sqlite-3.53.3

Description

SQL database engine

Added to portage

2026-06-29

squid - 7.6
Ebuild name:

net-proxy/squid-7.6

Description

Full-featured web proxy cache

Added to portage

2026-06-29

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