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:

82919

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-01-23
akonadi - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-25.12.1-r1

Description

Storage service for PIM data and libraries for PIM apps

Added to portage

2026-01-23

akonadi-calendar - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-calendar-25.12.1-r1

Description

Library for akonadi calendar integration

Added to portage

2026-01-23

akonadi-calendar-tools-common - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-calendar-tools-common-25.12.1-r1

Description

Added to portage

2026-01-23

akonadi-contacts - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-contacts-25.12.1-r1

Description

Library for akonadi contact integration

Added to portage

2026-01-23

akonadi-import-wizard - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-import-wizard-25.12.1-r1

Description

Assistant to import PIM data from other applications into

Added to portage

2026-01-23

akonadi-mime - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-mime-25.12.1-r1

Description

Library for akonadi mime types

Added to portage

2026-01-23

akonadi-search - 25.12.1-r1
Ebuild name:

kde-apps/akonadi-search-25.12.1-r1

Description

Libraries and daemons to implement searching in Akonadi

Added to portage

2026-01-23

akonadiconsole - 25.12.1-r1
Ebuild name:

kde-apps/akonadiconsole-25.12.1-r1

Description

Application for debugging Akonadi Resources

Added to portage

2026-01-23

akregator - 25.12.1-r1
Ebuild name:

kde-apps/akregator-25.12.1-r1

Description

News feed aggregator

Added to portage

2026-01-23

bazelisk - 1.28.1
Ebuild name:

dev-build/bazelisk-1.28.1

Description

A user-friendly launcher for Bazel written in Go

Added to portage

2026-01-23

blueprint-compiler - 0.19.0
Ebuild name:

dev-util/blueprint-compiler-0.19.0

Description

Compiler for Blueprint, a markup language for GTK user interface

Added to portage

2026-01-23

calendarjanitor - 25.12.1-r1
Ebuild name:

kde-apps/calendarjanitor-25.12.1-r1

Description

Tool to scan calendar data for buggy instances

Added to portage

2026-01-23

calendarsupport - 25.12.1-r1
Ebuild name:

kde-apps/calendarsupport-25.12.1-r1

Description

Calendar support library

Added to portage

2026-01-23

closure-compiler-bin - 20260120
Ebuild name:

dev-lang/closure-compiler-bin-20260120

Description

JavaScript optimizing compiler

Added to portage

2026-01-23

devcontainer - 0.81.1
Ebuild name:

app-containers/devcontainer-0.81.1

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-01-23

ensurepip-setuptools - 80.10.1
Ebuild name:

dev-python/ensurepip-setuptools-80.10.1

Description

Shared setuptools wheel for ensurepip Python module

Added to portage

2026-01-23

eventviews - 25.12.1-r1
Ebuild name:

kde-apps/eventviews-25.12.1-r1

Description

Calendar viewer for KDE PIM

Added to portage

2026-01-23

fastfetch - 2.58.0
Ebuild name:

app-misc/fastfetch-2.58.0

Description

Fast neofetch-like system information tool

Added to portage

2026-01-23

git-cliff - 2.11.0
Ebuild name:

dev-vcs/git-cliff-2.11.0

Description

A highly customizable changelog generator

Added to portage

2026-01-23

grantlee-editor - 25.12.1-r1
Ebuild name:

kde-apps/grantlee-editor-25.12.1-r1

Description

Utilities and tools to manage themes in KDE PIM applications

Added to portage

2026-01-23

grantleetheme - 25.12.1-r1
Ebuild name:

kde-apps/grantleetheme-25.12.1-r1

Description

Library for Grantlee plugins

Added to portage

2026-01-23

incidenceeditor - 25.12.1-r1
Ebuild name:

kde-apps/incidenceeditor-25.12.1-r1

Description

Incidence editor for KOrganizer

Added to portage

2026-01-23

joplin-desktop - 3.5.12
Ebuild name:

app-office/joplin-desktop-3.5.12

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2026-01-23

kaddressbook - 25.12.1-r1
Ebuild name:

kde-apps/kaddressbook-25.12.1-r1

Description

Address book application based on KDE Frameworks

Added to portage

2026-01-23

kalarm - 25.12.1-r1
Ebuild name:

kde-apps/kalarm-25.12.1-r1

Description

Application to manage alarms and other timer based alerts for the deskto

Added to portage

2026-01-23

kate - 25.12.1-r1
Ebuild name:

kde-apps/kate-25.12.1-r1

Description

Multi-document editor with network transparency, Plasma integration and mo

Added to portage

2026-01-23

kate-addons - 25.12.1-r1
Ebuild name:

