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:

87008

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-07-19
diffoscope - 325
Ebuild name:

dev-util/diffoscope-325

Description

Will try to get to the bottom of what makes files or directories different

Added to portage

2026-07-19

dist-kernel - 6.12.96
Ebuild name:

virtual/dist-kernel-6.12.96

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

dist-kernel - 6.18.39
Ebuild name:

virtual/dist-kernel-6.18.39

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

dist-kernel - 7.1.4
Ebuild name:

virtual/dist-kernel-7.1.4

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-07-19

gentoo-kernel - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-6.12.96

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-6.18.39

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-7.1.4

Description

Linux kernel built with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.96

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.39

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-bin - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.1.4

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-07-19

gentoo-kernel-modprep - 6.12.96
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.12.96

Description

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

Added to portage

2026-07-19

gentoo-kernel-modprep - 6.18.39
Ebuild name:

sys-kernel/gentoo-kernel-modprep-6.18.39

Description

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

Added to portage

2026-07-19

gentoo-kernel-modprep - 7.1.4
Ebuild name:

sys-kernel/gentoo-kernel-modprep-7.1.4

Description

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

Added to portage

2026-07-19

intellij-idea - 2026.2
Ebuild name:

dev-util/intellij-idea-2026.2

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-07-19

kdiff3 - 1.12.5
Ebuild name:

kde-misc/kdiff3-1.12.5

Description

Frontend to diff3 based on KDE Frameworks

Added to portage

2026-07-19

openrsync - 0.5.0_p20260706
Ebuild name:

net-misc/openrsync-0.5.0_p20260706

Description

BSD-licensed implementation of rsync

Added to portage

2026-07-19

service-manager - 3
Ebuild name:

virtual/service-manager-3

Description

Virtual for various service managers

Added to portage

2026-07-19

vanilla-kernel - 6.12.96
Ebuild name:

sys-kernel/vanilla-kernel-6.12.96

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

vanilla-kernel - 6.18.39
Ebuild name:

sys-kernel/vanilla-kernel-6.18.39

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

vanilla-kernel - 7.1.4
Ebuild name:

sys-kernel/vanilla-kernel-7.1.4

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-07-19

2026-07-18
Bytes-Random-Secure - 0.290.0-r1
Ebuild name:

dev-perl/Bytes-Random-Secure-0.290.0-r1

Description

Extension to generate cryptographically-secure random bytes

Added to portage

2026-07-18

Crypt-PBKDF2 - 0.261.630
Ebuild name:

dev-perl/Crypt-PBKDF2-0.261.630

Description

The PBKDF2 password hashing algorithm

Added to portage

2026-07-18

CryptX - 0.90.0
Ebuild name:

dev-perl/CryptX-0.90.0

Description

Self-contained crypto toolkit

Added to portage

2026-07-18

HTTP-Date - 6.80.0
Ebuild name:

dev-perl/HTTP-Date-6.80.0

Description

Date conversion for HTTP date formats

Added to portage

2026-07-18

Net-CIDR-Lite - 0.240.0
Ebuild name:

dev-perl/Net-CIDR-Lite-0.240.0

Description

Perl extension for merging IPv4 or IPv6 CIDR addresses

Added to portage

2026-07-18

Net-DNS - 1.560.0
Ebuild name:

dev-perl/Net-DNS-1.560.0

Description

Perl Interface to the Domain Name System

Added to portage

2026-07-18

String-Util - 1.360.0
Ebuild name:

dev-perl/String-Util-1.360.0

Description

String processing utility functions

Added to portage

2026-07-18

alsa-ucm-conf - 1.2.16.1
Ebuild name:

media-libs/alsa-ucm-conf-1.2.16.1

Description

ALSA ucm configuration files

Added to portage

2026-07-18

avrdude - 8.2
Ebuild name:

dev-embedded/avrdude-8.2

Description

AVR Downloader/UploaDEr

Added to portage

2026-07-18

awscli - 1.45.51
Ebuild name:

app-admin/awscli-1.45.51

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-18

boltons - 26.1.0
Ebuild name:

dev-python/boltons-26.1.0

Description

Pure-python utilities in the same spirit as the standard library

Added to portage

2026-07-18

boto3 - 1.43.51
Ebuild name:

dev-python/boto3-1.43.51

Description

The AWS SDK for Python

Added to portage

2026-07-18

botocore - 1.43.51
Ebuild name:

dev-python/botocore-1.43.51

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-18

ca-certificates - 20260601.3.112.5
Ebuild name:

app-misc/ca-certificates-20260601.3.112.5

Description

Common CA Certificates PEM files

Added to portage

2026-07-18

colorlog - 6.11.0
Ebuild name:

dev-python/colorlog-6.11.0

Description

Log formatting with colors

Added to portage

2026-07-18

deno-bin - 2.9.3
Ebuild name:

dev-lang/deno-bin-2.9.3

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-07-18

dxvk - 3.0.2
Ebuild name:

app-emulation/dxvk-3.0.2

Description

Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine

Added to portage

2026-07-18

filelock - 3.30.3
Ebuild name:

dev-python/filelock-3.30.3

Description

A platform independent file lock for Python

Added to portage

2026-07-18

gentoo-sources - 6.12.96
Ebuild name:

sys-kernel/gentoo-sources-6.12.96

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-07-18

gentoo-sources - 6.18.39
Ebuild name:

sys-kernel/gentoo-sources-6.18.39

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-07-18

gentoo-sources - 7.1.4
Ebuild name:

sys-kernel/gentoo-sources-7.1.4

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-07-18

gpgme - 2.1.2
Ebuild name:

app-crypt/gpgme-2.1.2

Description

GnuPG Made Easy is a library for making GnuPG easier to use

Added to portage

2026-07-18

haveged - 1.9.26
Ebuild name:

sys-apps/haveged-1.9.26

Description

A simple entropy daemon using the HAVEGE algorithm

Added to portage

2026-07-18

installkernel - 70
Ebuild name:

sys-kernel/installkernel-70

Description

Gentoo fork of installkernel script from debianutils

Added to portage

2026-07-18

json-c - 0.19
Ebuild name:

dev-libs/json-c-0.19

Description

A JSON implementation in C

Added to portage

2026-07-18

json-c - 0.19-r2
Ebuild name:

dev-libs/json-c-0.19-r2

Description

A JSON implementation in C

Added to portage

2026-07-18

jupyter-builder - 1.1.1
Ebuild name:

dev-python/jupyter-builder-1.1.1

Description

JupyterLab build tools

Added to portage

2026-07-18

jupyter-server-proxy - 4.5.0
Ebuild name:

dev-python/jupyter-server-proxy-4.5.0

Description

Jupyter notebook server extension to proxy web services

Added to portage

2026-07-18

jupyterlab - 4.6.1
Ebuild name:

dev-python/jupyterlab-4.6.1

Description

JupyterLab computational environment

Added to portage

2026-07-18

jupyterlab-lsp - 5.3.0
Ebuild name:

dev-python/jupyterlab-lsp-5.3.0

Description

Coding assistance for JupyterLab with Language Server Protocol

Added to portage

2026-07-18

kitty - 0.48.0
Ebuild name:

x11-terms/kitty-0.48.0

Description

Fast, feature-rich, GPU-based terminal

Added to portage

2026-07-18

kitty-shell-integration - 0.48.0
Ebuild name:

x11-terms/kitty-shell-integration-0.48.0

Description

Shell integration scripts for kitty, a GPU-based terminal

Added to portage

2026-07-18

kitty-terminfo - 0.48.0
Ebuild name:

x11-terms/kitty-terminfo-0.48.0

Description

Terminfo for kitty, a GPU-based terminal emulator

Added to portage

2026-07-18

libintl-perl - 1.370.0
Ebuild name:

dev-perl/libintl-perl-1.370.0

Description

High-Level Interface to Uniforum Message Translation

Added to portage

2026-07-18

lsof - 4.99.7
Ebuild name:

sys-process/lsof-4.99.7

Description

Lists open files for running Unix processes

Added to portage

2026-07-18

mic-paren - 3.15-r1
Ebuild name:

app-emacs/mic-paren-3.15-r1

Description

Advanced highlighting of matching parentheses

Added to portage

2026-07-18

mitmproxy-linux - 0.12.10
Ebuild name:

net-proxy/mitmproxy-linux-0.12.10

Description

mitmproxy's Rust bits (Linux-specific part)

Added to portage

2026-07-18

mitmproxy-rs - 0.12.10
Ebuild name:

net-proxy/mitmproxy-rs-0.12.10

Description

mitmproxy's Rust bits

Added to portage

2026-07-18

mldonkey - 0.0.4b-r2
Ebuild name:

app-emacs/mldonkey-0.0.4b-r2

Description

An Emacs Lisp interface to the MLDonkey core

Added to portage

2026-07-18

mmm-mode - 0.5.11
Ebuild name:

app-emacs/mmm-mode-0.5.11

Description

Enables the user to edit different parts of a file in different major mod

Added to portage

2026-07-18

moccur-edit - 2.16
Ebuild name:

app-emacs/moccur-edit-2.16

Description

An improved interface to color-moccur for editing

Added to portage

2026-07-18

mocker - 0.5.0
Ebuild name:

app-emacs/mocker-0.5.0

Description

Simple mocking framework for Emacs

Added to portage

2026-07-18

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-07-18

modus-themes - 5.3.0
Ebuild name:

app-emacs/modus-themes-5.3.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-07-18

ogre - 14.5.2
Ebuild name:

dev-games/ogre-14.5.2

Description

Object-oriented Graphics Rendering Engine

Added to portage

2026-07-18

peewee - 4.2.6
Ebuild name:

dev-python/peewee-4.2.6

Description

Small Python ORM

Added to portage

2026-07-18

python - 0.3.15.0_beta4
Ebuild name:

dev-lang/python-0.3.15.0_beta4

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2026-07-18

python - 3.15.0_beta4
Ebuild name:

dev-lang/python-3.15.0_beta4

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2026-07-18

