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:

88454

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-09-18
flang-rt - 21.1.8-r1
Ebuild name:

llvm-runtimes/flang-rt-21.1.8-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

flang-rt - 22.1.8-r1
Ebuild name:

llvm-runtimes/flang-rt-22.1.8-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

flang-rt - 23.1.1-r1
Ebuild name:

llvm-runtimes/flang-rt-23.1.1-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

kirigami-addons - 1.14.0
Ebuild name:

dev-libs/kirigami-addons-1.14.0

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-09-18

pulseaudio-qt - 1.9.0
Ebuild name:

media-libs/pulseaudio-qt-1.9.0

Description

Qt bindings for libpulse

Added to portage

2026-09-18

quiche - 0.30.0
Ebuild name:

net-libs/quiche-0.30.0

Description

Implementation of the QUIC transport protocol and HTTP/3

Added to portage

2026-09-18

2026-09-17
aiostream - 0.8.1
Ebuild name:

dev-python/aiostream-0.8.1

Description

Generator-based operators for asynchronous iteration

Added to portage

2026-09-17

awscli - 2.36.47
Ebuild name:

app-admin/awscli-2.36.47

Description

Universal Command Line Environment for AWS

Added to portage

2026-09-17

boto3 - 1.43.96
Ebuild name:

dev-python/boto3-1.43.96

Description

The AWS SDK for Python

Added to portage

2026-09-17

botocore - 1.43.96
Ebuild name:

dev-python/botocore-1.43.96

Description

Low-level, data-driven core of boto 3

Added to portage

2026-09-17

braintree - 4.47.0
Ebuild name:

dev-python/braintree-4.47.0

Description

Braintree Python Library

Added to portage

2026-09-17

cachetools - 7.2.0
Ebuild name:

dev-python/cachetools-7.2.0

Description

Extensible memoizing collections and decorators

Added to portage

2026-09-17

cargo-nextest - 0.9.144
Ebuild name:

dev-util/cargo-nextest-0.9.144

Description

Next-generation test runner for Rust

Added to portage

2026-09-17

ccid - 1.8.3
Ebuild name:

app-crypt/ccid-1.8.3

Description

CCID free software driver

Added to portage

2026-09-17

clang - 24.0.0_pre20260916
Ebuild name:

dev-python/clang-24.0.0_pre20260916

Description

Python bindings for llvm-core/clang

Added to portage

2026-09-17

clang - 24.0.0_pre20260916
Ebuild name:

llvm-core/clang-24.0.0_pre20260916

Description

C language family frontend for LLVM

Added to portage

2026-09-17

clang-common - 24.0.0_pre20260916
Ebuild name:

llvm-core/clang-common-24.0.0_pre20260916

Description

Common files shared between multiple slots of clang

Added to portage

2026-09-17

compiler-rt - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/compiler-rt-24.0.0_pre20260916

Description

Compiler runtime library for clang (built-in part)

Added to portage

2026-09-17

compiler-rt-sanitizers - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-24.0.0_pre20260916

Description

