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:

83100

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-02-04
arch-chroot - 31
Ebuild name:

sys-apps/arch-chroot-31

Description

Wraps the chroot command while ensuring that important filesystems are moun

Added to portage

2026-02-04

asgiref - 3.11.1
Ebuild name:

dev-python/asgiref-3.11.1

Description

ASGI utilities (successor to WSGI)

Added to portage

2026-02-04

autoconf - 2.72.90
Ebuild name:

dev-build/autoconf-2.72.90

Description

Used to create autoconfiguration files

Added to portage

2026-02-04

awscli - 1.44.31
Ebuild name:

app-admin/awscli-1.44.31

Description

Universal Command Line Environment for AWS

Added to portage

2026-02-04

boto3 - 1.42.41
Ebuild name:

dev-python/boto3-1.42.41

Description

The AWS SDK for Python

Added to portage

2026-02-04

botocore - 1.42.41
Ebuild name:

dev-python/botocore-1.42.41

Description

Low-level, data-driven core of boto 3

Added to portage

2026-02-04

byacc - 20260126
Ebuild name:

dev-util/byacc-20260126

Description

The best variant of the Yacc parser generator

Added to portage

2026-02-04

certbot - 5.3.0
Ebuild name:

app-crypt/certbot-5.3.0

Description

Let's Encrypt client to automate deployment of X.509 certificates

Added to portage

2026-02-04

claude-code - 2.1.30
Ebuild name:

dev-util/claude-code-2.1.30

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-02-04

cmd2 - 3.1.3
Ebuild name:

dev-python/cmd2-3.1.3

Description

Extra features for standard library's cmd module

Added to portage

2026-02-04

conntrack-tools - 1.4.9
Ebuild name:

net-firewall/conntrack-tools-1.4.9

Description

Connection tracking userspace tools

Added to portage

2026-02-04

coverage - 7.13.3
Ebuild name:

dev-python/coverage-7.13.3

Description

Code coverage measurement for Python

Added to portage

2026-02-04

cryptsetup - 2.8.4
Ebuild name:

sys-fs/cryptsetup-2.8.4

Description

Tool to setup encrypted devices with dm-crypt

Added to portage

2026-02-04

denonavr - 1.3.1
Ebuild name:

dev-python/denonavr-1.3.1

Description

Automation Library for Denon AVR receivers

Added to portage

2026-02-04

django - 4.2.28
Ebuild name:

dev-python/django-4.2.28

Description

High-level Python web framework

Added to portage

2026-02-04

django - 5.2.11
Ebuild name:

dev-python/django-5.2.11

Description

High-level Python web framework

Added to portage

2026-02-04

django - 6.0.2
Ebuild name:

dev-python/django-6.0.2

Description

High-level Python web framework

Added to portage

2026-02-04

eigen - 3.4.9999
Ebuild name:

dev-cpp/eigen-3.4.9999

Description

C++ template library for linear algebra

Added to portage

2026-02-04

elasticsearch - 9.3.0
Ebuild name:

dev-python/elasticsearch-9.3.0

Description

Official Elasticsearch client library for Python

Added to portage

2026-02-04

exfatprogs - 1.3.1
Ebuild name:

sys-fs/exfatprogs-1.3.1

Description

Userspace utilities for the exFAT filesystem

Added to portage

2026-02-04

genfstab - 31
Ebuild name:

sys-fs/genfstab-31

Description

Genfstab - generate output suitable for addition to an fstab file

Added to portage

2026-02-04

gnupg - 2.5.17-r1
Ebuild name:

app-crypt/gnupg-2.5.17-r1

Description

The GNU Privacy Guard, a GPL OpenPGP implementation

Added to portage

2026-02-04

juliamono - 0.062
Ebuild name:

media-fonts/juliamono-0.062

Description

JuliaMono - a monospaced font for scientific and technical computing

Added to portage

2026-02-04

kleopatra - 25.12.1-r2
Ebuild name:

kde-apps/kleopatra-25.12.1-r2

Description

Certificate manager and GUI for OpenPGP and CMS cryptography

