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:

83961

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-03-24
cdf - 3.9.1
Ebuild name:

sci-libs/cdf-3.9.1

Description

Common Data Format I/O library for multi-dimensional data sets

Added to portage

2026-03-24

freerdp - 3.24.0-r1
Ebuild name:

net-misc/freerdp-3.24.0-r1

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-03-24

freerdp - 3.24.1-r1
Ebuild name:

net-misc/freerdp-3.24.1-r1

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-03-24

jdupes - 1.31.1
Ebuild name:

app-misc/jdupes-1.31.1

Description

Identify duplicate files on the filesystem

Added to portage

2026-03-24

libjodycode - 4.1.2
Ebuild name:

dev-libs/libjodycode-4.1.2

Description

Shared code used by several utilities written by Jody Bruchon

Added to portage

2026-03-24

picard - 3.0.0_alpha4-r1
Ebuild name:

media-sound/picard-3.0.0_alpha4-r1

Description

Cross-platform music tagger

Added to portage

2026-03-24

2026-03-23
arprec - 2.2.20
Ebuild name:

sci-libs/arprec-2.2.20

Description

Arbitrary precision float arithmetics and functions

Added to portage

2026-03-23

astroid - 4.1.2
Ebuild name:

dev-python/astroid-4.1.2

Description

Abstract Syntax Tree for logilab packages

Added to portage

2026-03-23

atuin - 18.13.3
Ebuild name:

app-shells/atuin-18.13.3

Description

Shell history manager supporting encrypted synchronisation

Added to portage

2026-03-23

bpftool - 7.7.0
Ebuild name:

dev-util/bpftool-7.7.0

Description

Tool for inspection and simple manipulation of eBPF programs and maps

Added to portage

2026-03-23

cbor2 - 5.9.0
Ebuild name:

dev-python/cbor2-5.9.0

Description

Pure Python CBOR (de)serializer with extensive tag support

Added to portage

2026-03-23

cinnamon - 6.6.7-r1
Ebuild name:

gnome-extra/cinnamon-6.6.7-r1

Description

A fork of GNOME Shell with layout similar to GNOME 2

Added to portage

2026-03-23

containerd - 2.0.7
Ebuild name:

app-containers/containerd-2.0.7

Description

A daemon to control runC

Added to portage

2026-03-23

containerd - 2.1.5
Ebuild name:

app-containers/containerd-2.1.5

Description

A daemon to control runC

Added to portage

2026-03-23

cpptrace - 1.0.4-r1
Ebuild name:

dev-cpp/cpptrace-1.0.4-r1

Description

Simple, portable, and self-contained stacktrace library for C++11 and new

Added to portage

2026-03-23

dkms - 3.4.0
Ebuild name:

sys-kernel/dkms-3.4.0

Description

Dynamic Kernel Module Support

Added to portage

2026-03-23

dtrace - 2.0.6
Ebuild name:

dev-debug/dtrace-2.0.6

Description

Dynamic BPF-based system-wide tracing tool

Added to portage

2026-03-23

firefox-bin - 149.0
Ebuild name:

www-client/firefox-bin-149.0

Description

Firefox Web Browser

Added to portage

2026-03-23

freetype - 2.14.3
Ebuild name:

media-libs/freetype-2.14.3

Description

High-quality and portable font engine

Added to portage

2026-03-23

frp - 0.68.0
Ebuild name:

net-vpn/frp-0.68.0

Description

A reverse proxy that exposes a server behind a NAT or firewall to the internet

Added to portage

2026-03-23

gcc - 16.0.1_p20260322
Ebuild name:

sys-devel/gcc-16.0.1_p20260322

Description

The GNU Compiler Collection

Added to portage

2026-03-23

git-sources - 7.0_rc5
Ebuild name:

sys-kernel/git-sources-7.0_rc5

Description

The very latest -git version of the Linux kernel

Added to portage

2026-03-23

intune-portal - 1.2603.21
Ebuild name:

sys-apps/intune-portal-1.2603.21

Description

Microsoft Intune Company Portal to access a corporate environment

Added to portage

2026-03-23

kubo - 0.40.1
Ebuild name:

net-p2p/kubo-0.40.1

Description

Main implementation of IPFS

Added to portage

2026-03-23

libbpf - 1.7.0-r1
Ebuild name:

dev-libs/libbpf-1.7.0-r1

Description

Stand-alone build of libbpf from the Linux kernel

Added to portage

2026-03-23

libnvidia-container - 1.19.0
Ebuild name:

sys-libs/libnvidia-container-1.19.0

Description

NVIDIA container runtime library

Added to portage

2026-03-23

libtsm - 4.4.3
Ebuild name:

dev-libs/libtsm-4.4.3

Description

Terminal Emulator State Machine

Added to portage

2026-03-23

microsoft-identity-broker - 2.5.2
Ebuild name:

sys-auth/microsoft-identity-broker-2.5.2

Description

Microsoft Authentication Broker to access a corporate envi

Added to portage

2026-03-23

modus-themes - 5.1.0
Ebuild name:

app-emacs/modus-themes-5.1.0

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-03-23

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

modus-themes - 9999
Ebuild name:

app-emacs/modus-themes-9999

Description

Highly accessible themes for GNU Emacs

Added to portage

2026-03-23

nvidia-container-toolkit - 1.19.0
Ebuild name:

app-containers/nvidia-container-toolkit-1.19.0

Description

NVIDIA container runtime toolkit

Added to portage

2026-03-23

openpgp-keys-libuv - 20260323
Ebuild name:

sec-keys/openpgp-keys-libuv-20260323

Description

OpenPGP keys used by libuv

Added to portage

2026-03-23

pv - 1.10.4
Ebuild name:

sys-apps/pv-1.10.4

Description

Pipe Viewer a tool for monitoring the progress of data through a pipe

Added to portage

2026-03-23

pygithub - 2.9.0
Ebuild name:

dev-python/pygithub-2.9.0

Description

Python library to access the Github API v3

Added to portage

2026-03-23

pyrate-limiter - 4.1.0
Ebuild name:

dev-python/pyrate-limiter-4.1.0

Description

Python Rate-Limiter using Leaky-Bucket Algorimth Family

Added to portage

2026-03-23

pytest-check - 2.8.0
Ebuild name:

dev-python/pytest-check-2.8.0

Description

pytest plugin that allows multiple failures per test

Added to portage

2026-03-23

qt-docs - 6.11.0_p202603180534
Ebuild name:

dev-qt/qt-docs-6.11.0_p202603180534

Description

Qt6 documentation and examples for Qt Creator and other tools

Added to portage

2026-03-23

qt3d - 6.11.0
Ebuild name:

dev-qt/qt3d-6.11.0

Description

3D rendering module for the Qt6 framework

Added to portage

2026-03-23

qt5compat - 6.11.0
Ebuild name:

dev-qt/qt5compat-6.11.0

Description

Qt module containing the unsupported Qt 5 APIs

Added to portage

2026-03-23

qtbase - 6.11.0
Ebuild name:

dev-qt/qtbase-6.11.0

Description

Cross-platform application development framework

Added to portage

2026-03-23

qtcharts - 6.11.0
Ebuild name:

dev-qt/qtcharts-6.11.0

Description

Chart component library for the Qt6 framework

Added to portage

2026-03-23

qtconnectivity - 6.11.0
Ebuild name:

dev-qt/qtconnectivity-6.11.0

Description

Bluetooth and NFC support library for the Qt6 framework

Added to portage

2026-03-23

qtdeclarative - 6.11.0
Ebuild name:

dev-qt/qtdeclarative-6.11.0

Description

Qt Declarative (Quick 2)

Added to portage

2026-03-23

qtgraphs - 6.11.0
Ebuild name:

dev-qt/qtgraphs-6.11.0

Description

Graphs component library for the Qt6 framework

Added to portage

2026-03-23

qthttpserver - 6.11.0
Ebuild name:

dev-qt/qthttpserver-6.11.0

Description

HTTP server functionality for the Qt6 framework

Added to portage

2026-03-23

qtimageformats - 6.11.0
Ebuild name:

dev-qt/qtimageformats-6.11.0

Description

Additional format plugins for the Qt image I/O system

Added to portage

2026-03-23

qtlanguageserver - 6.11.0
Ebuild name:

dev-qt/qtlanguageserver-6.11.0

Description

Implementation of the Language Server Protocol for Qt

Added to portage

2026-03-23

qtlocation - 6.11.0
Ebuild name:

dev-qt/qtlocation-6.11.0

Description

Location (places, maps, navigation) library for the Qt6 framework

Added to portage

2026-03-23

qtmultimedia - 6.11.0
Ebuild name:

dev-qt/qtmultimedia-6.11.0

Description

Multimedia (audio, video, radio, camera) library for the Qt6 framework

Added to portage

2026-03-23

qtnetworkauth - 6.11.0
Ebuild name:

dev-qt/qtnetworkauth-6.11.0

Description

Network authorization library for the Qt6 framework

Added to portage

2026-03-23

qtpositioning - 6.11.0
Ebuild name:

dev-qt/qtpositioning-6.11.0

Description

Physical position determination library for the Qt6 framework

Added to portage

