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:

84129

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-01
aiohttp - 3.13.5
Ebuild name:

dev-python/aiohttp-3.13.5

Description

HTTP client/server for asyncio

Added to portage

2026-04-01

ansible-compat - 26.3.0
Ebuild name:

dev-python/ansible-compat-26.3.0

Description

Contains functions that facilitate working with various versions o

Added to portage

2026-04-01

asterisk-g729 - 20.0.3.1.10-r2
Ebuild name:

net-misc/asterisk-g729-20.0.3.1.10-r2

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

asterisk-g729 - 20.0.3.1.11-r1
Ebuild name:

net-misc/asterisk-g729-20.0.3.1.11-r1

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

asterisk-g729 - 21.0.3.1.10-r2
Ebuild name:

net-misc/asterisk-g729-21.0.3.1.10-r2

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

asterisk-g729 - 21.0.3.1.11-r1
Ebuild name:

net-misc/asterisk-g729-21.0.3.1.11-r1

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

asterisk-g729 - 22.0.3.1.10-r2
Ebuild name:

net-misc/asterisk-g729-22.0.3.1.10-r2

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

asterisk-g729 - 22.0.3.1.11-r1
Ebuild name:

net-misc/asterisk-g729-22.0.3.1.11-r1

Description

G.729 codec and supporting files for asterisk

Added to portage

2026-04-01

awscli - 1.44.70
Ebuild name:

app-admin/awscli-1.44.70

Description

Universal Command Line Environment for AWS

Added to portage

2026-04-01

blueprint-compiler - 0.20.4
Ebuild name:

dev-util/blueprint-compiler-0.20.4

Description

Compiler for Blueprint, a markup language for GTK user interface

Added to portage

2026-04-01

boto3 - 1.42.80
Ebuild name:

dev-python/boto3-1.42.80

Description

The AWS SDK for Python

Added to portage

2026-04-01

botocore - 1.42.80
Ebuild name:

dev-python/botocore-1.42.80

Description

Low-level, data-driven core of boto 3

Added to portage

2026-04-01

coq - 9.2.0
Ebuild name:

sci-mathematics/coq-9.2.0

Description

Coq/Rocq is a proof assistant written in O'Caml

Added to portage

2026-04-01

devcontainer - 0.85.0
Ebuild name:

app-containers/devcontainer-0.85.0

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-04-01

flask-compress - 1.24
Ebuild name:

dev-python/flask-compress-1.24

Description

Compress responses in your Flask app with gzip

Added to portage

2026-04-01

gnumach - 1.8_p20260330
Ebuild name:

sys-kernel/gnumach-1.8_p20260330

Description

GNU Mach microkernel, for the Hurd

Added to portage

2026-04-01

guile-git - 0.11.0
Ebuild name:

dev-scheme/guile-git-0.11.0

Description

Guile bindings of git

Added to portage

2026-04-01

hurd - 0.9_p20260331
Ebuild name:

sys-kernel/hurd-0.9_p20260331

Description

GNU Hurd is the GNU project's replacement for UNIX

Added to portage

2026-04-01

jellyfin-bin - 10.11.7
Ebuild name:

www-apps/jellyfin-bin-10.11.7

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2026-04-01

ksmbd-tools - 3.5.6
Ebuild name:

net-fs/ksmbd-tools-3.5.6

Description

cifsd/ksmbd kernel server userspace utilities

Added to portage

2026-04-01

kup - 0.3.6-r8
Ebuild name:

dev-util/kup-0.3.6-r8

Description

kernel.org uploader tool

Added to portage

2026-04-01

libopenmpt - 0.8.6
Ebuild name:

media-libs/libopenmpt-0.8.6

Description

Library to decode tracked music files (modules)

Added to portage

2026-04-01

meson-mode - 0.4
Ebuild name:

app-emacs/meson-mode-0.4

Description

A GNU Emacs major mode for Meson build-system files

Added to portage

2026-04-01

meson-mode - 9999
Ebuild name:

app-emacs/meson-mode-9999

Description

A GNU Emacs major mode for Meson build-system files

Added to portage

2026-04-01

metamath-mode - 0_p20221005
Ebuild name:

app-emacs/metamath-mode-0_p20221005

Description

Major GNU Emacs mode for metamath files

Added to portage

2026-04-01

mig - 1.8_p20260123
Ebuild name:

dev-util/mig-1.8_p20260123

Description

GNU Mach 3.0 interface generator (IDL compiler)

Added to portage

2026-04-01

motif - 2.5.1-r1
Ebuild name:

x11-libs/motif-2.5.1-r1

Description

The Motif user interface component toolkit

Added to portage

2026-04-01

mypy - 1.20.0
Ebuild name:

dev-python/mypy-1.20.0

Description

Optional static typing for Python

Added to portage

