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:

87029

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-20
sdl2-mixer - 2.8.1-r4
Ebuild name:

media-libs/sdl2-mixer-2.8.1-r4

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

sdl2-mixer - 2.8.2-r1
Ebuild name:

media-libs/sdl2-mixer-2.8.2-r1

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

stb - 20260415-r1
Ebuild name:

dev-libs/stb-20260415-r1

Description

Single-file C/C++ libraries for various purposes

Added to portage

2026-07-20

2026-07-19
antlr - 4.13.2-r1
Ebuild name:

dev-java/antlr-4.13.2-r1

Description

A parser generator for many languages

Added to portage

2026-07-19

antlr-runtime - 4.13.2-r1
Ebuild name:

dev-java/antlr-runtime-4.13.2-r1

Description

ANTLR 4 Runtime

Added to portage

2026-07-19

antlr-tool - 4.13.2-r2
Ebuild name:

dev-java/antlr-tool-4.13.2-r2

Description

The ANTLR 4 grammar compiler

Added to portage

2026-07-19

binding_of_caller - 2.0.0
Ebuild name:

dev-ruby/binding_of_caller-2.0.0

Description

Retrieve the binding of a method's caller

Added to portage

2026-07-19

chrome-binary-plugins - 150.0.7871.128
Ebuild name:

www-plugins/chrome-binary-plugins-150.0.7871.128

Description

Binary plugins from Google Chrome for use in Chrom

Added to portage

2026-07-19

chrome-binary-plugins - 151.0.7922.34_beta
Ebuild name:

www-plugins/chrome-binary-plugins-151.0.7922.34_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-07-19

chrome-binary-plugins - 152.0.7953.3_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-152.0.7953.3_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-07-19

chromedriver-bin - 150.0.7871.128
Ebuild name:

www-apps/chromedriver-bin-150.0.7871.128

Description

WebDriver for Chrome

Added to portage

2026-07-19

chromium - 150.0.7871.128
Ebuild name:

www-client/chromium-150.0.7871.128

Description

Open-source version of Google Chrome web browser

Added to portage

2026-07-19

cpp-httplib - 0.50.1
Ebuild name:

dev-cpp/cpp-httplib-0.50.1

Description

C++ HTTP/HTTPS server and client library

Added to portage

2026-07-19

diffoscope - 325
Ebuild name:

dev-util/diffoscope-325

Description

Will try to get to the bottom of what makes files or directories different

Added to portage

2026-07-19

dist-kernel - 6.12.96
Ebuild name:

virtual/dist-kernel-6.12.96

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

dist-kernel - 6.18.39
Ebuild name:

virtual/dist-kernel-6.18.39

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

dist-kernel - 7.1.4
Ebuild name:

virtual/dist-kernel-7.1.4

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

django-configurations - 2.5.1-r1
Ebuild name:

dev-python/django-configurations-2.5.1-r1

Description

A helper for organizing Django settings

Added to portage

2026-07-19

ffmpeg-chromium - 150.0.7871.124
Ebuild name:

media-video/ffmpeg-chromium-150.0.7871.124

Description

FFmpeg built specifically for codec support in Chromium-

Added to portage

2026-07-19

filelock - 3.31.0
Ebuild name:

dev-python/filelock-3.31.0

Description

A platform independent file lock for Python

Added to portage

2026-07-19

fzf - 0.74.1
Ebuild name:

app-shells/fzf-0.74.1

Description

General-purpose command-line fuzzy finder, written in Golang

Added to portage

2026-07-19

gcc - 13.4.1_p20260715
Ebuild name:

sys-devel/gcc-13.4.1_p20260715

Description

The GNU Compiler Collection

Added to portage

2026-07-19

gcc - 14.4.1_p20260716
Ebuild name:

sys-devel/gcc-14.4.1_p20260716

Description

The GNU Compiler Collection

Added to portage

2026-07-19

gcc - 15.3.1_p20260717
Ebuild name:

sys-devel/gcc-15.3.1_p20260717

Description

The GNU Compiler Collection

Added to portage

2026-07-19

gcc - 16.1.1_p20260718
Ebuild name:

sys-devel/gcc-16.1.1_p20260718

Description

The GNU Compiler Collection

Added to portage

2026-07-19

gentoo-kernel - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-6.12.96

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-6.18.39

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-7.1.4

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.96

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.39

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.1.4

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-modprep - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.12.96

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-07-19

gentoo-kernel-modprep - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.39

Description

Minimal subset of gentoo-kernel-bin for building modules,

Added to portage

2026-07-19

gentoo-kernel-modprep - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-modprep-7.1.4

Description

Minimal subset of gentoo-kernel-bin for building modules, fo

Added to portage

2026-07-19

google-chrome - 150.0.7871.128
Ebuild name:

www-client/google-chrome-150.0.7871.128

Description

The web browser from Google

Added to portage

2026-07-19

google-chrome-beta - 151.0.7922.34
Ebuild name:

www-client/google-chrome-beta-151.0.7922.34

Description

The web browser from Google

Added to portage

2026-07-19

google-chrome-unstable - 152.0.7953.3
Ebuild name:

www-client/google-chrome-unstable-152.0.7953.3

Description

The web browser from Google

Added to portage

2026-07-19

gopls - 0.23.0
Ebuild name:

dev-go/gopls-0.23.0

Description

Added to portage

2026-07-19

gpep517 - 20
Ebuild name:

dev-python/gpep517-20

Description

A backend script to aid installing Python packages in Gentoo

Added to portage

2026-07-19

hypothesis - 6.156.9
Ebuild name:

dev-python/hypothesis-6.156.9

Description

A library for property based testing

Added to portage

2026-07-19

icinga-php-thirdparty - 0.15.3
Ebuild name:

dev-libs/icinga-php-thirdparty-0.15.3

Description

Icinga PHP libraries for Icinga Web 2

Added to portage

2026-07-19

icingaweb2-module-director - 1.11.9
Ebuild name:

www-apps/icingaweb2-module-director-1.11.9

Description

Icinga Web 2 plugin for configuration

Added to portage

2026-07-19

intellij-idea - 2026.2
Ebuild name:

dev-util/intellij-idea-2026.2

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-07-19

jsonb-api - 2.0.0-r1
Ebuild name:

dev-java/jsonb-api-2.0.0-r1

Description

Jakarta JSON Binding

Added to portage

2026-07-19

jwt - 2.10.3
Ebuild name:

dev-ruby/jwt-2.10.3

Description

A Ruby implementation of JSON Web Token draft 06

Added to portage

2026-07-19

jwt - 3.2.0
Ebuild name:

dev-ruby/jwt-3.2.0

Description

A Ruby implementation of JSON Web Token draft 06

Added to portage

2026-07-19

kdiff3 - 1.12.5
Ebuild name:

kde-misc/kdiff3-1.12.5

Description

Frontend to diff3 based on KDE Frameworks

Added to portage

2026-07-19

kimageformats - 6.28.0-r1
Ebuild name:

kde-frameworks/kimageformats-6.28.0-r1

Description

Framework providing additional format plugins for Qt's image

Added to portage

2026-07-19

libgit2 - 1.9.6
Ebuild name:

dev-libs/libgit2-1.9.6

Description

A linkable library for Git

Added to portage

2026-07-19

libssh2 - 1.11.1-r2
Ebuild name:

net-libs/libssh2-1.11.1-r2

Description

Library implementing the SSH2 protocol

Added to portage

2026-07-19

matplotlib - 3.11.1
Ebuild name:

dev-python/matplotlib-3.11.1

Description

Pure python plotting library with matlab like syntax

Added to portage

2026-07-19

mattermost-desktop-bin - 6.3.0_rc1
Ebuild name:

net-im/mattermost-desktop-bin-6.3.0_rc1

Description

Mattermost Desktop application

Added to portage

2026-07-19

mergiraf - 0.18.0
Ebuild name:

dev-vcs/mergiraf-0.18.0

Description

Syntax-aware git merge driver

Added to portage

2026-07-19

metasm - 1.0.5-r3
Ebuild name:

dev-ruby/metasm-1.0.5-r3

Description

Cross-architecture assembler, disassembler, linker, and debugger

Added to portage

2026-07-19

microsoft-edge - 150.0.4078.83
Ebuild name:

www-client/microsoft-edge-150.0.4078.83

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-beta - 150.0.4078.65
Ebuild name:

www-client/microsoft-edge-beta-150.0.4078.65

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-beta - 151.0.4129.15
Ebuild name:

www-client/microsoft-edge-beta-151.0.4129.15

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-beta - 151.0.4129.21
Ebuild name:

www-client/microsoft-edge-beta-151.0.4129.21

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-dev - 151.0.4129.21
Ebuild name:

www-client/microsoft-edge-dev-151.0.4129.21

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-dev - 151.0.4129.8
Ebuild name:

www-client/microsoft-edge-dev-151.0.4129.8

Description

The web browser from Microsoft

Added to portage

2026-07-19

microsoft-edge-dev - 152.0.4148.0
Ebuild name:

www-client/microsoft-edge-dev-152.0.4148.0

Description

The web browser from Microsoft

Added to portage

2026-07-19

multipart - 2.0.0
Ebuild name:

dev-python/multipart-2.0.0

Description

Parser for multipart/form-data

Added to portage

2026-07-19

mycli - 2.3.0
Ebuild name:

dev-db/mycli-2.3.0

Description

CLI for MySQL Database with auto-completion and syntax highlighting

Added to portage

2026-07-19

ngircd - 28
Ebuild name:

net-irc/ngircd-28

Description

An IRC server written from scratch

Added to portage

2026-07-19

nss - 3.126
Ebuild name:

dev-libs/nss-3.126

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-07-19

numexpr - 2.14.2
Ebuild name:

dev-python/numexpr-2.14.2

Description

Fast numerical array expression evaluator for Python and NumPy

Added to portage

2026-07-19

nwipe - 0.41
Ebuild name:

app-crypt/nwipe-0.41

Description

Securely erase disks using a variety of recognized methods

Added to portage

2026-07-19

onak - 0.6.3
Ebuild name:

app-crypt/onak-0.6.3

Description

onak is an OpenPGP keyserver

Added to portage

2026-07-19

openpgp-keys-alexbarton - 20260718
Ebuild name:

sec-keys/openpgp-keys-alexbarton-20260718

Description

OpenPGP keys used by Alex Barton

Added to portage

2026-07-19

openpgp-keys-nabijaczleweli - 20260717
Ebuild name:

sec-keys/openpgp-keys-nabijaczleweli-20260717

Description

OpenPGP keys used by ??? (nabijaczleweli)

Added to portage

2026-07-19

openrsync - 0.5.0_p20260706
Ebuild name:

net-misc/openrsync-0.5.0_p20260706

Description

BSD-licensed implementation of rsync

Added to portage

2026-07-19

openrsync - 9999
Ebuild name:

net-misc/openrsync-9999

Description

BSD-licensed implementation of rsync

Added to portage

2026-07-19

openssh - 10.4_p1-r1
Ebuild name:

net-misc/openssh-10.4_p1-r1

Description

Port of OpenBSD's free SSH release

Added to portage

2026-07-19

opera - 133.0.5932.60
Ebuild name:

www-client/opera-133.0.5932.60

Description

A fast and secure web browser

Added to portage

2026-07-19

opera-developer - 134.0.5945.0
Ebuild name:

www-client/opera-developer-134.0.5945.0

Description

A fast and secure web browser

Added to portage

2026-07-19

opera-developer - 134.0.5952.0
Ebuild name:

www-client/opera-developer-134.0.5952.0

Description

A fast and secure web browser

Added to portage

2026-07-19

opera-developer - 135.0.5960.0
Ebuild name:

www-client/opera-developer-135.0.5960.0

Description

A fast and secure web browser

Added to portage

2026-07-19

ossp-uuid - 1.6.6
Ebuild name:

dev-libs/ossp-uuid-1.6.6

Description

An ISO-C API with CLI for generating DCE, ISO/IEC and RFC compliant UUID

Added to portage

2026-07-19

pbs-installer - 2026.7.18
Ebuild name:

dev-python/pbs-installer-2026.7.18

Description

Installer for Python Build Standalone

Added to portage

2026-07-19

pecl-xattr - 1.4.1-r1
Ebuild name:

dev-php/pecl-xattr-1.4.1-r1

Description

Extended attributes for PHP

Added to portage

2026-07-19

platformdirs - 4.10.1
Ebuild name:

dev-python/platformdirs-4.10.1

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-07-19

regex - 2026.7.19
Ebuild name:

dev-python/regex-2026.7.19

Description

Alternative regular expression module to replace re

Added to portage

2026-07-19

service-manager - 3
Ebuild name:

virtual/service-manager-3

Description

Virtual for various service managers

Added to portage

2026-07-19

sigil - 2.8.1
Ebuild name:

app-text/sigil-2.8.1

Description

Multi-platform WYSIWYG ebook editor for ePub format

Added to portage

2026-07-19

solfege - 3.23.4-r1
Ebuild name:

media-sound/solfege-3.23.4-r1

Description

GNU program to help practicing ear training

Added to portage

2026-07-19

sphinxcontrib-mermaid - 2.1.0
Ebuild name:

dev-python/sphinxcontrib-mermaid-2.1.0

Description

Sphinx spelling extension

Added to portage

2026-07-19

strawberry - 1.2.23
Ebuild name:

media-sound/strawberry-1.2.23

Description

Modern music player and library organizer based on Clementine and Qt

Added to portage

2026-07-19

telegram-desktop - 7.0.2
Ebuild name:

net-im/telegram-desktop-7.0.2

Description

Official desktop client for Telegram

Added to portage

2026-07-19

telegram-desktop-bin - 7.0.1
Ebuild name:

net-im/telegram-desktop-bin-7.0.1

Description

Official desktop client for Telegram (binary package)

Added to portage

2026-07-19

tibs - 1.1.0
Ebuild name:

dev-python/tibs-1.1.0

Description

A sleek Python library for your binary data

Added to portage

2026-07-19

valijson - 1.1.2
Ebuild name:

dev-cpp/valijson-1.1.2

Description

Header-only C++ library for JSON Schema validation

Added to portage

2026-07-19

vanilla-kernel - 6.12.96
Ebuild name:

sys-kernel/vanilla-kernel-6.12.96

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

vanilla-kernel - 6.18.39
Ebuild name:

sys-kernel/vanilla-kernel-6.18.39

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

vanilla-kernel - 7.1.4
Ebuild name:

sys-kernel/vanilla-kernel-7.1.4

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

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