Added to portage

2026-02-04

libcamera - 0.7.0-r1
Ebuild name:

media-libs/libcamera-0.7.0-r1

Description

Complex camera support library

Added to portage

2026-02-04

libdwarf - 2.3.0
Ebuild name:

dev-libs/libdwarf-2.3.0

Description

Library intended to simplify reading (and writing) applications using DWARF

Added to portage

2026-02-04

libgcrypt - 1.12.0-r2
Ebuild name:

dev-libs/libgcrypt-1.12.0-r2

Description

General purpose crypto library based on the code used in GnuPG

Added to portage

2026-02-04

libnetfilter_conntrack - 1.1.1
Ebuild name:

net-libs/libnetfilter_conntrack-1.1.1

Description

Programming interface (API) to the in-kernel connection track

Added to portage

2026-02-04

limine - 10.6.4
Ebuild name:

sys-boot/limine-10.6.4

Description

Limine is a modern, advanced, and portable BIOS/UEFI multiprotocol bootloade

Added to portage

2026-02-04

logwatch - 7.14
Ebuild name:

sys-apps/logwatch-7.14

Description

Analyzes and Reports on system logs

Added to portage

2026-02-04

mawk - 1.3.4_p20260129
Ebuild name:

sys-apps/mawk-1.3.4_p20260129

Description

An (often faster than gawk) awk-interpreter

Added to portage

2026-02-04

mold - 2.40.4-r1
Ebuild name:

sys-devel/mold-2.40.4-r1

Description

A Modern Linker

Added to portage

2026-02-04

mozc - 2.32.5994.102-r1
Ebuild name:

app-i18n/mozc-2.32.5994.102-r1

Description

Mozc - Japanese input method editor.

Added to portage

2026-02-04

openpgp-keys-craigsmall - 20260203
Ebuild name:

sec-keys/openpgp-keys-craigsmall-20260203

Description

OpenPGP key used by Craig Small

Added to portage

2026-02-04

openpgp-keys-gentoo-developers - 20260112-r1
Ebuild name:

sec-keys/openpgp-keys-gentoo-developers-20260112-r1

Description

Gentoo Authority Keys (GLEP 79)

Added to portage

2026-02-04

openpgp-keys-hclee - 20260204
Ebuild name:

sec-keys/openpgp-keys-hclee-20260204

Description

OpenPGP key used by Hyunchul Lee (hclee)

Added to portage

2026-02-04

openpgp-keys-ludovicrousseau - 20260204
Ebuild name:

sec-keys/openpgp-keys-ludovicrousseau-20260204

Description

OpenPGP key used by Ludovic Rousseau

Added to portage

2026-02-04

openpgp-keys-thomasdickey - 20260204
Ebuild name:

sec-keys/openpgp-keys-thomasdickey-20260204

Description

OpenPGP keys used by Thomas Dickey

Added to portage

2026-02-04

org-roam - 2.2.2-r3
Ebuild name:

app-emacs/org-roam-2.2.2-r3

Description

Rudimentary Roam replica with Org-mode

Added to portage

2026-02-04

org-roam - 2.3.0
Ebuild name:

app-emacs/org-roam-2.3.0

Description

Rudimentary Roam replica with Org-mode

Added to portage

2026-02-04

pcsc-lite - 2.4.1
Ebuild name:

sys-apps/pcsc-lite-2.4.1

Description

PC/SC Architecture smartcard middleware library

Added to portage

2026-02-04

procps - 4.0.6
Ebuild name:

sys-process/procps-4.0.6

Description

Standard informational utilities and process-handling tools

Added to portage

2026-02-04

qca - 2.3.10-r1
Ebuild name:

app-crypt/qca-2.3.10-r1

Description

Qt Cryptographic Architecture (QCA)

Added to portage

2026-02-04

qca - 9999
Ebuild name:

app-crypt/qca-9999

Description

Qt Cryptographic Architecture (QCA)

Added to portage

2026-02-04

reflex - 20260131
Ebuild name:

sys-devel/reflex-20260131

Description

