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:

90022

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-11-09
caddy - 2.11.9
Ebuild name:

www-servers/caddy-2.11.9

Description

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

Added to portage

2026-11-09

coinor-cbc - 2.10.12-r2
Ebuild name:

sci-libs/coinor-cbc-2.10.12-r2

Description

COIN-OR branch-and-cut mixed integer program solver

Added to portage

2026-11-09

coinor-cbc - 2.10.5-r2
Ebuild name:

sci-libs/coinor-cbc-2.10.5-r2

Description

COIN-OR branch-and-cut mixed integer program solver

Added to portage

2026-11-09

coinor-clp - 1.17.10-r1
Ebuild name:

sci-libs/coinor-clp-1.17.10-r1

Description

COIN-OR linear programming solver

Added to portage

2026-11-09

coinor-clp - 1.17.6-r2
Ebuild name:

sci-libs/coinor-clp-1.17.6-r2

Description

COIN-OR linear programming solver

Added to portage

2026-11-09

headscale - 0.29.7
Ebuild name:

net-vpn/headscale-0.29.7

Description

An open source, self-hosted implementation of the Tailscale control server

Added to portage

2026-11-09

ldl - 2.2.6-r1
Ebuild name:

sci-libs/ldl-2.2.6-r1

Description

Simple but educational LDL^T matrix factorization algorithm

Added to portage

2026-11-09

libmd - 1.2.0
Ebuild name:

app-crypt/libmd-1.2.0

Description

Message Digest functions from BSD systems

Added to portage

2026-11-09

libmd - 1.3.0
Ebuild name:

app-crypt/libmd-1.3.0

Description

Message Digest functions from BSD systems

Added to portage

2026-11-09

libscrypt - 1.22-r3
Ebuild name:

app-crypt/libscrypt-1.22-r3

Description

Shared library to implement the scrypt algorithm

Added to portage

2026-11-09

libsecret - 0.21.7
Ebuild name:

app-crypt/libsecret-0.21.7

Description

GObject library for accessing the freedesktop.org Secret Service API

Added to portage

2026-11-09

libsecret - 0.21.7-r1
Ebuild name:

app-crypt/libsecret-0.21.7-r1

Description

GObject library for accessing the freedesktop.org Secret Service API

Added to portage

2026-11-09

snapd - 2.63-r1
Ebuild name:

app-containers/snapd-2.63-r1

Description

Service and tools for management of snap packages

Added to portage

2026-11-09

2026-11-08
bracex - 3.2.2
Ebuild name:

dev-python/bracex-3.2.2

Description

Bash style brace expansion for Python

Added to portage

2026-11-08

cachetools - 8.0.0
Ebuild name:

dev-python/cachetools-8.0.0

Description

Extensible memoizing collections and decorators

Added to portage

2026-11-08

cairo - 1.18.6
Ebuild name:

x11-libs/cairo-1.18.6

Description

A vector graphics library with cross-device output support

Added to portage

2026-11-08

cargo-pgrx - 0.19.3
Ebuild name:

dev-util/cargo-pgrx-0.19.3

Description

pgrx A Rust framework for creating Postgres extensions

Added to portage

2026-11-08

chrony_exporter - 0.15.0
Ebuild name:

app-metrics/chrony_exporter-0.15.0

Description

Chrony NTP exporter for Prometheus

Added to portage

2026-11-08

clion - 2025.3.6.3
Ebuild name:

dev-util/clion-2025.3.6.3

Description

A complete toolset for C and C++ development

Added to portage

2026-11-08

clion - 2026.2.4
Ebuild name:

dev-util/clion-2026.2.4

Description

A complete toolset for C and C++ development

Added to portage

2026-11-08

clion - 2026.2.4.1
Ebuild name:

dev-util/clion-2026.2.4.1

Description

A complete toolset for C and C++ development

Added to portage

2026-11-08

cxxtools - 3.0-r5
Ebuild name:

dev-libs/cxxtools-3.0-r5

Description

Collection of general purpose C++-classes

Added to portage

2026-11-08

datovka - 4.29.5
Ebuild name:

app-misc/datovka-4.29.5

Description

GUI to access the Czech data box e-government system

Added to portage

2026-11-08

dcmtk - 3.7.1
Ebuild name:

sci-libs/dcmtk-3.7.1

Description

The DICOM Toolkit

Added to portage

2026-11-08

