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:

86109

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-21
gentoo-kernel-modprep - 6.1.176
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.1.176

Description

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

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.12.94
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.12.94

Description

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

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.18.36
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.36

Description

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

Added to portage

2026-06-21

gentoo-kernel-modprep - 6.6.143
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.6.143

Description

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

Added to portage

2026-06-21

kquickimageeditor - 0.6.2
Ebuild name:

media-libs/kquickimageeditor-0.6.2

Description

QtQuick components providing basic image editing capabilities

Added to portage

2026-06-21

openrc - 0.63.2
Ebuild name:

sys-apps/openrc-0.63.2

Description

OpenRC manages the services, startup and shutdown of a host

Added to portage

2026-06-21

systemd - 261
Ebuild name:

sys-apps/systemd-261

Description

System and service manager for Linux

Added to portage

2026-06-21

virtualbox-modules - 7.2.10-r1
Ebuild name:

app-emulation/virtualbox-modules-7.2.10-r1

Description

Kernel Modules for Virtualbox

Added to portage

2026-06-21

2026-06-20
atari800 - 6.0.0
Ebuild name:

games-emulation/atari800-6.0.0

Description

Emulator of Atari 8-bit computer systems and 5200 game console

Added to portage

2026-06-20

aws-session-manager-plugin - 1.2.835.0
Ebuild name:

app-admin/aws-session-manager-plugin-1.2.835.0

Description

AWS Session Manager Plugin for aws-cli

Added to portage

2026-06-20

awscli - 1.45.34
Ebuild name:

app-admin/awscli-1.45.34

Description

Universal Command Line Environment for AWS

Added to portage

2026-06-20

boto3 - 1.43.34
Ebuild name:

dev-python/boto3-1.43.34

Description

The AWS SDK for Python

Added to portage

2026-06-20

botocore - 1.43.34
Ebuild name:

dev-python/botocore-1.43.34

Description

Low-level, data-driven core of boto 3

Added to portage

2026-06-20

cake - 6.2.0
Ebuild name:

dev-dotnet/cake-6.2.0

Description

Cake (C Make) is a cross platform build automation system with a C DSL

Added to portage

2026-06-20

cmark-gfm - 0.29.0.13-r2
Ebuild name:

app-text/cmark-gfm-0.29.0.13-r2

Description

GitHub's fork of cmark

Added to portage

2026-06-20

csharp-language-server - 0.25.0
Ebuild name:

dev-dotnet/csharp-language-server-0.25.0

Description

Roslyn-based LSP language server for C

Added to portage

2026-06-20

cvise - 2.12.0-r1
Ebuild name:

dev-util/cvise-2.12.0-r1

Description

Super-parallel Python port of the C-Reduce

Added to portage

2026-06-20

ffmpeg - 7.1.5
Ebuild name:

media-video/ffmpeg-7.1.5

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-20

ffmpeg-compat - 7.1.5
Ebuild name:

media-video/ffmpeg-compat-7.1.5

Description

Complete solution to record/convert/stream audio and video

Added to portage

2026-06-20

fluent-icon-theme - 2026.06.19
Ebuild name:

x11-themes/fluent-icon-theme-2026.06.19

Description

Fluent icon theme for Linux desktops

Added to portage

2026-06-20

gcc - 14.3.1_p20260619
Ebuild name:

sys-devel/gcc-14.3.1_p20260619

Description

The GNU Compiler Collection

Added to portage

2026-06-20

gcc - 15.3.1_p20260619
Ebuild name:

sys-devel/gcc-15.3.1_p20260619

Description

The GNU Compiler Collection

Added to portage

2026-06-20

gherkin-official - 41.0.0
Ebuild name:

dev-python/gherkin-official-41.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-06-20

gnome-shell-extension-desktop-icons-ng - 50.3.0
Ebuild name:

gnome-extra/gnome-shell-extension-desktop-icons-ng-50.3.0

Description

Desktop icon support for GNOME Shell

Added to portage

2026-06-20

gnome-shell-extension-weather-oclock - 50.4
Ebuild name:

gnome-extra/gnome-shell-extension-weather-oclock-50.4

Description

Display the current weather inside the pill n

Added to portage

2026-06-20

homebank - 5.10.2
Ebuild name:

app-office/homebank-5.10.2

Description

Free, easy, personal accounting for everyone

Added to portage

2026-06-20

hypothesis - 6.155.6
Ebuild name:

dev-python/hypothesis-6.155.6

Description

A library for property based testing

Added to portage

2026-06-20

inline-snapshot - 0.34.2
Ebuild name:

dev-python/inline-snapshot-0.34.2

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-06-20

json5 - 0.15.0
Ebuild name:

dev-python/json5-0.15.0

Description

A Python implementation of the JSON5 data format

Added to portage

2026-06-20

libgpg-error - 1.61
Ebuild name:

dev-libs/libgpg-error-1.61

Description

Contains error handling functions used by GnuPG software

Added to portage

2026-06-20

libnvme - 1.16.2
Ebuild name:

sys-libs/libnvme-1.16.2

Description