python-tests - 0.3.15.0_beta4
Ebuild name:

dev-python/python-tests-0.3.15.0_beta4

Description

Test modules from dev-lang/python

Added to portage

2026-07-18

python-tests - 3.15.0_beta4
Ebuild name:

dev-python/python-tests-3.15.0_beta4

Description

Test modules from dev-lang/python

Added to portage

2026-07-18

pythontex - 0.19
Ebuild name:

dev-tex/pythontex-0.19

Description

Fast Access to Python from within LaTeX

Added to portage

2026-07-18

qlog - 0.51.1
Ebuild name:

media-radio/qlog-0.51.1

Description

Amateur radio logbook software

Added to portage

2026-07-18

qpwgraph - 1.0.2
Ebuild name:

media-sound/qpwgraph-1.0.2

Description

PipeWire Graph Qt GUI Interface

Added to portage

2026-07-18

rbpdf - 1.21.4-r1
Ebuild name:

dev-ruby/rbpdf-1.21.4-r1

Description

Ruby on Rails RBPDF plugin

Added to portage

2026-07-18

tomlkit - 0.15.1
Ebuild name:

dev-python/tomlkit-0.15.1

Description

Style preserving TOML library

Added to portage

2026-07-18

tortoisehg - 7.2.2
Ebuild name:

dev-vcs/tortoisehg-7.2.2

Description

Set of graphical tools for Mercurial

Added to portage

2026-07-18

tox - 4.57.0
Ebuild name:

dev-python/tox-4.57.0

Description

virtualenv-based automation of test activities

Added to portage

2026-07-18

tqdm - 4.69.0
Ebuild name:

dev-python/tqdm-4.69.0

Description

Add a progress meter to your loops in a second

Added to portage

2026-07-18

tree-sitter-phpdoc - 0.1.8
Ebuild name:

dev-libs/tree-sitter-phpdoc-0.1.8

Description

PHPDoc grammar for Tree-sitter

Added to portage

2026-07-18

ut2004-bonuspack-cbp1 - 1-r4
Ebuild name:

games-fps/ut2004-bonuspack-cbp1-1-r4

Description

UT2003 Community Bonus Pack for UT2004 Volume 1

Added to portage

2026-07-18

ut2004-bonuspack-cbp2 - 1-r4
Ebuild name:

games-fps/ut2004-bonuspack-cbp2-1-r4

Description

UT2004 Community Bonus Pack 2 Volume 1 and 2

Added to portage

2026-07-18

ut2004-bonuspack-ece - 1-r5
Ebuild name:

games-fps/ut2004-bonuspack-ece-1-r5

Description

UT2004 Editor's Choice Edition - Editor's Choice Edition bonus

Added to portage

2026-07-18

ut2004-bonuspack-mega - 1-r4
Ebuild name:

games-fps/ut2004-bonuspack-mega-1-r4

Description

UT2004 Megapack - Megapack bonus pack

Added to portage

2026-07-18

vanilla-sources - 6.12.96
Ebuild name:

sys-kernel/vanilla-sources-6.12.96

Description

Full sources for the Linux kernel

Added to portage

2026-07-18

vanilla-sources - 6.18.39
Ebuild name:

sys-kernel/vanilla-sources-6.18.39

Description

Full sources for the Linux kernel

Added to portage

2026-07-18

vanilla-sources - 7.1.4
Ebuild name:

sys-kernel/vanilla-sources-7.1.4

Description

Full sources for the Linux kernel

Added to portage

2026-07-18

virt-firmware - 26.7.1
Ebuild name:

app-emulation/virt-firmware-26.7.1

Description

Tools for ovmf/armvirt firmware volumes

Added to portage

2026-07-18

volk - 3.3.0
Ebuild name:

sci-libs/volk-3.3.0

Description

vector optimized library of kernels

Added to portage

2026-07-18

vpl-gpu-rt - 26.2.4
Ebuild name:

media-libs/vpl-gpu-rt-26.2.4

Description

Intel Video Processing Library GPU Runtime

Added to portage

2026-07-18

websockets - 16.1.1
Ebuild name:

dev-python/websockets-16.1.1

Description

Library for building WebSocket servers and clients in Python

Added to portage

2026-07-18

weston - 16.0.0
Ebuild name:

dev-libs/weston-16.0.0

Description

Wayland reference compositor

Added to portage

2026-07-18

whenever - 0.10.3
Ebuild name:

dev-python/whenever-0.10.3

Description

Modern datetime library for Python

Added to portage

2026-07-18

wireless-regdb - 20260530
Ebuild name:

net-wireless/wireless-regdb-20260530

Description

Wireless Regulatory database for Linux

Added to portage

2026-07-18

wordpress - 7.0.2
Ebuild name:

www-apps/wordpress-7.0.2

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2026-07-18

xrdb - 1.2.3-r2
Ebuild name:

x11-apps/xrdb-1.2.3-r2

Description

X server resource database utility

Added to portage

2026-07-18

z3 - 5.0.0
Ebuild name:

sci-mathematics/z3-5.0.0

Description

An efficient theorem prover

Added to portage

2026-07-18

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