Compiler runtime libraries for clang (sanit

Added to portage

2026-09-17

element-desktop-bin - 1.12.28
Ebuild name:

net-im/element-desktop-bin-1.12.28

Description

A glossy Matrix collaboration client for desktop (binary package

Added to portage

2026-09-17

emoji - 2.16.0
Ebuild name:

dev-python/emoji-2.16.0

Description

Emoji for Python

Added to portage

2026-09-17

eselect-ctags - 1.20
Ebuild name:

app-eselect/eselect-ctags-1.20

Description

Manages ctags implementations

Added to portage

2026-09-17

eselect-emacs - 1.20
Ebuild name:

app-eselect/eselect-emacs-1.20

Description

Manage multiple Emacs versions on one system

Added to portage

2026-09-17

filelock - 4.0.0
Ebuild name:

dev-python/filelock-4.0.0

Description

A platform independent file lock for Python

Added to portage

2026-09-17

fish - 4.9.3
Ebuild name:

app-shells/fish-4.9.3

Description

Friendly Interactive SHell

Added to portage

2026-09-17

flang - 24.0.0_pre20260916
Ebuild name:

llvm-core/flang-24.0.0_pre20260916

Description

LLVM's Fortran frontend

Added to portage

2026-09-17

flang-rt - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/flang-rt-24.0.0_pre20260916

Description

LLVM's Fortran runtime

Added to portage

2026-09-17

flightgear - 2024.1.7
Ebuild name:

games-simulation/flightgear-2024.1.7

Description

Open Source Flight Simulator

Added to portage

2026-09-17

flightgear-data - 2024.1.7
Ebuild name:

games-simulation/flightgear-data-2024.1.7

Description

FlightGear data files

Added to portage

2026-09-17

flit - 4.1.0
Ebuild name:

dev-python/flit-4.1.0

Description

Simplified packaging of Python modules

Added to portage

2026-09-17

flit-core - 4.1.0
Ebuild name:

dev-python/flit-core-4.1.0

Description

Simplified packaging of Python modules (core module)

Added to portage

2026-09-17

gammu - 1.45.0
Ebuild name:

app-mobilephone/gammu-1.45.0

Description

A tool to handle your cellular phone

Added to portage

2026-09-17

ggml - 0.24.0
Ebuild name:

sci-ml/ggml-0.24.0

Description

Tensor library for machine learning

Added to portage

2026-09-17

hcloud - 2.25.1
Ebuild name:

dev-python/hcloud-2.25.1

Description

Official Hetzner Cloud python library

Added to portage

2026-09-17

heroic-bin - 2.22.3
Ebuild name:

games-util/heroic-bin-2.22.3

Description

GOG and Epic Games Launcher for Linux

Added to portage

2026-09-17

hishel - 1.4.0
Ebuild name:

dev-python/hishel-1.4.0

Description

An elegant HTTP Cache implementation for HTTPX and HTTP Core

Added to portage

2026-09-17

idna - 3.20
Ebuild name:

dev-python/idna-3.20

Description

Internationalized Domain Names in Applications (IDNA)

Added to portage

2026-09-17

initsplit - 1.8_pre20160919
Ebuild name:

app-emacs/initsplit-1.8_pre20160919

Description

Split customizations into different files

Added to portage

2026-09-17

jj - 0.45.1-r1
Ebuild name:

dev-vcs/jj-0.45.1-r1

Description

Jujutsu - an experimental version control system

Added to portage

2026-09-17

krita - 6.0.4
Ebuild name:

media-gfx/krita-6.0.4

Description

Free digital painting application. Digital Painting, Creative Freedom

Added to portage

2026-09-17

libclc - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/libclc-24.0.0_pre20260916

Description

OpenCL C library

Added to portage

2026-09-17

libcxx - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/libcxx-24.0.0_pre20260916

Description

New implementation of the C++ standard library, targeting C

Added to portage

2026-09-17

libcxxabi - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/libcxxabi-24.0.0_pre20260916

Description

Low level support for a standard C++ library

Added to portage

2026-09-17

libgcc - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/libgcc-24.0.0_pre20260916

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2026-09-17

libunwind - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/libunwind-24.0.0_pre20260916

Description

C++ runtime stack unwinder from LLVM

Added to portage

2026-09-17

lit - 24.0.0_pre20260916
Ebuild name:

dev-python/lit-24.0.0_pre20260916

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2026-09-17

lld - 24.0.0_pre20260916
Ebuild name:

llvm-core/lld-24.0.0_pre20260916

Description

The LLVM linker (link editor)

Added to portage

2026-09-17

lldb - 24.0.0_pre20260916
Ebuild name:

llvm-core/lldb-24.0.0_pre20260916

Description

The LLVM debugger

Added to portage

2026-09-17

llvm - 24.0.0_pre20260916
Ebuild name:

dev-ml/llvm-24.0.0_pre20260916

Description

OCaml bindings for LLVM

Added to portage

2026-09-17

llvm - 24.0.0_pre20260916
Ebuild name:

llvm-core/llvm-24.0.0_pre20260916

Description

Low Level Virtual Machine

Added to portage

2026-09-17

llvm-common - 24.0.0_pre20260916
Ebuild name:

llvm-core/llvm-common-24.0.0_pre20260916

Description

Common files shared between multiple slots of LLVM

Added to portage

2026-09-17

mlir - 24.0.0_pre20260916
Ebuild name:

llvm-core/mlir-24.0.0_pre20260916

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2026-09-17

nginx - 1.30.5
Ebuild name:

www-servers/nginx-1.30.5

Description

Added to portage

2026-09-17

nginx - 1.31.6
Ebuild name:

www-servers/nginx-1.31.6

Description

Added to portage

2026-09-17

nodejs - 26.8.2-r2
Ebuild name:

net-libs/nodejs-26.8.2-r2

Description

A JavaScript runtime built on Chrome's V8 JavaScript engine

Added to portage

2026-09-17

ollama - 0.34.1
Ebuild name:

sci-ml/ollama-0.34.1

Description

Get up and running with Llama 3, Mistral, Gemma, and other language models

Added to portage

2026-09-17

openmp - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/openmp-24.0.0_pre20260916

Description

OpenMP runtime libraries for LLVM/clang compiler

Added to portage

2026-09-17

openmp-amdgcn-amd-amdhsa - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/openmp-amdgcn-amd-amdhsa-24.0.0_pre20260916

Description

OpenMP target library for amdgcn devices

Added to portage

2026-09-17

openmp-nvptx64-nvidia-cuda - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/openmp-nvptx64-nvidia-cuda-24.0.0_pre20260916

Description

OpenMP target library for nvptx64 devic

Added to portage

2026-09-17

openmp-spirv64-intel - 24.0.0_pre20260916
Ebuild name:

llvm-runtimes/openmp-spirv64-intel-24.0.0_pre20260916

Description

OpenMP target library for spirv64 Intel devic

Added to portage

2026-09-17

openpgp-keys-libass - 20260917
Ebuild name:

sec-keys/openpgp-keys-libass-20260917

Description

OpenPGP keys used to sign libass releases

Added to portage

2026-09-17

pcsc-lite - 2.5.1
Ebuild name:

sys-apps/pcsc-lite-2.5.1

Description

PC/SC Architecture smartcard middleware library

Added to portage

2026-09-17

pdm - 2.29.2
Ebuild name:

dev-python/pdm-2.29.2

Description

Python package and dependency manager supporting the latest PEP standards

Added to portage

2026-09-17

platformdirs - 4.11.9
Ebuild name:

dev-python/platformdirs-4.11.9

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-09-17

polly - 24.0.0_pre20260916
Ebuild name:

llvm-core/polly-24.0.0_pre20260916

Description

Polyhedral optimizations for LLVM

Added to portage

2026-09-17

postfix - 3.12_pre20260916
Ebuild name:

mail-mta/postfix-3.12_pre20260916

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-09-17

pycurl - 7.48.0
Ebuild name:

dev-python/pycurl-7.48.0

Description

Python bindings for curl/libcurl

Added to portage

2026-09-17

pygraphviz - 2.0.2
Ebuild name:

dev-python/pygraphviz-2.0.2

Description

Python wrapper for the Graphviz Agraph data structure

Added to portage

2026-09-17

pymysql - 1.2.3
Ebuild name:

dev-python/pymysql-1.2.3

Description

Pure-Python MySQL Driver

Added to portage

2026-09-17

pypdf - 6.19.0
Ebuild name:

dev-python/pypdf-6.19.0

Description

Python library to work with PDF files

Added to portage

2026-09-17

pyproject-hooks - 1.3.3
Ebuild name:

dev-python/pyproject-hooks-1.3.3

Description

Wrappers to build Python packages using PEP 517 hooks

Added to portage

2026-09-17

pytest-rerunfailures - 16.7
Ebuild name:

dev-python/pytest-rerunfailures-16.7

Description

pytest plugin to re-run tests to eliminate flaky failures

Added to portage

2026-09-17

python-gammu - 3.5.0
Ebuild name:

dev-python/python-gammu-3.5.0

Description

Python bindings for Gammu

Added to portage

2026-09-17

python-ldap - 3.4.8
Ebuild name:

dev-python/python-ldap-3.4.8

Description

Various LDAP-related Python modules

Added to portage

2026-09-17

python-pam - 2.1.0
Ebuild name:

dev-python/python-pam-2.1.0

Description

Python PAM module

Added to portage

2026-09-17

sccache - 0.18.0
Ebuild name:

dev-util/sccache-0.18.0

Description

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

Added to portage

2026-09-17

scx - 1.1.3
Ebuild name:

sys-kernel/scx-1.1.3

Description

sched_ext schedulers and tools

Added to portage

2026-09-17

scx-loader - 1.1.3
Ebuild name:

sys-kernel/scx-loader-1.1.3

Description

DBUS on-demand loader of sched-ext schedulers

Added to portage

2026-09-17

simgear - 2024.1.7
Ebuild name:

dev-games/simgear-2024.1.7

Description

Development library for simulation games

Added to portage

2026-09-17

sphinx-gallery - 0.22.0
Ebuild name:

dev-python/sphinx-gallery-0.22.0

Description

Sphinx extension to automatically generate an examples gallery

Added to portage

2026-09-17

thunderbird - 140.16.0
Ebuild name:

mail-client/thunderbird-140.16.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird - 153.3.0
Ebuild name:

mail-client/thunderbird-153.3.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird - 156.0
Ebuild name:

mail-client/thunderbird-156.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird-bin - 140.16.0
Ebuild name:

mail-client/thunderbird-bin-140.16.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird-bin - 153.3.0
Ebuild name:

mail-client/thunderbird-bin-153.3.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird-bin - 156.0
Ebuild name:

mail-client/thunderbird-bin-156.0

Description

Thunderbird Mail Client

Added to portage

2026-09-17

thunderbird-l10n - 153.3.0
Ebuild name:

mail-client/thunderbird-l10n-153.3.0

Description

Thunderbird mail client's translation files

Added to portage

2026-09-17

thunderbird-l10n - 156.0
Ebuild name:

mail-client/thunderbird-l10n-156.0

Description

Thunderbird mail client's translation files

Added to portage

2026-09-17

tox - 4.61.5
Ebuild name:

dev-python/tox-4.61.5

Description

virtualenv-based automation of test activities

Added to portage

2026-09-17

types-docutils - 0.23.0.20260917
Ebuild name:

dev-python/types-docutils-0.23.0.20260917

Description

Typing stubs for docutils

Added to portage

2026-09-17

urwid - 4.1.4
Ebuild name:

dev-python/urwid-4.1.4

Description

Curses-based user interface library for Python

Added to portage

2026-09-17

vcs-versioning - 2.4.1
Ebuild name:

dev-python/vcs-versioning-2.4.1

Description

Core VCS versioning functionality from setuptools-scm

Added to portage

2026-09-17

virtualbox - 7.2.18
Ebuild name:

app-emulation/virtualbox-7.2.18

Description

Family of powerful x86 virtualization products for enterprise and h

Added to portage

2026-09-17

virtualbox-additions - 7.2.18
Ebuild name:

app-emulation/virtualbox-additions-7.2.18

Description

CD image containing guest additions for VirtualBox

Added to portage

2026-09-17

virtualbox-extpack-oracle - 7.2.18
Ebuild name:

app-emulation/virtualbox-extpack-oracle-7.2.18

Description

PUEL extensions for VirtualBox

Added to portage

2026-09-17

virtualbox-guest-additions - 7.2.18
Ebuild name:

app-emulation/virtualbox-guest-additions-7.2.18

Description

VirtualBox kernel modules and user-space tools for

Added to portage

2026-09-17

virtualbox-guest-modules - 7.2.18
Ebuild name:

app-emulation/virtualbox-guest-modules-7.2.18

Description

Kernel Modules for Virtualbox Guest Additions

Added to portage

2026-09-17

virtualbox-kvm - 7.2.18_pre20260201
Ebuild name:

app-emulation/virtualbox-kvm-7.2.18_pre20260201

Description

Family of powerful x86 virtualization products for

Added to portage

2026-09-17

virtualbox-modules - 7.2.18
Ebuild name:

app-emulation/virtualbox-modules-7.2.18

Description

Kernel Modules for Virtualbox

Added to portage

2026-09-17

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