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:

85346

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-05-25
2026-05-24
akonadi-config - 1
Ebuild name:

kde-apps/akonadi-config-1

Description

Default Akonadi storage backend configuration

Added to portage

2026-05-24

bazelisk - 1.29.0
Ebuild name:

dev-build/bazelisk-1.29.0

Description

A user-friendly launcher for Bazel written in Go

Added to portage

2026-05-24

blessed - 1.44.0
Ebuild name:

dev-python/blessed-1.44.0

Description

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

Added to portage

2026-05-24

chrome-binary-plugins - 148.0.7778.178
Ebuild name:

www-plugins/chrome-binary-plugins-148.0.7778.178

Description

Binary plugins from Google Chrome for use in Chrom

Added to portage

2026-05-24

chrome-binary-plugins - 149.0.7827.22_beta
Ebuild name:

www-plugins/chrome-binary-plugins-149.0.7827.22_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-05-24

chrome-binary-plugins - 150.0.7846.4_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-150.0.7846.4_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-05-24

chromedriver-bin - 148.0.7778.178
Ebuild name:

www-apps/chromedriver-bin-148.0.7778.178

Description

WebDriver for Chrome

Added to portage

2026-05-24

chromium - 148.0.7778.178
Ebuild name:

www-client/chromium-148.0.7778.178

Description

Open-source version of Google Chrome web browser

Added to portage

2026-05-24

chromium - 149.0.7827.22
Ebuild name:

www-client/chromium-149.0.7827.22

Description

Open-source version of Google Chrome web browser

Added to portage

2026-05-24

chromium - 150.0.7846.4
Ebuild name:

www-client/chromium-150.0.7846.4

Description

Open-source version of Google Chrome web browser

Added to portage

2026-05-24

closure-compiler-bin - 20260520
Ebuild name:

dev-lang/closure-compiler-bin-20260520

Description

JavaScript optimizing compiler

Added to portage

2026-05-24

cython - 3.2.5
Ebuild name:

dev-python/cython-3.2.5

Description

A Python to C compiler

Added to portage

2026-05-24

dbus-fast - 5.0.4
Ebuild name:

dev-python/dbus-fast-5.0.4

Description

A faster version of dbus-next

Added to portage

2026-05-24

dist-kernel - 5.10.257
Ebuild name:

virtual/dist-kernel-5.10.257

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 5.15.208
Ebuild name:

virtual/dist-kernel-5.15.208

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 6.1.174
Ebuild name:

virtual/dist-kernel-6.1.174

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 6.12.91
Ebuild name:

virtual/dist-kernel-6.12.91

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 6.18.33
Ebuild name:

virtual/dist-kernel-6.18.33

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 6.6.141
Ebuild name:

virtual/dist-kernel-6.6.141

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

dist-kernel - 7.0.10
Ebuild name:

virtual/dist-kernel-7.0.10

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-24

duration - 0.3.1
Ebuild name:

dev-ml/duration-0.3.1

Description

Duration - conversions to various time units

Added to portage

2026-05-24

firefox - 140.11.0
Ebuild name:

www-client/firefox-140.11.0

Description

Firefox Web Browser

Added to portage

2026-05-24

gcc - 13.4.1_p20260520
Ebuild name:

sys-devel/gcc-13.4.1_p20260520

Description

The GNU Compiler Collection

Added to portage

2026-05-24

gcc - 14.3.1_p20260521
Ebuild name:

sys-devel/gcc-14.3.1_p20260521

Description

The GNU Compiler Collection

Added to portage

2026-05-24

gcc - 15.2.1_p20260522
Ebuild name:

sys-devel/gcc-15.2.1_p20260522

Description

The GNU Compiler Collection

Added to portage

2026-05-24

gcc - 16.1.1_p20260523
Ebuild name:

sys-devel/gcc-16.1.1_p20260523

Description

The GNU Compiler Collection

Added to portage

2026-05-24

gentoo-kernel - 5.10.257
Ebuild name:

sys-kernel/gentoo-kernel-5.10.257

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 5.15.208
Ebuild name:

sys-kernel/gentoo-kernel-5.15.208

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 6.1.174
Ebuild name:

sys-kernel/gentoo-kernel-6.1.174

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 6.12.91
Ebuild name:

sys-kernel/gentoo-kernel-6.12.91

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 6.18.33
Ebuild name:

sys-kernel/gentoo-kernel-6.18.33

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 6.6.141
Ebuild name:

sys-kernel/gentoo-kernel-6.6.141

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel - 7.0.10
Ebuild name:

sys-kernel/gentoo-kernel-7.0.10

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 5.10.257
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.10.257

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 5.15.208
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.15.208

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 6.1.174
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.174

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 6.12.91
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.91

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 6.18.33
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.33

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 6.6.141
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.6.141

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-kernel-bin - 7.0.10
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.0.10

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-24