2026-04-01

nprolog - 4.90
Ebuild name:

dev-lang/nprolog-4.90

Description

Interpreter and compiler to be compatible with Arity/Prolog32

Added to portage

2026-04-01

openmpt123 - 0.8.6
Ebuild name:

media-sound/openmpt123-0.8.6

Description

libopenmpt-based command line player for tracked music files (modules)

Added to portage

2026-04-01

opentimelineio - 0.18.1
Ebuild name:

media-libs/opentimelineio-0.18.1

Description

Open Source API and interchange format for editorial timeline info

Added to portage

2026-04-01

orjson - 3.11.8
Ebuild name:

dev-python/orjson-3.11.8

Description

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

Added to portage

2026-04-01

picom - 13
Ebuild name:

x11-misc/picom-13

Description

A lightweight compositor for X11 (previously a compton fork)

Added to portage

2026-04-01

protontricks - 1.14.1
Ebuild name:

app-emulation/protontricks-1.14.1

Description

app-emulation/winetricks wrapper for Proton (Steam Play) games

Added to portage

2026-04-01

pydantic - 2.13.0_beta3
Ebuild name:

dev-python/pydantic-2.13.0_beta3

Description

Data parsing and validation using Python type hints

Added to portage

2026-04-01

sbcl - 2.6.3
Ebuild name:

dev-lisp/sbcl-2.6.3

Description

Steel Bank Common Lisp (SBCL) is an implementation of ANSI Common Lisp

Added to portage

2026-04-01

typescript - 6.0.2
Ebuild name:

dev-lang/typescript-6.0.2

Description

Superset of JavaScript with optional static typing, classes and interface

Added to portage

2026-04-01

vivaldi-snapshot - 7.10.3995.3
Ebuild name:

www-client/vivaldi-snapshot-7.10.3995.3

Description

A browser for our friends

Added to portage

2026-04-01

xpra-html5 - 20
Ebuild name:

www-apps/xpra-html5-20

Description

HTML5 client to connect to any xpra server

Added to portage

2026-04-01

xz-utils - 5.8.3
Ebuild name:

app-arch/xz-utils-5.8.3

Description

Utils for managing LZMA compressed files

Added to portage

2026-04-01

zenburn-theme - 2.9.0
Ebuild name:

app-emacs/zenburn-theme-2.9.0

Description

Zenburn color theme for Emacs

Added to portage

2026-04-01

2026-03-31
awscli - 1.44.69
Ebuild name:

app-admin/awscli-1.44.69

Description

Universal Command Line Environment for AWS

Added to portage

2026-03-31

bash - 5.3_p9-r1
Ebuild name:

app-shells/bash-5.3_p9-r1

Description

The standard GNU Bourne again shell

Added to portage

2026-03-31

bash - 5.4_alpha_pre20251202-r1
Ebuild name:

app-shells/bash-5.4_alpha_pre20251202-r1

Description

The standard GNU Bourne again shell

Added to portage

2026-03-31

bcachefs-tools - 1.37.4
Ebuild name:

sys-fs/bcachefs-tools-1.37.4

Description

Tools for bcachefs

Added to portage

2026-03-31

blake3 - 1.8.4
Ebuild name:

dev-libs/blake3-1.8.4

Description

a fast cryptographic hash function

Added to portage

2026-03-31

blessed - 1.38.0
Ebuild name:

dev-python/blessed-1.38.0

Description

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

Added to portage

2026-03-31

boto3 - 1.42.79
Ebuild name:

dev-python/boto3-1.42.79

Description

The AWS SDK for Python

Added to portage

2026-03-31

botocore - 1.42.79
Ebuild name:

dev-python/botocore-1.42.79

Description

Low-level, data-driven core of boto 3

Added to portage

2026-03-31

chrome-binary-plugins - 148.0.7753.0_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-148.0.7753.0_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-03-31

chromium - 148.0.7753.0
Ebuild name:

www-client/chromium-148.0.7753.0

Description

Open-source version of Google Chrome web browser

Added to portage

2026-03-31

claws-mail - 4.4.0
Ebuild name:

mail-client/claws-mail-4.4.0

Description

An email client (and news reader) based on GTK+

Added to portage

2026-03-31

devedeng - 4.21.3.1
Ebuild name:

media-video/devedeng-4.21.3.1

Description

DevedeNG is a program to create video DVDs and CDs (VCD, sVCD or CVD)

Added to portage

2026-03-31

discid - 1.4.0
Ebuild name:

dev-python/discid-1.4.0

Description

Python bindings for libdiscid

Added to portage

2026-03-31

dnsdist - 2.0.3
Ebuild name:

net-dns/dnsdist-2.0.3

Description

A highly DNS-, DoS- and abuse-aware loadbalancer

Added to portage

2026-03-31