This is a variant of the flex fast lexical scanner

Added to portage

2026-02-04

ruff - 0.15.0
Ebuild name:

dev-util/ruff-0.15.0

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-02-04

teamspeak-client - 6.0.0_beta3-r4
Ebuild name:

media-sound/teamspeak-client-6.0.0_beta3-r4

Description

A client software for quality voice communication via t

Added to portage

2026-02-04

userspace-rcu - 0.15.6
Ebuild name:

dev-libs/userspace-rcu-0.15.6

Description

Userspace RCU (read-copy-update) library

Added to portage

2026-02-04

virt-firmware - 25.12
Ebuild name:

app-emulation/virt-firmware-25.12

Description

Tools for ovmf/armvirt firmware volumes

Added to portage

2026-02-04

yt-dlp - 2026.02.04
Ebuild name:

net-misc/yt-dlp-2026.02.04

Description

youtube-dl fork with additional features and fixes

Added to portage

2026-02-04

2026-02-03
awscli - 1.44.30
Ebuild name:

app-admin/awscli-1.44.30

Description

Universal Command Line Environment for AWS

Added to portage

2026-02-03

boto3 - 1.42.40
Ebuild name:

dev-python/boto3-1.42.40

Description

The AWS SDK for Python

Added to portage

2026-02-03

botocore - 1.42.40
Ebuild name:

dev-python/botocore-1.42.40

Description

Low-level, data-driven core of boto 3

Added to portage

2026-02-03

braintree - 4.42.0
Ebuild name:

dev-python/braintree-4.42.0

Description

Braintree Python Library

Added to portage

2026-02-03

deno-bin - 2.6.8
Ebuild name:

dev-lang/deno-bin-2.6.8

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-02-03

dropbox - 240.4.8609
Ebuild name:

net-misc/dropbox-240.4.8609

Description

Dropbox daemon (pretends to be GUI-less)

Added to portage

2026-02-03

egl-wayland2 - 1.0.1_pre20260109
Ebuild name:

gui-libs/egl-wayland2-1.0.1_pre20260109

Description

NVIDIA wayland EGL external platform library, version 2

Added to portage

2026-02-03

fsarchiver - 0.8.9
Ebuild name:

app-backup/fsarchiver-0.8.9

Description

Flexible filesystem archiver for backup and deployment tool

Added to portage

2026-02-03

git - 2.53.0
Ebuild name:

dev-vcs/git-2.53.0

Description

Stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2026-02-03

glm - 1.0.3
Ebuild name:

media-libs/glm-1.0.3

Description

OpenGL Mathematics

Added to portage

2026-02-03

gmpy2 - 2.3.0_beta1
Ebuild name:

dev-python/gmpy2-2.3.0_beta1

Description

Python bindings for GMP, MPC, MPFR and MPIR libraries

Added to portage

2026-02-03

gnatdoc - 25.0.0-r7
Ebuild name:

dev-ada/gnatdoc-25.0.0-r7

Description

GNAT Documentation Generation Tool

Added to portage

2026-02-03

gnatdoc - 25.2.0-r1
Ebuild name:

dev-ada/gnatdoc-25.2.0-r1

Description

GNAT Documentation Generation Tool

Added to portage

2026-02-03

gnatdoc - 26.0.0-r1
Ebuild name:

dev-ada/gnatdoc-26.0.0-r1

Description

GNAT Documentation Generation Tool

Added to portage

2026-02-03

gnatformat - 25.0.0-r3
Ebuild name:

dev-ada/gnatformat-25.0.0-r3

Description

Opinionated code formatter for the Ada language

Added to portage

2026-02-03

gnatformat - 26.0.0-r2
Ebuild name:

dev-ada/gnatformat-26.0.0-r2

Description

Opinionated code formatter for the Ada language

Added to portage

2026-02-03

gunicorn - 25.0.1
Ebuild name:

www-servers/gunicorn-25.0.1

Description

A WSGI HTTP Server for UNIX

Added to portage

2026-02-03

ig - 0.49.0
Ebuild name:

app-admin/ig-0.49.0