gentoo-sources - 5.10.257
Ebuild name:

sys-kernel/gentoo-sources-5.10.257

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 5.15.208
Ebuild name:

sys-kernel/gentoo-sources-5.15.208

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 6.1.174
Ebuild name:

sys-kernel/gentoo-sources-6.1.174

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 6.12.91
Ebuild name:

sys-kernel/gentoo-sources-6.12.91

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 6.18.33
Ebuild name:

sys-kernel/gentoo-sources-6.18.33

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 6.6.141
Ebuild name:

sys-kernel/gentoo-sources-6.6.141

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gentoo-sources - 7.0.10
Ebuild name:

sys-kernel/gentoo-sources-7.0.10

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-24

gjs - 1.88.0-r1
Ebuild name:

dev-libs/gjs-1.88.0-r1

Description

Javascript bindings for GNOME

Added to portage

2026-05-24

gnome-remote-desktop - 49.3-r1
Ebuild name:

net-misc/gnome-remote-desktop-49.3-r1

Description

Remote desktop server which allows you to connect to your mac

Added to portage

2026-05-24

gns3-gui - 2.2.59
Ebuild name:

net-misc/gns3-gui-2.2.59

Description

Graphical Network Simulator

Added to portage

2026-05-24

gns3-server - 2.2.59
Ebuild name:

net-misc/gns3-server-2.2.59

Description

GNS3 server to asynchronously manage emulators

Added to portage

2026-05-24

goffice - 0.10.61-r1
Ebuild name:

x11-libs/goffice-0.10.61-r1

Description

A library of document-centric objects and utilities

Added to portage

2026-05-24

google-chrome - 148.0.7778.178
Ebuild name:

www-client/google-chrome-148.0.7778.178

Description

The web browser from Google

Added to portage

2026-05-24

google-chrome-beta - 149.0.7827.22
Ebuild name:

www-client/google-chrome-beta-149.0.7827.22

Description

The web browser from Google

Added to portage

2026-05-24

google-chrome-unstable - 150.0.7846.4
Ebuild name:

www-client/google-chrome-unstable-150.0.7846.4

Description

The web browser from Google

Added to portage

2026-05-24

lambda-term - 3.4.0
Ebuild name:

dev-ml/lambda-term-3.4.0

Description

Terminal manipulation library for OCaml

Added to portage

2026-05-24

libtmux - 0.58.0
Ebuild name:

dev-python/libtmux-0.58.0

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2026-05-24

microsoft-edge - 148.0.3967.83
Ebuild name:

www-client/microsoft-edge-148.0.3967.83

Description

The web browser from Microsoft

Added to portage

2026-05-24

microsoft-edge-beta - 149.0.4022.16
Ebuild name:

www-client/microsoft-edge-beta-149.0.4022.16

Description

The web browser from Microsoft

Added to portage

2026-05-24

microsoft-edge-beta - 149.0.4022.24
Ebuild name:

www-client/microsoft-edge-beta-149.0.4022.24

Description

The web browser from Microsoft

Added to portage

2026-05-24

microsoft-edge-dev - 150.0.4041.0
Ebuild name:

www-client/microsoft-edge-dev-150.0.4041.0

Description

The web browser from Microsoft

Added to portage

2026-05-24

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-05-24

modus-themes - 9999
Ebuild name:

app-emacs/modus-themes-9999

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-05-24

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-05-24

mu-cite - 8.1_p202011031127
Ebuild name:

app-emacs/mu-cite-8.1_p202011031127

Description

Message citation utilities for emacsen

Added to portage

2026-05-24

nim - 2.2.10
Ebuild name:

dev-lang/nim-2.2.10

Description

Compiled, garbage-collected systems programming language

Added to portage

2026-05-24

nvc - 1.21.0
Ebuild name:

sci-electronics/nvc-1.21.0

Description

NVC is a VHDL compiler and simulator

Added to portage

2026-05-24

openrazer - 3.12.3
Ebuild name:

sys-apps/openrazer-3.12.3

Description

Drivers and user-space daemon to control Razer devices on GNU/Linux

Added to portage

2026-05-24

opera - 131.0.5877.97
Ebuild name:

www-client/opera-131.0.5877.97

Description

A fast and secure web browser

Added to portage

2026-05-24

opera-developer - 132.0.5903.0
Ebuild name:

www-client/opera-developer-132.0.5903.0

Description

A fast and secure web browser

Added to portage

2026-05-24

phonenumbers - 9.0.31
Ebuild name:

dev-python/phonenumbers-9.0.31

Description

Python port of Google's libphonenumber

Added to portage

2026-05-24

poetry-core - 2.4.1
Ebuild name:

dev-python/poetry-core-2.4.1

Description

Poetry PEP 517 Build Backend

Added to portage

2026-05-24

pwsh - 7.6.2
Ebuild name:

app-shells/pwsh-7.6.2

Description

Cross-platform automation and configuration tool

Added to portage

2026-05-24

pwsh-bin - 7.6.2
Ebuild name:

app-shells/pwsh-bin-7.6.2

Description

Cross-platform automation and configuration tool (binary package)

Added to portage

2026-05-24

rclone - 1.74.2
Ebuild name:

net-misc/rclone-1.74.2

Description

A program to sync files to and from various cloud storage providers

Added to portage

2026-05-24

rhythmbox - 3.4.9-r2
Ebuild name:

media-sound/rhythmbox-3.4.9-r2

Description

Music management and playback software for GNOME

Added to portage

2026-05-24

sdbus-c++ - 2.3.1
Ebuild name:

dev-cpp/sdbus-c++-2.3.1

Description

High-level C++ D-Bus library

Added to portage

2026-05-24

selint - 1.5.1
Ebuild name:

app-admin/selint-1.5.1

Description

Static code analysis of refpolicy style SELinux policy

Added to portage

2026-05-24

selinux-needrestart - 2.20250618_p1
Ebuild name:

sec-policy/selinux-needrestart-2.20250618_p1

Description

SELinux policy for needrestart

Added to portage

2026-05-24

selinux-needrestart - 2.20260312_p1
Ebuild name:

sec-policy/selinux-needrestart-2.20260312_p1

Description

SELinux policy for needrestart

Added to portage

2026-05-24

selinux-needrestart - 9999
Ebuild name:

sec-policy/selinux-needrestart-9999

Description

SELinux policy for needrestart

Added to portage

2026-05-24

selinux-tpm2 - 2.20250618_p1
Ebuild name:

sec-policy/selinux-tpm2-2.20250618_p1

Description

SELinux policy for tpm2

Added to portage

2026-05-24

selinux-tpm2 - 2.20260312_p1
Ebuild name:

sec-policy/selinux-tpm2-2.20260312_p1

Description

SELinux policy for tpm2

Added to portage

2026-05-24

selinux-tpm2 - 9999
Ebuild name:

sec-policy/selinux-tpm2-9999

Description

SELinux policy for tpm2

Added to portage

2026-05-24

starlette - 1.1.0
Ebuild name:

dev-python/starlette-1.1.0

Description

The little ASGI framework that shines

Added to portage

2026-05-24

tea - 0.14.1
Ebuild name:

dev-util/tea-0.14.1

Description

Command line tool to interact with Gitea server

Added to portage

2026-05-24

testfixtures - 12.0.0
Ebuild name:

dev-python/testfixtures-12.0.0

Description

A collection of helpers and mock objects for unit tests and doc test

Added to portage

2026-05-24

utop - 2.17.0
Ebuild name:

dev-ml/utop-2.17.0

Description

Universal toplevel for OCaml

Added to portage

2026-05-24

vanilla-kernel - 5.10.257
Ebuild name:

sys-kernel/vanilla-kernel-5.10.257

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 5.15.208
Ebuild name:

sys-kernel/vanilla-kernel-5.15.208

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 6.1.174
Ebuild name:

sys-kernel/vanilla-kernel-6.1.174

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 6.12.91
Ebuild name:

sys-kernel/vanilla-kernel-6.12.91

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 6.18.33
Ebuild name:

sys-kernel/vanilla-kernel-6.18.33

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 6.6.141
Ebuild name:

sys-kernel/vanilla-kernel-6.6.141

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-kernel - 7.0.10
Ebuild name:

sys-kernel/vanilla-kernel-7.0.10

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-24

vanilla-sources - 5.10.257
Ebuild name:

sys-kernel/vanilla-sources-5.10.257

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 5.15.208
Ebuild name:

sys-kernel/vanilla-sources-5.15.208

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 6.1.174
Ebuild name:

sys-kernel/vanilla-sources-6.1.174

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 6.12.91
Ebuild name:

sys-kernel/vanilla-sources-6.12.91

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 6.18.33
Ebuild name:

sys-kernel/vanilla-sources-6.18.33

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 6.6.141
Ebuild name:

sys-kernel/vanilla-sources-6.6.141

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vanilla-sources - 7.0.10
Ebuild name:

sys-kernel/vanilla-sources-7.0.10

Description

Full sources for the Linux kernel

Added to portage

2026-05-24

vivaldi - 8.0.4033.26
Ebuild name:

www-client/vivaldi-8.0.4033.26

Description

A browser for our friends

Added to portage

2026-05-24

vivaldi - 8.0.4033.28
Ebuild name:

www-client/vivaldi-8.0.4033.28

Description

A browser for our friends

Added to portage

2026-05-24

xwaylandvideobridge - 0.5.0
Ebuild name:

gui-apps/xwaylandvideobridge-0.5.0

Description

Screenshare Wayland windows to XWayland apps

Added to portage

2026-05-24

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