dovecot - 2.4.3-r1
Ebuild name:

net-mail/dovecot-2.4.3-r1

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-03-31

easy-rsa - 3.2.6
Ebuild name:

app-crypt/easy-rsa-3.2.6

Description

Small RSA key management package, based on OpenSSL

Added to portage

2026-03-31

evisum - 1.2.0
Ebuild name:

sys-process/evisum-1.2.0

Description

System and process monitor written with EFL

Added to portage

2026-03-31

exaile - 4.2.2
Ebuild name:

media-sound/exaile-4.2.2

Description

GTK+ based media player aiming to be similar to Amarok

Added to portage

2026-03-31

faker - 40.12.0
Ebuild name:

dev-python/faker-40.12.0

Description

A Python package that generates fake data for you

Added to portage

2026-03-31

frr - 10.1.4
Ebuild name:

net-misc/frr-10.1.4

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

frr - 10.2.5
Ebuild name:

net-misc/frr-10.2.5

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

frr - 10.3.3
Ebuild name:

net-misc/frr-10.3.3

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

frr - 10.4.3
Ebuild name:

net-misc/frr-10.4.3

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

frr - 10.5.3
Ebuild name:

net-misc/frr-10.5.3

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

frr - 10.6.0
Ebuild name:

net-misc/frr-10.6.0

Description

The FRRouting Protocol Suite

Added to portage

2026-03-31

gajim - 2.4.5
Ebuild name:

net-im/gajim-2.4.5

Description

GTK XMPP Client

Added to portage

2026-03-31

geeqie - 2.6.1-r2
Ebuild name:

media-gfx/geeqie-2.6.1-r2

Description

A lightweight GTK image viewer forked from GQview

Added to portage

2026-03-31

gettext - 1.0
Ebuild name:

sys-devel/gettext-1.0

Description

GNU locale utilities

Added to portage

2026-03-31

gimp - 3.2.2-r1
Ebuild name:

media-gfx/gimp-3.2.2-r1

Description

GNU Image Manipulation Program

Added to portage

2026-03-31

google-api-core - 2.30.1
Ebuild name:

dev-python/google-api-core-2.30.1

Description

Core Library for Google Client Libraries

Added to portage

2026-03-31

google-auth-httplib2 - 0.3.1
Ebuild name:

dev-python/google-auth-httplib2-0.3.1

Description

httplib2 Transport for Google Auth

Added to portage

2026-03-31

google-auth-oauthlib - 1.3.1
Ebuild name:

dev-python/google-auth-oauthlib-1.3.1

Description

Google Authentication Library

Added to portage

2026-03-31

google-chrome-unstable - 148.0.7753.0
Ebuild name:

www-client/google-chrome-unstable-148.0.7753.0

Description

The web browser from Google

Added to portage

2026-03-31

gr-fosphor - 0.0_p20260330
Ebuild name:

net-analyzer/gr-fosphor-0.0_p20260330

Description

gnuradio fosphor block (GPU spectrum display)

Added to portage

2026-03-31

grpcio - 1.80.0
Ebuild name:

dev-python/grpcio-1.80.0

Description

HTTP/2-based RPC framework

Added to portage

2026-03-31

grpcio-status - 1.80.0
Ebuild name:

dev-python/grpcio-status-1.80.0

Description

Reference package for GRPC Python status proto mapping

Added to portage

2026-03-31

gshisen - 1.3.0-r3
Ebuild name:

gnustep-apps/gshisen-1.3.0-r3

Description

The first GNUstep game, similar to Mahjongg

Added to portage

2026-03-31

just - 1.48.1
Ebuild name:

dev-build/just-1.48.1

Description

Just a command runner (with syntax inspired by 'make')

Added to portage

2026-03-31

krita - 6.0.1
Ebuild name:

media-gfx/krita-6.0.1

Description

Free digital painting application. Digital Painting, Creative Freedom

Added to portage

2026-03-31

libetpan - 1.9.4-r3
Ebuild name:

net-libs/libetpan-1.9.4-r3

Description

A portable, efficient middleware for different kinds of mail access

Added to portage

2026-03-31

lidarr-bin - 3.1.2.4938
Ebuild name:

www-apps/lidarr-bin-3.1.2.4938

Description

Looks and smells like Sonarr but made for music

Added to portage

2026-03-31

luv - 1.52.1.0
Ebuild name:

dev-lua/luv-1.52.1.0

Description

Bare libuv bindings for lua

Added to portage

2026-03-31

mew - 6.8_p20230203
Ebuild name:

app-emacs/mew-6.8_p20230203

Description

Great MIME mail reader for Emacs/XEmacs

Added to portage

2026-03-31

mic-paren - 3.15-r1
Ebuild name:

app-emacs/mic-paren-3.15-r1

Description