Description

Tools and framework for data collection and system inspection using eBPF

Added to portage

2026-02-03

ipython - 9.10.0
Ebuild name:

dev-python/ipython-9.10.0

Description

Advanced interactive shell for Python

Added to portage

2026-02-03

libadalang-tools - 25.0.0-r4
Ebuild name:

dev-ada/libadalang-tools-25.0.0-r4

Description

Libadalang-based tools gnatpp, gnatmetric and gnatstub

Added to portage

2026-02-03

libadalang-tools - 26.0.0-r1
Ebuild name:

dev-ada/libadalang-tools-26.0.0-r1

Description

Libadalang-based tools gnatpp, gnatmetric and gnatstub

Added to portage

2026-02-03

markdown - 26.0.0-r1
Ebuild name:

dev-ada/markdown-26.0.0-r1

Description

Provides a markdown parser written in Ada

Added to portage

2026-02-03

narwhals - 2.16.0
Ebuild name:

dev-python/narwhals-2.16.0

Description

Extremely lightweight compatibility layer between dataframe libraries

Added to portage

2026-02-03

orjson - 3.11.7
Ebuild name:

dev-python/orjson-3.11.7

Description

Fast, correct Python JSON library supporting dataclasses, datetimes, and n

Added to portage

2026-02-03

patool - 4.0.4
Ebuild name:

app-arch/patool-4.0.4

Description

Portable archive file manager

Added to portage

2026-02-03

plasma-vault - 6.5.5-r2
Ebuild name:

kde-plasma/plasma-vault-6.5.5-r2

Description

Plasma applet and services for creating encrypted vaults

Added to portage

2026-02-03

proto-plus - 1.27.1
Ebuild name:

dev-python/proto-plus-1.27.1

Description

Beautiful, Pythonic protocol buffers

Added to portage

2026-02-03

pydf - 16
Ebuild name:

app-admin/pydf-16

Description

Enhanced df with colors

Added to portage

2026-02-03

pyside - 6.10.2
Ebuild name:

dev-python/pyside-6.10.2

Description

Python bindings for the Qt framework

Added to portage

2026-02-03

qca - 2.3.10-r1
Ebuild name:

app-crypt/qca-2.3.10-r1

Description

Qt Cryptographic Architecture (QCA)

Added to portage

2026-02-03

qca - 9999
Ebuild name:

app-crypt/qca-9999

Description

Qt Cryptographic Architecture (QCA)

Added to portage

2026-02-03

requests-cache - 1.3.0
Ebuild name:

dev-python/requests-cache-1.3.0

Description

Persistent cache for requests library

Added to portage

2026-02-03

sqlglot - 28.8.0
Ebuild name:

dev-python/sqlglot-28.8.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2026-02-03

strawberry - 1.2.18
Ebuild name:

media-sound/strawberry-1.2.18

Description

Modern music player and library organizer based on Clementine and Qt

Added to portage

2026-02-03

syncthing - 2.0.14
Ebuild name:

net-p2p/syncthing-2.0.14

Description

Open Source Continuous File Synchronization

Added to portage

2026-02-03

templates-parser - 24.0.0-r2
Ebuild name:

dev-ada/templates-parser-24.0.0-r2

Description

A template engine

Added to portage

2026-02-03

templates-parser - 25.0.0-r5
Ebuild name:

dev-ada/templates-parser-25.0.0-r5

Description

A template engine

Added to portage

2026-02-03

templates-parser - 26.0.0-r1
Ebuild name:

dev-ada/templates-parser-26.0.0-r1

Description

A template engine

Added to portage

2026-02-03

types-gdb - 16.3.0.20260203
Ebuild name:

dev-python/types-gdb-16.3.0.20260203

Description

Typing stubs for gdb

Added to portage

2026-02-03

urwid - 3.0.5
Ebuild name:

dev-python/urwid-3.0.5

Description

Curses-based user interface library for Python

Added to portage

2026-02-03

wrapt - 2.1.1
Ebuild name:

dev-python/wrapt-2.1.1

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-02-03

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