django-sortedm2m - 4.1.0
Ebuild name:

dev-python/django-sortedm2m-4.1.0

Description

Drop-in replacement for django's many to many field with sorted r

Added to portage

2026-11-08

dolphin - 2609b
Ebuild name:

games-emulation/dolphin-2609b

Description

Gamecube and Wii game emulator

Added to portage

2026-11-08

fastapi - 0.162.2
Ebuild name:

dev-python/fastapi-0.162.2

Description

High performance framework, easy to learn, fast to code, ready for produ

Added to portage

2026-11-08

fd - 10.5.2
Ebuild name:

sys-apps/fd-10.5.2

Description

Alternative to find that provides sensible defaults for 80% of the use cases

Added to portage

2026-11-08

freeradius - 3.2.10-r1
Ebuild name:

net-dialup/freeradius-3.2.10-r1

Description

Highly configurable free RADIUS server

Added to portage

2026-11-08

gatling - 0.16-r7
Ebuild name:

www-servers/gatling-0.16-r7

Description

High performance web server

Added to portage

2026-11-08

gcc - 14.4.1_p20261105
Ebuild name:

sys-devel/gcc-14.4.1_p20261105

Description

The GNU Compiler Collection

Added to portage

2026-11-08

gcc - 15.3.1_p20261106
Ebuild name:

sys-devel/gcc-15.3.1_p20261106

Description

The GNU Compiler Collection

Added to portage

2026-11-08

gcc - 16.2.1_p20261107
Ebuild name:

sys-devel/gcc-16.2.1_p20261107

Description

The GNU Compiler Collection

Added to portage

2026-11-08

gensio - 3.0.4
Ebuild name:

net-misc/gensio-3.0.4

Description

General Stream I/O

Added to portage

2026-11-08

goland - 2026.1.5.1
Ebuild name:

dev-util/goland-2026.1.5.1

Description

Golang IDE by JetBrains

Added to portage

2026-11-08

goland - 2026.2.4
Ebuild name:

dev-util/goland-2026.2.4

Description

Golang IDE by JetBrains

Added to portage

2026-11-08

google-cloud-cpp - 2.30.0-r1
Ebuild name:

net-libs/google-cloud-cpp-2.30.0-r1

Description

Google Cloud Client Library for C++

Added to portage

2026-11-08

gost-engine - 3.0.5
Ebuild name:

dev-libs/gost-engine-3.0.5

Description

A reference implementation of the Russian GOST crypto algorithms for Ope

Added to portage

2026-11-08

gsoap - 2.8.146
Ebuild name:

net-libs/gsoap-2.8.146

Description

A cross-platform open source C and C++ SDK for SOAP/XML Web services

Added to portage

2026-11-08

hostapd - 2.12
Ebuild name:

net-wireless/hostapd-2.12

Description

IEEE 802.11 wireless LAN Host AP daemon

Added to portage

2026-11-08

ima-evm-utils - 1.7
Ebuild name:

app-crypt/ima-evm-utils-1.7

Description

Supporting tools for IMA and EVM

Added to portage

2026-11-08

imake - 1.0.11
Ebuild name:

x11-misc/imake-1.0.11

Description

C preprocessor interface to the make utility

Added to portage

2026-11-08

jenkins-bin - 2.580.2
Ebuild name:

dev-util/jenkins-bin-2.580.2

Description

The leading open source automation server

Added to portage

2026-11-08

kea - 3.0.5
Ebuild name:

net-misc/kea-3.0.5

Description

High-performance production grade DHCPv4 & DHCPv6 server

Added to portage

2026-11-08

kea - 3.2.1
Ebuild name:

net-misc/kea-3.2.1

Description

High-performance production grade DHCPv4 & DHCPv6 server

Added to portage

2026-11-08

khard - 0.22.0
Ebuild name:

app-misc/khard-0.22.0

Description

Console vCard address book

Added to portage

2026-11-08

kvirc - 5.2.10-r1
Ebuild name:

net-irc/kvirc-5.2.10-r1

Description

Advanced IRC Client

Added to portage

2026-11-08

libbgcode - 0.0.20260722-r1
Ebuild name:

media-gfx/libbgcode-0.0.20260722-r1

Description

Prusa Block & Binary G-code reader / writer / converter

Added to portage

2026-11-08

libdatovka - 0.8.0
Ebuild name:

app-misc/libdatovka-0.8.0

Description

