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:

84360

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-04-11
OpenNI2 - 2.2_beta2-r3
Ebuild name:

dev-libs/OpenNI2-2.2_beta2-r3

Description

OpenNI2 SDK

Added to portage

2026-04-11

awscli - 1.44.78
Ebuild name:

app-admin/awscli-1.44.78

Description

Universal Command Line Environment for AWS

Added to portage

2026-04-11

boto3 - 1.42.88
Ebuild name:

dev-python/boto3-1.42.88

Description

The AWS SDK for Python

Added to portage

2026-04-11

botocore - 1.42.88
Ebuild name:

dev-python/botocore-1.42.88

Description

Low-level, data-driven core of boto 3

Added to portage

2026-04-11

build - 1.4.3
Ebuild name:

dev-python/build-1.4.3

Description

A simple, correct PEP517 package builder

Added to portage

2026-04-11

fex-xtajit - 2604
Ebuild name:

app-emulation/fex-xtajit-2604

Description

A wine emulation dll for running x86 application on an arm64 host

Added to portage

2026-04-11

firecracker-bin - 1.14.4
Ebuild name:

app-emulation/firecracker-bin-1.14.4

Description

Secure and fast microVMs for serverless computing (static buil

Added to portage

2026-04-11

firecracker-bin - 1.15.1
Ebuild name:

app-emulation/firecracker-bin-1.15.1

Description

Secure and fast microVMs for serverless computing (static buil

Added to portage

2026-04-11

firejail - 0.9.80
Ebuild name:

sys-apps/firejail-0.9.80

Description

Security sandbox for any type of processes

Added to portage

2026-04-11

flatpak - 1.16.6
Ebuild name:

sys-apps/flatpak-1.16.6

Description

Linux application sandboxing and distribution framework

Added to portage

2026-04-11

gpgme - 2.0.24-r4
Ebuild name:

dev-ruby/gpgme-2.0.24-r4

Description

Ruby language binding for GnuPG Made Easy

Added to portage

2026-04-11

gsm - 1.0.24
Ebuild name:

media-sound/gsm-1.0.24

Description

Lossy speech compression library and tool

Added to portage

2026-04-11

hiera-eyaml-gpg - 0.7.4-r2
Ebuild name:

dev-ruby/hiera-eyaml-gpg-0.7.4-r2

Description

A GPG backend for hiera-eyaml

Added to portage

2026-04-11

inline-snapshot - 0.32.6
Ebuild name:

dev-python/inline-snapshot-0.32.6

Description

Create and update inline snapshots in your Python tests

Added to portage

2026-04-11

inspircd - 4.9.0
Ebuild name:

net-irc/inspircd-4.9.0

Description

Inspire IRCd - The Stable, High-Performance Modular IRCd

Added to portage

2026-04-11

jenkins-bin - 2.541.3
Ebuild name:

dev-util/jenkins-bin-2.541.3

Description

The leading open source automation server

Added to portage

2026-04-11

jenkins-bin - 2.558
Ebuild name:

dev-util/jenkins-bin-2.558

Description

The leading open source automation server

Added to portage

2026-04-11

libsodium - 1.0.22
Ebuild name:

dev-libs/libsodium-1.0.22

Description

Portable fork of NaCl, a higher-level cryptographic library

Added to portage

2026-04-11

minitest - 5.15.0-r2
Ebuild name:

dev-ruby/minitest-5.15.0-r2

Description

minitest/unit is a small and fast replacement for ruby's huge and slow

Added to portage

2026-04-11

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-04-11

mu-cite - 8.1_p202011031127
Ebuild name:

app-emacs/mu-cite-8.1_p202011031127

Description

Message citation utilities for emacsen

Added to portage

2026-04-11

nfdump - 1.7.7
Ebuild name:

net-analyzer/nfdump-1.7.7

Description

A set of tools to collect and process netflow data

Added to portage

2026-04-11

nox - 2026.04.10
Ebuild name:

dev-python/nox-2026.04.10

Description

Flexible test automation for Python

Added to portage

2026-04-11

nuitka - 4.0.8
Ebuild name:

dev-python/nuitka-4.0.8

Description

Python to native compiler

Added to portage

2026-04-11

plex-media-server - 1.43.1.10611
Ebuild name:

media-tv/plex-media-server-1.43.1.10611

Description

Free media library that is intended for use with a plex cli

Added to portage

2026-04-11

pulseaudio-daemon - 17.0-r2
Ebuild name:

media-sound/pulseaudio-daemon-17.0-r2

Description

Daemon component of PulseAudio (networked sound server)

Added to portage

2026-04-11

pyghmi - 1.6.15
Ebuild name:

dev-python/pyghmi-1.6.15

Description

A pure python implementation of IPMI protocol

Added to portage

2026-04-11

python-multipart - 0.0.25
Ebuild name:

dev-python/python-multipart-0.0.25

Description

A streaming multipart parser for Python

Added to portage

2026-04-11

qmmp - 2.3.2
Ebuild name:

media-sound/qmmp-2.3.2

Description

Qt-based audio player with winamp/xmms skins support

Added to portage

2026-04-11

qtawesome - 1.4.2
Ebuild name:

dev-python/qtawesome-1.4.2

Description

Enables iconic fonts such as Font Awesome in PyQt

Added to portage

2026-04-11

rich - 14.3.4
Ebuild name:

dev-python/rich-14.3.4

Description

Python library for rendering rich text, tables, etc. to the terminal

Added to portage

2026-04-11

rofi-calc - 2.5.1
Ebuild name:

x11-misc/rofi-calc-2.5.1

Description

Do live calculations in rofi

Added to portage

2026-04-11

rqlite - 9.4.1
Ebuild name:

dev-db/rqlite-9.4.1

Description

Replicated SQLite using the Raft consensus protocol

Added to portage

2026-04-11

ruby - 3.2.11
Ebuild name:

dev-lang/ruby-3.2.11

Description

An object-oriented scripting language

Added to portage

2026-04-11

ruby - 3.3.11
Ebuild name:

dev-lang/ruby-3.3.11

Description

An object-oriented scripting language

Added to portage

2026-04-11

ruby - 3.4.9
Ebuild name:

dev-lang/ruby-3.4.9

Description

An object-oriented scripting language

Added to portage

2026-04-11

ruby - 4.0.2
Ebuild name:

dev-lang/ruby-4.0.2

Description

An object-oriented scripting language

Added to portage

2026-04-11

sandbox - 2.47
Ebuild name:

sys-apps/sandbox-2.47

Description

sandbox'd LD_PRELOAD hack

Added to portage

2026-04-11

sasquatch - 4.5.1.6
Ebuild name:

app-arch/sasquatch-4.5.1.6

Description

An extended version of sasquashfs-tools

Added to portage

2026-04-11

selenium - 4.43.0
Ebuild name:

dev-python/selenium-4.43.0

Description

Python language binding for Selenium Remote Control

Added to portage

2026-04-11

selenium-manager - 4.43.0
Ebuild name:

dev-util/selenium-manager-4.43.0

Description

CLI tool that manages the browser/driver infrastructure required b

Added to portage

2026-04-11

streamlink - 8.3.0
Ebuild name:

net-misc/streamlink-8.3.0

Description

CLI for extracting streams from websites to a video player of your choice

Added to portage

2026-04-11

tiled - 1.12.0
Ebuild name:

dev-games/tiled-1.12.0

Description

A general purpose tile map editor

Added to portage

2026-04-11

tvision - 2.2.3-r1
Ebuild name:

dev-libs/tvision-2.2.3-r1

Description

Text User Interface that implements the well known CUA widgets

Added to portage

2026-04-11

unicode-segmentation-rs - 0.2.4
Ebuild name:

dev-python/unicode-segmentation-rs-0.2.4

Description

Unicode segmentation and width for Python using Rust

Added to portage

2026-04-11

wrapt - 2.2.0_rc4
Ebuild name:

dev-python/wrapt-2.2.0_rc4

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-04-11

xdg-dbus-proxy - 0.1.7
Ebuild name:

sys-apps/xdg-dbus-proxy-0.1.7

Description

Filtering proxy for D-Bus connections

Added to portage

2026-04-11

xdg-user-dirs - 0.20
Ebuild name:

x11-misc/xdg-user-dirs-0.20

Description

Tool to help manage 'well known' user directories

Added to portage

2026-04-11

zope-configuration - 7.1
Ebuild name:

dev-python/zope-configuration-7.1

Description

Zope Configuration Architecture

Added to portage

2026-04-11

zope-interface - 8.3
Ebuild name:

dev-python/zope-interface-8.3

Description

Interfaces for Python

Added to portage

2026-04-11

2026-04-10
accelerate - 1.13.0-r1
Ebuild name:

sci-ml/accelerate-1.13.0-r1

Description

Run your *raw* PyTorch training script on any kind of device

Added to portage

2026-04-10

afflib - 3.7.22
Ebuild name:

app-forensics/afflib-3.7.22

Description

Library that implements the AFF image standard

Added to portage

2026-04-10

awscli - 1.44.77
Ebuild name:

app-admin/awscli-1.44.77

Description

Universal Command Line Environment for AWS

Added to portage

2026-04-10

ayatana-ido - 0.10.4-r1
Ebuild name:

dev-libs/ayatana-ido-0.10.4-r1

Description

Ayatana Application Indicators (Shared Library)

Added to portage

2026-04-10

babl - 0.1.126
Ebuild name:

media-libs/babl-0.1.126

Description

A dynamic, any to any, pixel format conversion library

Added to portage

2026-04-10

boto3 - 1.42.87
Ebuild name:

dev-python/boto3-1.42.87

Description

The AWS SDK for Python

Added to portage

2026-04-10

botocore - 1.42.87
Ebuild name:

dev-python/botocore-1.42.87

Description

Low-level, data-driven core of boto 3

Added to portage

2026-04-10

capyt - 1.2.2
Ebuild name:

app-text/capyt-1.2.2

Description

A python3 CLI utility to interface with cpy.pt

Added to portage

2026-04-10

chromium - 147.0.7727.55
Ebuild name:

www-client/chromium-147.0.7727.55

Description

Open-source version of Google Chrome web browser

Added to portage

2026-04-10

delve - 1.26.1
Ebuild name:

dev-go/delve-1.26.1

Description

A source-level debugger for the Go programming language

Added to portage

2026-04-10

deno-bin - 2.7.12
Ebuild name:

dev-lang/deno-bin-2.7.12

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-04-10

element - 1.12.15
Ebuild name:

www-apps/element-1.12.15

Description

A glossy Matrix collaboration client for the web

Added to portage

2026-04-10

evisum - 1.2.2
Ebuild name:

sys-process/evisum-1.2.2

Description

System and process monitor written with EFL

Added to portage

2026-04-10

fakeredis - 2.35.0
Ebuild name:

dev-python/fakeredis-2.35.0

Description

Fake implementation of redis API for testing purposes

Added to portage

2026-04-10

gdl - 1.1.3
Ebuild name:

dev-lang/gdl-1.1.3

Description

GNU Data Language

Added to portage

2026-04-10

geneweb - 7.1_beta-r1
Ebuild name:

app-misc/geneweb-7.1_beta-r1

Description

Genealogy software program with a Web interface

Added to portage

2026-04-10

glib - 2.84.4-r5
Ebuild name:

dev-libs/glib-2.84.4-r5

Description

The GLib library of C routines

Added to portage

2026-04-10

glib - 2.86.5-r1
Ebuild name:

dev-libs/glib-2.86.5-r1

Description

The GLib library of C routines

Added to portage

2026-04-10

glib - 2.88.0-r1
Ebuild name:

dev-libs/glib-2.88.0-r1

Description

The GLib library of C routines

Added to portage

2026-04-10

google-api-core - 2.30.3
Ebuild name:

dev-python/google-api-core-2.30.3

Description

Core Library for Google Client Libraries

Added to portage

2026-04-10

google-auth - 2.49.2
Ebuild name:

dev-python/google-auth-2.49.2

Description

Google Authentication Library

Added to portage

2026-04-10

librt - 0.9.0
Ebuild name:

dev-python/librt-0.9.0

Description

Mypyc runtime library

Added to portage

2026-04-10

more-itertools - 11.0.2
Ebuild name:

dev-python/more-itertools-11.0.2

Description

More routines for operating on iterables, beyond itertools

Added to portage

2026-04-10

multi-term - 1.4-r1
Ebuild name:

app-emacs/multi-term-1.4-r1

Description

Manage multiple terminal buffers in Emacs

Added to portage

2026-04-10

multiple-cursors - 1.5.0
Ebuild name:

app-emacs/multiple-cursors-1.5.0

Description

Multiple cursors for Emacs

Added to portage

2026-04-10

multiple-cursors - 1.5.0
Ebuild name:

app-emacs/multiple-cursors-1.5.0

Description

Multiple cursors for Emacs

Added to portage

2026-04-10

nextcloud - 32.0.8
Ebuild name:

www-apps/nextcloud-32.0.8

Description

Personal cloud that runs on your own server

Added to portage

2026-04-10

nextcloud - 33.0.2
Ebuild name:

www-apps/nextcloud-33.0.2

Description

Personal cloud that runs on your own server

Added to portage

2026-04-10

nextcloud-client - 33.0.2
Ebuild name:

net-misc/nextcloud-client-33.0.2

Description

Desktop Syncing Client for Nextcloud

Added to portage

2026-04-10

plotly - 6.7.0
Ebuild name:

dev-python/plotly-6.7.0

Description

Browser-based graphing library for Python

Added to portage

2026-04-10

prometheus-client - 0.25.0
Ebuild name:

dev-python/prometheus-client-0.25.0

Description

Python client for the Prometheus monitoring system

Added to portage

2026-04-10

pyacoustid - 1.3.1
Ebuild name:

dev-python/pyacoustid-1.3.1

Description

Python bindings for Chromaprint and the AcoustID web service

Added to portage

2026-04-10

pysnmp - 7.1.23
Ebuild name:

dev-python/pysnmp-7.1.23

Description

Python SNMP library

Added to portage

2026-04-10

pytest-httpx - 0.36.2
Ebuild name:

dev-python/pytest-httpx-0.36.2

Description

Send responses to HTTPX using pytest

Added to portage

2026-04-10

python - 0.3.15.0_alpha8-r1
Ebuild name:

dev-lang/python-0.3.15.0_alpha8-r1

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-04-10

python - 3.15.0_alpha8-r1
Ebuild name:

dev-lang/python-3.15.0_alpha8-r1

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-04-10

pytools - 2026.1
Ebuild name:

dev-python/pytools-2026.1

Description

Collection of tools missing from the Python standard library

Added to portage

2026-04-10

raspberrypi-firmware - 1.20260408
Ebuild name:

sys-boot/raspberrypi-firmware-1.20260408

Description

Raspberry Pi (all versions) bootloader and GPU firmware

Added to portage

2026-04-10

raspberrypi-image - 6.12.75_p20260408
Ebuild name:

sys-kernel/raspberrypi-image-6.12.75_p20260408

Description

Raspberry Pi (all versions) kernel and modules

Added to portage

2026-04-10

raspberrypi-sources - 6.12.75_p20260408
Ebuild name:

sys-kernel/raspberrypi-sources-6.12.75_p20260408

Description

Raspberry Pi kernel sources

Added to portage

2026-04-10

restart-services - 1.6
Ebuild name:

app-admin/restart-services-1.6

Description

Tool to manage OpenRC and systemd services that need to be restarted

Added to portage

2026-04-10

sccache - 0.14.0-r1
Ebuild name:

dev-util/sccache-0.14.0-r1

Description

ccache/distcc like tool with support for rust and cloud storage

Added to portage

2026-04-10

selenium - 4.42.0
Ebuild name:

dev-python/selenium-4.42.0

Description

Python language binding for Selenium Remote Control

Added to portage

2026-04-10

selenium-manager - 4.42.0
Ebuild name:

dev-util/selenium-manager-4.42.0

Description

CLI tool that manages the browser/driver infrastructure required b

Added to portage

2026-04-10

smbus2 - 0.6.1
Ebuild name:

dev-python/smbus2-0.6.1

Description

A drop-in replacement for smbus-cffi/smbus-python in pure Python

Added to portage

2026-04-10

sphinx-autodoc-typehints - 3.10.0
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.10.0

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-04-10

spidermonkey - 140.9.1
Ebuild name:

dev-lang/spidermonkey-140.9.1

Description

Mozilla's JavaScript engine written in C and C++

Added to portage

2026-04-10

spotify - 1.2.86
Ebuild name:

media-sound/spotify-1.2.86

Description

Spotify is a social music platform

Added to portage

2026-04-10

tox - 4.52.1
Ebuild name:

dev-python/tox-4.52.1

Description

virtualenv-based automation of test activities

Added to portage

2026-04-10

translate-toolkit - 3.19.4
Ebuild name:

dev-python/translate-toolkit-3.19.4

Description

Toolkit to convert between many translation formats

Added to portage

2026-04-10

uv - 0.11.6
Ebuild name:

dev-python/uv-0.11.6

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-04-10

uv-build - 0.11.6
Ebuild name:

dev-python/uv-build-0.11.6

Description

PEP517 uv build backend

Added to portage

2026-04-10

virtualenv - 21.2.1
Ebuild name:

dev-python/virtualenv-21.2.1

Description

Virtual Python Environment builder

Added to portage

2026-04-10

wrapt - 2.2.0_rc2
Ebuild name:

dev-python/wrapt-2.2.0_rc2

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-04-10

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