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:

83480

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.6 (45 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-03-01
chrony_exporter - 0.13.2
Ebuild name:

app-metrics/chrony_exporter-0.13.2

Description

Chrony NTP exporter for Prometheus

Added to portage

2026-03-01

mumble - 1.6.0_pre20250920-r3
Ebuild name:

net-voip/mumble-1.6.0_pre20250920-r3

Description

Mumble is an open source, low-latency, high quality voice chat

Added to portage

2026-03-01

mumble - 1.6.0_pre20260215-r2
Ebuild name:

net-voip/mumble-1.6.0_pre20260215-r2

Description

Open source, low-latency, high quality voice chat software

Added to portage

2026-03-01

zoom - 6.7.5.6891-r1
Ebuild name:

net-im/zoom-6.7.5.6891-r1

Description

Video conferencing and web conferencing service

Added to portage

2026-03-01

2026-02-28
agate - 1.14.2
Ebuild name:

dev-python/agate-1.14.2

Description

A Python data analysis library that is optimized for humans instead of mach

Added to portage

2026-02-28

automx2 - 2026.1
Ebuild name:

net-mail/automx2-2026.1

Description

Mail User Agent (email client) configuration made easy

Added to portage

2026-02-28

awscli - 1.44.49
Ebuild name:

app-admin/awscli-1.44.49

Description

Universal Command Line Environment for AWS

Added to portage

2026-02-28

blessed - 1.31.0
Ebuild name:

dev-python/blessed-1.31.0

Description

Library for making terminal apps using colors, keyboard input and positio

Added to portage

2026-02-28

boto3 - 1.42.59
Ebuild name:

dev-python/boto3-1.42.59

Description

The AWS SDK for Python

Added to portage

2026-02-28

botocore - 1.42.59
Ebuild name:

dev-python/botocore-1.42.59

Description

Low-level, data-driven core of boto 3

Added to portage

2026-02-28

claude-code - 2.1.62
Ebuild name:

dev-util/claude-code-2.1.62

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-02-28

dist-kernel - 6.18.15
Ebuild name:

virtual/dist-kernel-6.18.15

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-02-28

dist-kernel - 6.19.5
Ebuild name:

virtual/dist-kernel-6.19.5

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-02-28

doggo - 1.1.5
Ebuild name:

net-dns/doggo-1.1.5

Description

Command-line DNS Client for Humans

Added to portage

2026-02-28

dracut - 110-r2
Ebuild name:

sys-kernel/dracut-110-r2

Description

Generic initramfs generation tool

Added to portage

2026-02-28

electrum - 4.7.1
Ebuild name:

net-misc/electrum-4.7.1

Description

User friendly Bitcoin client

Added to portage

2026-02-28

gajim - 2.4.4
Ebuild name:

net-im/gajim-2.4.4

Description

GTK XMPP Client

Added to portage

2026-02-28

gentoo-kernel - 6.18.15
Ebuild name:

sys-kernel/gentoo-kernel-6.18.15

Description

Linux kernel built with Gentoo patches

Added to portage

2026-02-28

gentoo-kernel - 6.19.5
Ebuild name:

sys-kernel/gentoo-kernel-6.19.5

Description

Linux kernel built with Gentoo patches

Added to portage

2026-02-28

gentoo-kernel-bin - 6.18.15
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.15

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-02-28

gentoo-kernel-bin - 6.19.5
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.19.5

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-02-28

google-auth-oauthlib - 1.3.0
Ebuild name:

dev-python/google-auth-oauthlib-1.3.0

Description

Google Authentication Library

Added to portage

2026-02-28

griffe-inherited-docstrings - 1.1.3
Ebuild name:

dev-python/griffe-inherited-docstrings-1.1.3

Description

Griffe extension for inheriting docstrings

Added to portage

2026-02-28

groonga - 16.0.0
Ebuild name:

app-text/groonga-16.0.0

Description

An Embeddable Fulltext Search Engine

Added to portage

2026-02-28

incus - 6.22
Ebuild name:

app-containers/incus-6.22

Description

Modern, secure and powerful system container and virtual machine manager

Added to portage

2026-02-28

intel-microcode - 20260227_p20260227
Ebuild name:

sys-firmware/intel-microcode-20260227_p20260227

Description

Intel IA32/IA64 microcode update data

Added to portage

2026-02-28

jsonschema-path - 0.4.3
Ebuild name:

dev-python/jsonschema-path-0.4.3

Description

JSONSchema Spec with object-oriented paths

Added to portage

2026-02-28

lossless-cut-bin - 3.68.0
Ebuild name:

media-video/lossless-cut-bin-3.68.0

Description

The swiss army knife of lossless video/audio editing

Added to portage

2026-02-28

lxml-html-clean - 0.4.4
Ebuild name:

dev-python/lxml-html-clean-0.4.4

Description

Separate project for HTML cleaning functionalities copied from lxm

Added to portage

2026-02-28

maturin - 1.12.5
Ebuild name:

dev-util/maturin-1.12.5

Description

Build and publish crates with pyo3, rust-cpython and cffi bindings

Added to portage

2026-02-28

mirrorselect - 2.5.1
Ebuild name:

app-portage/mirrorselect-2.5.1

Description

Tool to help select distfiles mirrors for Gentoo

Added to portage

2026-02-28

mirrorselect - 2.5.4
Ebuild name:

app-portage/mirrorselect-2.5.4

Description

Tool to help select distfiles mirrors for Gentoo

Added to portage

2026-02-28

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-02-28

modus-themes - 9999
Ebuild name:

app-emacs/modus-themes-9999

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-02-28

mpg123-el - 1.65
Ebuild name:

app-emacs/mpg123-el-1.65

Description

Emacs front-end to mpg123 audio player and OggVorbis audio player

Added to portage

2026-02-28

mujs - 1.3.8
Ebuild name:

dev-lang/mujs-1.3.8

Description

An embeddable JavaScript interpreter written in C

Added to portage

2026-02-28

multipart - 1.3.1
Ebuild name:

dev-python/multipart-1.3.1

Description

Parser for multipart/form-data

Added to portage

2026-02-28

mupdf - 1.27.2
Ebuild name:

app-text/mupdf-1.27.2

Description

A lightweight PDF viewer and toolkit written in portable C

Added to portage

2026-02-28

notmuch - 0.40-r1
Ebuild name:

net-mail/notmuch-0.40-r1

Description

Thread-based e-mail indexer, supporting quick search and tagging

Added to portage

2026-02-28

nwjs - 0.108.0
Ebuild name:

dev-libs/nwjs-0.108.0

Description

Framework that lets you call all Node.js modules directly from the DOM

Added to portage

2026-02-28

onlyoffice-bin - 9.3.0
Ebuild name:

app-office/onlyoffice-bin-9.3.0

Description

A free and open source office and productivity suite (binary versio

Added to portage

2026-02-28

openapi-spec-validator - 0.8.2
Ebuild name:

dev-python/openapi-spec-validator-0.8.2

Description

OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 spec validator

Added to portage

2026-02-28

pixi - 0.65.0
Ebuild name:

dev-util/pixi-0.65.0

Description

A package management and workflow tool

Added to portage

2026-02-28

pypdf - 6.7.4
Ebuild name:

dev-python/pypdf-6.7.4

Description

Python library to work with PDF files

Added to portage

2026-02-28

pytest-check - 2.7.2
Ebuild name:

dev-python/pytest-check-2.7.2

Description

pytest plugin that allows multiple failures per test

Added to portage

2026-02-28

pytest-salt-factories - 1.0.5
Ebuild name:

dev-python/pytest-salt-factories-1.0.5

Description

The new generation of the pytest-salt Plugin

Added to portage

2026-02-28

python-glanceclient - 4.11.0
Ebuild name:

dev-python/python-glanceclient-4.11.0

Description

A client for the OpenStack Glance API

Added to portage

2026-02-28

python-keystoneclient - 5.8.0
Ebuild name:

dev-python/python-keystoneclient-5.8.0

Description

Client Library for OpenStack Identity

Added to portage

2026-02-28

qwt - 6.2.0-r5
Ebuild name:

x11-libs/qwt-6.2.0-r5

Description

2D plotting library for Qt

Added to portage

2026-02-28

radicale - 3.6.1
Ebuild name:

www-apps/radicale-3.6.1

Description

A simple CalDAV calendar server

Added to portage

2026-02-28

reaper-bin - 7.61
Ebuild name:

media-sound/reaper-bin-7.61

Description

Digital audio workstation

Added to portage

2026-02-28

regex - 2026.2.28
Ebuild name:

dev-python/regex-2026.2.28

Description

Alternative regular expression module to replace re

Added to portage

2026-02-28

salt - 3007.12
Ebuild name:

app-admin/salt-3007.12

Description

Salt is a remote execution and configuration manager

Added to portage

2026-02-28

samba - 4.23.6
Ebuild name:

net-fs/samba-4.23.6

Description

Samba Suite Version 4

Added to portage

2026-02-28

ssh-audit - 3.3.0_p20250901
Ebuild name:

net-analyzer/ssh-audit-3.3.0_p20250901

Description

SSH server auditing (banner, key exchange, encryption, mac,

Added to portage

2026-02-28

sslscan - 2.2.1-r1
Ebuild name:

net-analyzer/sslscan-2.2.1-r1

Description

Fast SSL configuration scanner

Added to portage

2026-02-28

tls - 2.0
Ebuild name:

dev-tcltk/tls-2.0

Description

TLS OpenSSL extension to Tcl

Added to portage

2026-02-28

udiskie - 2.6.2
Ebuild name:

sys-fs/udiskie-2.6.2

Description

An automatic disk mounting service using udisks

Added to portage

2026-02-28

udisks - 2.11.1
Ebuild name:

sys-fs/udisks-2.11.1

Description

Daemon providing interfaces to work with storage devices

Added to portage

2026-02-28

uv - 0.10.7
Ebuild name:

dev-python/uv-0.10.7

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-02-28

uv-build - 0.10.7
Ebuild name:

dev-python/uv-build-0.10.7

Description

PEP517 uv build backend

Added to portage

2026-02-28

vanilla-kernel - 6.18.15
Ebuild name:

sys-kernel/vanilla-kernel-6.18.15

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-02-28

vanilla-kernel - 6.19.5
Ebuild name:

sys-kernel/vanilla-kernel-6.19.5

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-02-28

vanilla-sources - 6.18.15
Ebuild name:

sys-kernel/vanilla-sources-6.18.15

Description

Full sources for the Linux kernel

Added to portage

2026-02-28

vanilla-sources - 6.19.5
Ebuild name:

sys-kernel/vanilla-sources-6.19.5

Description

Full sources for the Linux kernel

Added to portage

2026-02-28

virtualenv - 21.1.0
Ebuild name:

dev-python/virtualenv-21.1.0

Description

Virtual Python Environment builder

Added to portage

2026-02-28

vivaldi - 7.8.3925.74
Ebuild name:

www-client/vivaldi-7.8.3925.74

Description

A browser for our friends

Added to portage

2026-02-28

vivaldi-snapshot - 7.9.3960.3
Ebuild name:

www-client/vivaldi-snapshot-7.9.3960.3

Description

A browser for our friends

Added to portage

2026-02-28

wireshark - 4.6.4
Ebuild name:

net-analyzer/wireshark-4.6.4

Description

Network protocol analyzer (sniffer)

Added to portage

2026-02-28

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