2026-03-23

qtquick3d - 6.11.0
Ebuild name:

dev-qt/qtquick3d-6.11.0

Description

Qt module and API for defining 3D content in Qt QuickTools

Added to portage

2026-03-23

qtquicktimeline - 6.11.0
Ebuild name:

dev-qt/qtquicktimeline-6.11.0

Description

Qt module for keyframe-based timeline construction

Added to portage

2026-03-23

qtremoteobjects - 6.11.0
Ebuild name:

dev-qt/qtremoteobjects-6.11.0

Description

Inter-Process Communication (IPC) library for the Qt6 framework

Added to portage

2026-03-23

qtscxml - 6.11.0
Ebuild name:

dev-qt/qtscxml-6.11.0

Description

State Chart XML (SCXML) support library for the Qt6 framework

Added to portage

2026-03-23

qtsensors - 6.11.0
Ebuild name:

dev-qt/qtsensors-6.11.0

Description

Hardware sensor access library for the Qt6 framework

Added to portage

2026-03-23

qtserialbus - 6.11.0
Ebuild name:

dev-qt/qtserialbus-6.11.0

Description

Qt module to access CAN, ModBus, and other industrial serial buses and pr

Added to portage

2026-03-23

qtserialport - 6.11.0
Ebuild name:

dev-qt/qtserialport-6.11.0

Description

Serial port abstraction library for the Qt6 framework

Added to portage

2026-03-23

qtshadertools - 6.11.0
Ebuild name:

dev-qt/qtshadertools-6.11.0

Description

Qt APIs and Tools for Graphics Pipelines

Added to portage

2026-03-23

qtspeech - 6.11.0
Ebuild name:

dev-qt/qtspeech-6.11.0

Description

Text-to-speech library for the Qt6 framework

Added to portage

2026-03-23

qtsvg - 6.11.0
Ebuild name:

dev-qt/qtsvg-6.11.0

Description

SVG rendering library for the Qt6 framework

Added to portage

2026-03-23

qttools - 6.11.0
Ebuild name:

dev-qt/qttools-6.11.0

Description

Qt Tools Collection

Added to portage

2026-03-23

qttranslations - 6.11.0
Ebuild name:

dev-qt/qttranslations-6.11.0

Description

Translation files for the Qt6 framework

Added to portage

2026-03-23

qtvirtualkeyboard - 6.11.0
Ebuild name:

dev-qt/qtvirtualkeyboard-6.11.0

Description

Customizable input framework and virtual keyboard for Qt

Added to portage

2026-03-23

qtwayland - 6.11.0
Ebuild name:

dev-qt/qtwayland-6.11.0

Description

Toolbox for making Qt based Wayland compositors

Added to portage

2026-03-23

qtwebchannel - 6.11.0
Ebuild name:

dev-qt/qtwebchannel-6.11.0

Description

Qt WebChannel

Added to portage

2026-03-23

qtwebengine - 6.11.0
Ebuild name:

dev-qt/qtwebengine-6.11.0

Description

Library for rendering dynamic web content in Qt6 C++ and QML applications

Added to portage

2026-03-23

qtwebsockets - 6.11.0
Ebuild name:

dev-qt/qtwebsockets-6.11.0

Description

Implementation of the WebSocket protocol for the Qt6 framework

Added to portage

2026-03-23

qtwebview - 6.11.0
Ebuild name:

dev-qt/qtwebview-6.11.0

Description

Module for displaying web content in a QML application using the Qt6 framew

Added to portage

2026-03-23

runit - 2.3.1
Ebuild name:

sys-process/runit-2.3.1

Description

A UNIX init scheme with service supervision

Added to portage

2026-03-23

seafile - 9.0.16
Ebuild name:

net-misc/seafile-9.0.16

Description

File syncing and sharing software with file encryption and group sharing

Added to portage

2026-03-23

seafile-client - 9.0.16
Ebuild name:

net-misc/seafile-client-9.0.16

Description

Seafile desktop client

Added to portage

2026-03-23

starlette - 1.0.0
Ebuild name:

dev-python/starlette-1.0.0

Description

The little ASGI framework that shines

Added to portage

2026-03-23

types-docutils - 0.22.3.20260322
Ebuild name:

dev-python/types-docutils-0.22.3.20260322

Description

Typing stubs for docutils

Added to portage

2026-03-23

whenever - 0.10.0_beta2
Ebuild name:

dev-python/whenever-0.10.0_beta2

Description

Modern datetime library for Python

Added to portage

2026-03-23

xvfbwrapper - 0.2.23
Ebuild name:

dev-python/xvfbwrapper-0.2.23

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2026-03-23

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