Client library for accessing ISDS SOAP services

Added to portage

2026-11-08

lua-openssl - 0.11.1_p1
Ebuild name:

dev-lua/lua-openssl-0.11.1_p1

Description

OpenSSL binding for Lua

Added to portage

2026-11-08

luau - 0.746
Ebuild name:

dev-lang/luau-0.746

Description

Gradually typed embeddable scripting language derived from Lua

Added to portage

2026-11-08

magit - 4.7.2
Ebuild name:

app-emacs/magit-4.7.2

Description

A Git porcelain inside Emacs

Added to portage

2026-11-08

neomutt - 20260616-r1
Ebuild name:

mail-client/neomutt-20260616-r1

Description

A small but very powerful text-based mail client

Added to portage

2026-11-08

openmpi - 5.0.9-r2
Ebuild name:

sys-cluster/openmpi-5.0.9-r2

Description

A high-performance message passing library (MPI)

Added to portage

2026-11-08

openpace - 1.1.4-r1
Ebuild name:

dev-libs/openpace-1.1.4-r1

Description

Cryptographic library for EAC version 2

Added to portage

2026-11-08

pikepdf - 10.18.0
Ebuild name:

dev-python/pikepdf-10.18.0

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-11-08

prusaslicer - 2.9.7-r1
Ebuild name:

media-gfx/prusaslicer-2.9.7-r1

Description

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

Added to portage

2026-11-08

pycharm-professional - 2026.1.5.1
Ebuild name:

dev-util/pycharm-professional-2026.1.5.1

Description

Intelligent Python IDE with unique code assistance and ana

Added to portage

2026-11-08

pycharm-professional - 2026.2.4
Ebuild name:

dev-util/pycharm-professional-2026.2.4

Description

Intelligent Python IDE with unique code assistance and analy

Added to portage

2026-11-08

pycryptodome - 4.4.0
Ebuild name:

dev-python/pycryptodome-4.4.0

Description

A self-contained cryptographic library for Python

Added to portage

2026-11-08

pyproject-api - 1.12.5
Ebuild name:

dev-python/pyproject-api-1.12.5

Description

API to interact with the python pyproject.toml based projects

Added to portage

2026-11-08

pyshp - 3.1.7
Ebuild name:

sci-libs/pyshp-3.1.7

Description

Pure Python read/write support for ESRI Shapefile format

Added to portage

2026-11-08

rabbitmq-c - 0.18.1
Ebuild name:

net-libs/rabbitmq-c-0.18.1

Description

RabbitMQ C client

Added to portage

2026-11-08

rustup - 1.29.3
Ebuild name:

dev-util/rustup-1.29.3

Description

Rust toolchain installer

Added to portage

2026-11-08

ser2net - 4.6.2-r1
Ebuild name:

net-misc/ser2net-4.6.2-r1

Description

Serial To Network Proxy

Added to portage

2026-11-08

ser2net - 4.6.8
Ebuild name:

net-misc/ser2net-4.6.8

Description

Serial To Network Proxy

Added to portage

2026-11-08

soju - 0.11.1
Ebuild name:

net-irc/soju-0.11.1

Description

soju is a user-friendly IRC bouncer

Added to portage

2026-11-08

types-docutils - 0.23.0.20261107
Ebuild name:

dev-python/types-docutils-0.23.0.20261107

Description

Typing stubs for docutils

Added to portage

2026-11-08

uim - 1.9.9
Ebuild name:

app-i18n/uim-1.9.9

Description

Multilingual input method framework

Added to portage

2026-11-08

unrealircd - 6.2.7.1
Ebuild name:

net-irc/unrealircd-6.2.7.1

Description

An advanced Internet Relay Chat daemon

Added to portage

2026-11-08

wcmatch - 12.0.1
Ebuild name:

dev-python/wcmatch-12.0.1

Description

Wildcard/glob file name matcher

Added to portage

2026-11-08

websocat - 1.14.1-r1
Ebuild name:

net-misc/websocat-1.14.1-r1

Description

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

Added to portage

2026-11-08

yaskkserv2 - 0.1.7-r2
Ebuild name:

app-i18n/yaskkserv2-0.1.7-r2

Description

Yet Another SKK server

Added to portage

2026-11-08

zig - 0.17.1
Ebuild name:

dev-lang/zig-0.17.1

Description

A robust, optimal, and maintainable programming language

Added to portage

2026-11-08

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