Advanced highlighting of matching parentheses

Added to portage

2026-03-31

microsoft-edge - 146.0.3856.84
Ebuild name:

www-client/microsoft-edge-146.0.3856.84

Description

The web browser from Microsoft

Added to portage

2026-03-31

mimalloc - 2.2.7-r1
Ebuild name:

dev-libs/mimalloc-2.2.7-r1

Description

A compact general purpose allocator with excellent performance

Added to portage

2026-03-31

mimalloc - 3.2.8-r1
Ebuild name:

dev-libs/mimalloc-3.2.8-r1

Description

A compact general purpose allocator with excellent performance

Added to portage

2026-03-31

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-03-31

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-03-31

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-03-31

nextcloud-client - 33.0.1
Ebuild name:

net-misc/nextcloud-client-33.0.1

Description

Desktop Syncing Client for Nextcloud

Added to portage

2026-03-31

nghttp2 - 1.68.1
Ebuild name:

net-libs/nghttp2-1.68.1

Description

HTTP/2 C Library

Added to portage

2026-03-31

ngspice - 46
Ebuild name:

sci-electronics/ngspice-46

Description

The Next Generation Spice (Electronic Circuit Simulator)

Added to portage

2026-03-31

ngtcp2 - 1.22.0
Ebuild name:

net-libs/ngtcp2-1.22.0

Description

Implementation of the IETF QUIC Protocol

Added to portage

2026-03-31

ntp - 4.2.8_p18-r3
Ebuild name:

net-misc/ntp-4.2.8_p18-r3

Description

Network Time Protocol suite/programs

Added to portage

2026-03-31

pf-sources - 6.19_p4
Ebuild name:

sys-kernel/pf-sources-6.19_p4

Description

Added to portage

2026-03-31

prowlarr-bin - 2.3.5.5318
Ebuild name:

www-apps/prowlarr-bin-2.3.5.5318

Description

An indexer manager/proxy to integrate with your various PVR apps

Added to portage

2026-03-31

pyproject-fmt - 2.21.0
Ebuild name:

dev-python/pyproject-fmt-2.21.0

Description

Format your pyproject.toml file

Added to portage

2026-03-31

requests - 2.33.1
Ebuild name:

dev-python/requests-2.33.1

Description

HTTP library for human beings

Added to portage

2026-03-31

rsync-bpc - 3.1.3.0_p20251201-r1
Ebuild name:

net-misc/rsync-bpc-3.1.3.0_p20251201-r1

Description

Rsync-bpc is a customized version of rsync that is used as

Added to portage

2026-03-31

tree-sitter-lua - 0.5.0
Ebuild name:

dev-libs/tree-sitter-lua-0.5.0

Description

Lua grammar for Tree-sitter

Added to portage

2026-03-31

tree-sitter-markdown - 0.5.3
Ebuild name:

dev-libs/tree-sitter-markdown-0.5.3

Description

Markdown grammar for Tree-sitter

Added to portage

2026-03-31

tree-sitter-vim - 0.8.1
Ebuild name:

dev-libs/tree-sitter-vim-0.8.1

Description

Vimscript grammar for Tree-sitter

Added to portage

2026-03-31

unzip - 6.0_p29-r2
Ebuild name:

app-arch/unzip-6.0_p29-r2

Description

unzipper for pkzip-compressed files

Added to portage

2026-03-31

urwid - 4.0.0
Ebuild name:

dev-python/urwid-4.0.0

Description

Curses-based user interface library for Python

Added to portage

2026-03-31

vcsi - 7.0.17
Ebuild name:

media-video/vcsi-7.0.17

Description

Create thumbnail sheets from video files

Added to portage

2026-03-31

vinyl - 0
Ebuild name:

acct-group/vinyl-0

Description

group for vinyl-cache

Added to portage

2026-03-31

vinyl - 0
Ebuild name:

acct-user/vinyl-0

Description

user for vinyl-cache

Added to portage

2026-03-31

vinyl-cache - 8.0.0
Ebuild name:

www-servers/vinyl-cache-8.0.0

Description

Varnish is a state-of-the-art, high-performance HTTP accelerator

Added to portage

2026-03-31

vinyl-cache - 8.0.1
Ebuild name:

www-servers/vinyl-cache-8.0.1

Description

Varnish is a state-of-the-art, high-performance HTTP accelerator

Added to portage

2026-03-31

vinyl-cache - 9.0.0
Ebuild name:

www-servers/vinyl-cache-9.0.0

Description

A high-performance caching HTTP reverse proxy

Added to portage

2026-03-31

xfce4-terminal - 1.2.0-r1
Ebuild name:

x11-terms/xfce4-terminal-1.2.0-r1

Description

A terminal emulator for the Xfce desktop environment

Added to portage

2026-03-31

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