kde-apps/kate-addons-25.12.1-r1

Description

Addons used by Kate

Added to portage

2026-01-23

kate-lib - 25.12.1-r1
Ebuild name:

kde-apps/kate-lib-25.12.1-r1

Description

Shared library used by Kate/Kwrite and Kate-Addons

Added to portage

2026-01-23

kcalutils - 25.12.1-r1
Ebuild name:

kde-apps/kcalutils-25.12.1-r1

Description

Library providing utility functions for the handling of calendar data

Added to portage

2026-01-23

kdepim-addons - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-addons-25.12.1-r1

Description

Plugins for KDE Personal Information Management Suite

Added to portage

2026-01-23

kdepim-meta - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-meta-25.12.1-r1

Description

KDE PIM - merge this to pull in all kdepim-derived packages

Added to portage

2026-01-23

kdepim-runtime - 25.12.1-r1
Ebuild name:

kde-apps/kdepim-runtime-25.12.1-r1

Description

Runtime plugin collection to extend the functionality of KDE PIM

Added to portage

2026-01-23

kdf - 25.12.1-r1
Ebuild name:

kde-apps/kdf-25.12.1-r1

Description

KDE free disk space utility

Added to portage

2026-01-23

keditbookmarks - 25.12.1-r1
Ebuild name:

kde-apps/keditbookmarks-25.12.1-r1

Description

Bookmarks editor based on KDE Frameworks

Added to portage

2026-01-23

kopeninghours - 25.12.1-r1
Ebuild name:

dev-libs/kopeninghours-25.12.1-r1

Description

Library for parsing and evaluating OSM opening hours expressions

Added to portage

2026-01-23

kosmindoormap - 25.12.1-r1
Ebuild name:

dev-libs/kosmindoormap-25.12.1-r1

Description

Data Model and Extraction System for Travel Reservation informati

Added to portage

2026-01-23

kpublictransport - 25.12.1-r1
Ebuild name:

dev-libs/kpublictransport-25.12.1-r1

Description

Library for accessing public transport timetables and other in

Added to portage

2026-01-23

libtsm - 4.4.1
Ebuild name:

dev-libs/libtsm-4.4.1

Description

Terminal Emulator State Machine

Added to portage

2026-01-23

merkuro - 25.12.1-r1
Ebuild name:

app-office/merkuro-25.12.1-r1

Description

Calendar application using Akonadi

Added to portage

2026-01-23

open-vmdk - 0.3.13
Ebuild name:

app-emulation/open-vmdk-0.3.13

Description

Tools for creating and converting OVA virtual appliance files

Added to portage

2026-01-23

osm - 9999
Ebuild name:

app-emacs/osm-9999

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2026-01-23

outline-magic - 0.9
Ebuild name:

app-emacs/outline-magic-0.9

Description

Outline mode extensions for Emacs

Added to portage

2026-01-23

package-build - 4.0.0
Ebuild name:

app-emacs/package-build-4.0.0

Description

Tools for assembling a package archive

Added to portage

2026-01-23

package-lint - 0.26
Ebuild name:

app-emacs/package-lint-0.26

Description

Linting library for Emacs Lisp package metadata

Added to portage

2026-01-23

reason - 3.17.3
Ebuild name:

dev-ml/reason-3.17.3

Description

Simple, fast & type safe language that leverages JavaScript and OCaml

Added to portage

2026-01-23

rpi-eeprom - 28.12_p1
Ebuild name:

dev-embedded/rpi-eeprom-28.12_p1

Description

Updater for Raspberry Pi 4/5 bootloader and the VL805 USB controll

Added to portage

2026-01-23

setuptools - 80.10.1
Ebuild name:

dev-python/setuptools-80.10.1

Description

Collection of extensions to Distutils

Added to portage

2026-01-23

tempel - 1.10
Ebuild name:

app-emacs/tempel-1.10

Description

Templates with in-buffer field editing for GNU Emacs

Added to portage

2026-01-23

vertico - 2.7
Ebuild name:

app-emacs/vertico-2.7

Description

Vertical interactive completion

Added to portage

2026-01-23

xxhash - 0.8.3-r2
Ebuild name:

dev-libs/xxhash-0.8.3-r2

Description

Extremely fast non-cryptographic hash algorithm

Added to portage

2026-01-23

2026-01-22
awscli - 1.44.22
Ebuild name:

app-admin/awscli-1.44.22

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-22

boto3 - 1.42.32
Ebuild name:

dev-python/boto3-1.42.32

Description

The AWS SDK for Python

Added to portage