C Library for NVM Express on Linux

Added to portage

2026-06-20

mgorny-dev-scripts - 81
Ebuild name:

app-portage/mgorny-dev-scripts-81

Description

Handy scripts for ebuild development and more

Added to portage

2026-06-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-06-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-06-20

mit-krb5 - 1.22.2-r2
Ebuild name:

app-crypt/mit-krb5-1.22.2-r2

Description

MIT Kerberos V

Added to portage

2026-06-20

mit-krb5-appl - 1.0.3-r4
Ebuild name:

app-crypt/mit-krb5-appl-1.0.3-r4

Description

Kerberized applications split from the main MIT Kerberos V distrib

Added to portage

2026-06-20

mit-krb5-appl - 1.0.3-r5
Ebuild name:

app-crypt/mit-krb5-appl-1.0.3-r5

Description

Kerberized applications split from the main MIT Kerberos V distrib

Added to portage

2026-06-20

mkp224o - 1.7.0
Ebuild name:

app-crypt/mkp224o-1.7.0

Description

Vanity address generator for v3 Tor hidden service addresses

Added to portage

2026-06-20

monkeysphere - 0.44-r2
Ebuild name:

app-crypt/monkeysphere-0.44-r2

Description

Leverage the OpenPGP web of trust for OpenSSH and Web authentication

Added to portage

2026-06-20

mu - 1.14.2
Ebuild name:

net-mail/mu-1.14.2

Description

Set of tools to deal with Maildirs, in particular, searching and indexing

Added to portage

2026-06-20

pecl-http - 4.3.1-r1
Ebuild name:

dev-php/pecl-http-4.3.1-r1

Description

Extended HTTP Support for PHP

Added to portage

2026-06-20

pikepdf - 10.9.1
Ebuild name:

dev-python/pikepdf-10.9.1

Description

Python library to work with pdf files based on qpdf

Added to portage

2026-06-20

pwsh - 7.6.3
Ebuild name:

app-shells/pwsh-7.6.3

Description

Cross-platform automation and configuration tool

Added to portage

2026-06-20

pwsh-bin - 7.6.3
Ebuild name:

app-shells/pwsh-bin-7.6.3

Description

Cross-platform automation and configuration tool (binary package)

Added to portage

2026-06-20

pydantic-settings - 2.14.2
Ebuild name:

dev-python/pydantic-settings-2.14.2

Description

Settings management using Pydantic

Added to portage

2026-06-20

pyro5 - 5.17
Ebuild name:

dev-python/pyro5-5.17

Description

Distributed object middleware for Python (RPC)

Added to portage

2026-06-20

pytest - 9.1.1
Ebuild name:

dev-python/pytest-9.1.1

Description

Simple powerful testing with Python

Added to portage

2026-06-20

pythonnet - 3.1.0
Ebuild name:

dev-python/pythonnet-3.1.0

Description

Nearly seamless integration with the .NET Common Language Runtime

Added to portage

2026-06-20

rbst - 0.6.5-r2
Ebuild name:

dev-ruby/rbst-0.6.5-r2

Description

A simple Ruby wrapper for processing rST via docutils

Added to portage

2026-06-20

scipy - 1.18.0
Ebuild name:

dev-python/scipy-1.18.0

Description

Scientific algorithms library for Python

Added to portage

2026-06-20

spotify - 1.2.92
Ebuild name:

media-sound/spotify-1.2.92

Description

Spotify is a social music platform

Added to portage

2026-06-20

sssd - 2.13.1
Ebuild name:

sys-auth/sssd-2.13.1

Description

System Security Services Daemon provides access to identity and authentication

Added to portage

2026-06-20

synapse - 1.155.0
Ebuild name:

net-im/synapse-1.155.0

Description

Reference implementation of Matrix homeserver

Added to portage

2026-06-20

telegram-desktop - 6.9.3
Ebuild name:

net-im/telegram-desktop-6.9.3

Description

Official desktop client for Telegram

Added to portage

2026-06-20

thermald - 2.5.12
Ebuild name:

sys-power/thermald-2.5.12

Description

Thermal daemon for Intel architectures

Added to portage

2026-06-20

time - 1.10
Ebuild name:

sys-process/time-1.10

Description

Displays info about resources used by a program

Added to portage

2026-06-20

toomanycooks - 1.6.1
Ebuild name:

dev-cpp/toomanycooks-1.6.1

Description

C++20 concurrency framework with no compromises

Added to portage

2026-06-20

uv - 0.11.23
Ebuild name:

dev-python/uv-0.11.23

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-06-20

uv-build - 0.11.23
Ebuild name:

dev-python/uv-build-0.11.23

Description

PEP517 uv build backend

Added to portage

2026-06-20

wsjtx_improved - 3.1.0_p260522
Ebuild name:

media-radio/wsjtx_improved-3.1.0_p260522

Description

Weak signal ham radio communication with improvements

Added to portage

2026-06-20

xl2tpd - 1.3.20-r1
Ebuild name:

net-dialup/xl2tpd-1.3.20-r1

Description

A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon

Added to portage

2026-06-20

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