2026-01-22

botocore - 1.42.32
Ebuild name:

dev-python/botocore-1.42.32

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-22

cargo-nextest - 0.9.122
Ebuild name:

dev-util/cargo-nextest-0.9.122

Description

Next-generation test runner for Rust

Added to portage

2026-01-22

cargo-tarpaulin - 0.35.1
Ebuild name:

dev-util/cargo-tarpaulin-0.35.1

Description

Cargo-Tarpaulin is a tool to determine code coverage achieved via t

Added to portage

2026-01-22

cfn-lint - 1.43.4
Ebuild name:

dev-python/cfn-lint-1.43.4

Description

CloudFormation Linter

Added to portage

2026-01-22

cmocka - 2.0.2
Ebuild name:

dev-util/cmocka-2.0.2

Description

Unit testing framework for C

Added to portage

2026-01-22

dbeaver-bin - 25.3.3
Ebuild name:

dev-db/dbeaver-bin-25.3.3

Description

Free universal database tool (community edition)

Added to portage

2026-01-22

eggdrop - 1.10.1
Ebuild name:

net-irc/eggdrop-1.10.1

Description

An IRC bot extensible with C or TCL

Added to portage

2026-01-22

ensurepip-wheel - 0.46.2
Ebuild name:

dev-python/ensurepip-wheel-0.46.2

Description

Shared wheel wheel for use in pip tests

Added to portage

2026-01-22

gentoolkit - 0.7
Ebuild name:

app-portage/gentoolkit-0.7

Description

Collection of administration scripts for Gentoo

Added to portage

2026-01-22

gherkin-official - 38.0.0
Ebuild name:

dev-python/gherkin-official-38.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-01-22

krita - 6.0.0_alpha_pre20260121
Ebuild name:

media-gfx/krita-6.0.0_alpha_pre20260121

Description

Free digital painting application. Digital Painting, Creati

Added to portage

2026-01-22

marknote - 1.4.0
Ebuild name:

app-text/marknote-1.4.0

Description

Markdown editor with a wide range of formating options for everyday notes

Added to portage

2026-01-22

mongodb-compass-bin - 1.49.0
Ebuild name:

dev-db/mongodb-compass-bin-1.49.0

Description

GUI for MongoDB

Added to portage

2026-01-22

oath-toolkit - 2.6.13
Ebuild name:

sys-auth/oath-toolkit-2.6.13

Description

Toolkit for using one-time password authentication with HOTP/TOTP algo

Added to portage

2026-01-22

openpgp-keys-libseccomp - 20260122
Ebuild name:

sec-keys/openpgp-keys-libseccomp-20260122

Description

OpenPGP key used for sys-libs/libseccomp

Added to portage

2026-01-22

openpgp-keys-oath-toolkit - 20260122
Ebuild name:

sec-keys/openpgp-keys-oath-toolkit-20260122

Description

OpenPGP keys used for sys-auth/oath-toolkit

Added to portage

2026-01-22

packaging - 26.0
Ebuild name:

dev-python/packaging-26.0

Description

Core utilities for Python packages

Added to portage

2026-01-22

pandoc-mode - 2.35
Ebuild name:

app-emacs/pandoc-mode-2.35

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2026-01-22

pandoc-mode - 2.90.2
Ebuild name:

app-emacs/pandoc-mode-2.90.2

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2026-01-22

pass-otp - 1.2.0-r3
Ebuild name:

app-admin/pass-otp-1.2.0-r3

Description

A pass extension for managing one-time-password (OTP) tokens

Added to portage

2026-01-22

pcl - 1.14.1-r3
Ebuild name:

sci-libs/pcl-1.14.1-r3

Description

2D/3D image and point cloud processing

Added to portage

2026-01-22

pycparser - 3.0
Ebuild name:

dev-python/pycparser-3.0

Description

C parser and AST generator written in Python

Added to portage

2026-01-22

skrooge - 26.1.20
Ebuild name:

app-office/skrooge-26.1.20

Description

Personal finances manager, aiming at being simple and intuitive

Added to portage

2026-01-22

sqlalchemy - 2.0.46
Ebuild name:

dev-python/sqlalchemy-2.0.46

Description

Python SQL toolkit and Object Relational Mapper

Added to portage

2026-01-22

upterm - 0.22.0
Ebuild name:

app-misc/upterm-0.22.0

Description

Instant Terminal Sharing

Added to portage

2026-01-22

wheel - 0.46.2
Ebuild name:

dev-python/wheel-0.46.2

Description

A built-package format for Python

Added to portage

2026-01-22

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