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:

87147

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-24
android-studio - 2026.1.2.11
Ebuild name:

dev-util/android-studio-2026.1.2.11

Description

Android development environment based on IntelliJ IDEA

Added to portage

2026-07-24

dump1090 - 11.1
Ebuild name:

net-wireless/dump1090-11.1

Description

Simple Mode S decoder for RTLSDR devices

Added to portage

2026-07-24

geekbench - 7.0.0
Ebuild name:

app-benchmarks/geekbench-7.0.0

Description

A Cross-Platform Benchmark for Android, iOS, Linux, MacOS and Window

Added to portage

2026-07-24

kirigami-app-components - 1.0.1-r1
Ebuild name:

dev-libs/kirigami-app-components-1.0.1-r1

Description

Kirigami addons and modules necessary to do a full featur

Added to portage

2026-07-24

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

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

rust - 1.97.1
Ebuild name:

dev-lang/rust-1.97.1

Description

Systems programming language originally developed by Mozilla

Added to portage

2026-07-24

rust-bin - 1.97.1
Ebuild name:

dev-lang/rust-bin-1.97.1

Description

Added to portage

2026-07-24

rust-common - 1.97.1
Ebuild name:

dev-lang/rust-common-1.97.1

Description

Common files shared between multiple slots of Rust

Added to portage

2026-07-24

rust-std - 1.97.1
Ebuild name:

sys-devel/rust-std-1.97.1

Description

Rust standard library, standalone (for crossdev)

Added to portage

2026-07-24

snakeoil - 0.11.2
Ebuild name:

dev-python/snakeoil-0.11.2

Description

misc common functionality and useful optimizations

Added to portage

2026-07-24

stalwart-cli - 1.0.11
Ebuild name:

net-mail/stalwart-cli-1.0.11

Description

Stalwart Mail Server command line utility

Added to portage

2026-07-24

stalwart-mail - 0.16.14
Ebuild name:

net-mail/stalwart-mail-0.16.14

Description

Stalwart Mail Server

Added to portage

2026-07-24

2026-07-23
7zip - 26.02-r1
Ebuild name:

app-arch/7zip-26.02-r1

Description

Free file archiver for extremely high compression

Added to portage

2026-07-23

aiohttp - 3.14.3
Ebuild name:

dev-python/aiohttp-3.14.3

Description

HTTP client/server for asyncio

Added to portage

2026-07-23

aws-c-http - 0.11.0-r1
Ebuild name:

dev-libs/aws-c-http-0.11.0-r1

Description

AWS C Http C99 implementation of the HTTP/1.1 and HTTP/2 specificatio

Added to portage

2026-07-23

aws-checksums - 0.2.10-r1
Ebuild name:

dev-libs/aws-checksums-0.2.10-r1

Description

Cross-Platform HW accelerated CRC32c and CRC32 with fallback to SW

Added to portage

2026-07-23

aws-crt-cpp - 0.37.4-r1
Ebuild name:

dev-cpp/aws-crt-cpp-0.37.4-r1

Description

C++ wrapper around the aws-c-* libraries

Added to portage

2026-07-23

awscli - 1.45.54
Ebuild name:

app-admin/awscli-1.45.54

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-23

bind - 9.20.26
Ebuild name:

net-dns/bind-9.20.26

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2026-07-23

boto3 - 1.43.54
Ebuild name:

dev-python/boto3-1.43.54

Description

The AWS SDK for Python

Added to portage

2026-07-23

botocore - 1.43.54
Ebuild name:

dev-python/botocore-1.43.54

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-23

btrbk - 0.32.7
Ebuild name:

app-backup/btrbk-0.32.7

Description

Tool for creating snapshots and remote backups of btrfs subvolumes

Added to portage

2026-07-23

cachetools - 7.1.5
Ebuild name:

dev-python/cachetools-7.1.5

Description

Extensible memoizing collections and decorators

Added to portage

2026-07-23

cargo-nextest - 0.9.140
Ebuild name:

dev-util/cargo-nextest-0.9.140

Description

Next-generation test runner for Rust

Added to portage

2026-07-23

chrome-binary-plugins - 150.0.7871.181
Ebuild name:

www-plugins/chrome-binary-plugins-150.0.7871.181

Description

Binary plugins from Google Chrome for use in Chrom

Added to portage

2026-07-23

chrome-binary-plugins - 151.0.7922.47_beta
Ebuild name:

www-plugins/chrome-binary-plugins-151.0.7922.47_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-07-23

chromedriver-bin - 150.0.7871.181
Ebuild name:

www-apps/chromedriver-bin-150.0.7871.181

Description

WebDriver for Chrome

Added to portage

2026-07-23

chromium - 150.0.7871.181
Ebuild name:

www-client/chromium-150.0.7871.181

Description

Open-source version of Google Chrome web browser

Added to portage

2026-07-23

colorlog - 6.12.0
Ebuild name:

dev-python/colorlog-6.12.0

Description

Log formatting with colors

Added to portage

2026-07-23

courier-imap - 6.0.4
Ebuild name:

net-mail/courier-imap-6.0.4

Description

An IMAP daemon designed specifically for maildirs

Added to portage

2026-07-23

cucumber-tag-expressions - 11.0.0
Ebuild name:

dev-python/cucumber-tag-expressions-11.0.0

Description

Cucumber tag expression parser

Added to portage

2026-07-23

dokuwiki - 20260714a
Ebuild name:

www-apps/dokuwiki-20260714a

Description

DokuWiki is a simple to use Wiki aimed at a small company's documentati

Added to portage

2026-07-23

dropbear - 2026.94
Ebuild name:

net-misc/dropbear-2026.94

Description

Small SSH 2 client/server designed for small memory environments

Added to portage

2026-07-23

faker - 40.35.0
Ebuild name:

dev-python/faker-40.35.0

Description

A Python package that generates fake data for you

Added to portage

2026-07-23

fakeredis - 2.37.0
Ebuild name:

dev-python/fakeredis-2.37.0

Description

Fake implementation of redis API for testing purposes

Added to portage

2026-07-23

git-delete-merged-branches - 7.6.1
Ebuild name:

dev-vcs/git-delete-merged-branches-7.6.1

Description

Command-line tool to delete merged Git branches

Added to portage

2026-07-23

gitpython - 3.1.54
Ebuild name:

dev-python/gitpython-3.1.54

Description

Library used to interact with Git repositories

Added to portage

2026-07-23

gitpython - 3.1.55
Ebuild name:

dev-python/gitpython-3.1.55

Description

Library used to interact with Git repositories

Added to portage

2026-07-23

go - 1.25.12
Ebuild name:

dev-lang/go-1.25.12

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2026-07-23

go - 1.26.5
Ebuild name:

dev-lang/go-1.26.5

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2026-07-23

google-api-core - 2.33.0
Ebuild name:

dev-python/google-api-core-2.33.0

Description

Core Library for Google Client Libraries

Added to portage

2026-07-23

google-chrome - 150.0.7871.181
Ebuild name:

www-client/google-chrome-150.0.7871.181

Description

The web browser from Google

Added to portage

2026-07-23

google-chrome-beta - 151.0.7922.47
Ebuild name:

www-client/google-chrome-beta-151.0.7922.47

Description

The web browser from Google

Added to portage

2026-07-23

greenlet - 3.5.4
Ebuild name:

dev-python/greenlet-3.5.4

Description

Lightweight in-process concurrent programming

Added to portage

2026-07-23

httpx2 - 2.8.0
Ebuild name:

dev-python/httpx2-2.8.0

Description

The next generation HTTP client (Pydantic fork)

Added to portage

2026-07-23

hypothesis - 6.160.0
Ebuild name:

dev-python/hypothesis-6.160.0

Description

A library for property based testing

Added to portage

2026-07-23

hypothesis - 6.161.0
Ebuild name:

dev-python/hypothesis-6.161.0

Description

A library for property based testing

Added to portage

2026-07-23

knot-resolver - 5.7.7
Ebuild name:

net-dns/knot-resolver-5.7.7

Description

A scaleable caching DNS resolver

Added to portage

2026-07-23

knot-resolver - 6.4.1
Ebuild name:

net-dns/knot-resolver-6.4.1

Description

Scaleable caching DNS resolver

Added to portage

2026-07-23

maildrop - 4.0.3
Ebuild name:

mail-filter/maildrop-4.0.3

Description

Mail delivery agent/filter

Added to portage

2026-07-23

microsoft-edge-beta - 151.0.4129.35
Ebuild name:

www-client/microsoft-edge-beta-151.0.4129.35

Description

The web browser from Microsoft

Added to portage

2026-07-23

microsoft-edge-dev - 152.0.4167.0
Ebuild name:

www-client/microsoft-edge-dev-152.0.4167.0

Description

The web browser from Microsoft

Added to portage

2026-07-23

mistune - 3.3.4
Ebuild name:

dev-python/mistune-3.3.4

Description

The fastest markdown parser in pure Python

Added to portage

2026-07-23

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

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

mocker - 0.5.0
Ebuild name:

app-emacs/mocker-0.5.0

Description

Simple mocking framework for Emacs

Added to portage

2026-07-23

netpbm - 11.15.4
Ebuild name:

media-libs/netpbm-11.15.4

Description

A set of utilities for converting to/from the netpbm (and related) format

Added to portage

2026-07-23

notebook - 7.6.1
Ebuild name:

dev-python/notebook-7.6.1

Description

Jupyter Interactive Notebook

Added to portage

2026-07-23

obs-pipewire-audio-capture - 1.2.1-r1
Ebuild name:

media-plugins/obs-pipewire-audio-capture-1.2.1-r1

Description

Audio device and application capture for OBS Stud

Added to portage

2026-07-23

obs-studio - 32.2.0
Ebuild name:

media-video/obs-studio-32.2.0

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-07-23

ollama - 0.32.2
Ebuild name:

sci-ml/ollama-0.32.2

Description

Get up and running with Llama 3, Mistral, Gemma, and other language models

Added to portage

2026-07-23

opera-developer - 135.0.5966.0
Ebuild name:

www-client/opera-developer-135.0.5966.0

Description

A fast and secure web browser

Added to portage

2026-07-23

overlint - 0.5.4
Ebuild name:

app-portage/overlint-0.5.4

Description

Simple tool for static analysis of overlays

Added to portage

2026-07-23

pandas - 3.0.5
Ebuild name:

dev-python/pandas-3.0.5

Description

Powerful data structures for data analysis and statistics

Added to portage

2026-07-23

pdns-recursor - 5.3.9
Ebuild name:

net-dns/pdns-recursor-5.3.9

Description

The PowerDNS Recursor

Added to portage

2026-07-23

pdns-recursor - 5.4.4
Ebuild name:

net-dns/pdns-recursor-5.4.4

Description

The PowerDNS Recursor

Added to portage

2026-07-23

pika - 1.4.2
Ebuild name:

dev-python/pika-1.4.2

Description

Pure-Python implementation of the AMQP

Added to portage

2026-07-23

plumbum - 2.0.2
Ebuild name:

dev-python/plumbum-2.0.2

Description

A library for shell script-like programs in python

Added to portage

2026-07-23

proto-plus - 1.28.2
Ebuild name:

dev-python/proto-plus-1.28.2

Description

Beautiful, Pythonic protocol buffers

Added to portage

2026-07-23

rarfile - 4.4
Ebuild name:

dev-python/rarfile-4.4

Description

Module for RAR archive reading

Added to portage

2026-07-23

rnv - 1.7.11-r4
Ebuild name:

app-text/rnv-1.7.11-r4

Description

A lightweight Relax NG Compact Syntax validator

Added to portage

2026-07-23

rssguard - 5.2.3
Ebuild name:

net-news/rssguard-5.2.3

Description

Simple (yet powerful) news feed reader

Added to portage

2026-07-23

s3transfer - 0.19.2
Ebuild name:

dev-python/s3transfer-0.19.2

Description

An Amazon S3 Transfer Manager

Added to portage

2026-07-23

stripe-mock - 0.202.0
Ebuild name:

dev-util/stripe-mock-0.202.0

Description

Mock HTTP server that responds like the real Stripe API

Added to portage

2026-07-23

swaylock - 1.8.6
Ebuild name:

gui-apps/swaylock-1.8.6

Description

Screen locker for Wayland

Added to portage

2026-07-23

thunderbird - 140.13.0
Ebuild name:

mail-client/thunderbird-140.13.0

Description

Thunderbird Mail Client

Added to portage

2026-07-23

thunderbird - 153.0
Ebuild name:

mail-client/thunderbird-153.0

Description

Thunderbird Mail Client

Added to portage

2026-07-23

thunderbird-bin - 140.13.0
Ebuild name:

mail-client/thunderbird-bin-140.13.0

Description

Thunderbird Mail Client

Added to portage

2026-07-23

thunderbird-bin - 153.0
Ebuild name:

mail-client/thunderbird-bin-153.0

Description

Thunderbird Mail Client

Added to portage

2026-07-23

thunderbird-l10n - 153.0
Ebuild name:

mail-client/thunderbird-l10n-153.0

Description

Thunderbird mail client's translation files

Added to portage

2026-07-23

ttyplot - 1.7.6
Ebuild name:

app-admin/ttyplot-1.7.6

Description

Realtime plotting utility with data input from stdin

Added to portage

2026-07-23

unbound - 1.25.2
Ebuild name:

net-dns/unbound-1.25.2

Description

A validating, recursive and caching DNS resolver

Added to portage

2026-07-23

unionfs-fuse - 3.7-r1
Ebuild name:

sys-fs/unionfs-fuse-3.7-r1

Description

Self-syncing tree-merging file system based on FUSE

Added to portage

2026-07-23

usbguard - 1.1.4-r2
Ebuild name:

sys-apps/usbguard-1.1.4-r2

Description

Daemon protecting your computer against BadUSB

Added to portage

2026-07-23

virtualbox - 7.2.14
Ebuild name:

app-emulation/virtualbox-7.2.14

Description

Family of powerful x86 virtualization products for enterprise and h

Added to portage

2026-07-23

virtualbox-additions - 7.2.14
Ebuild name:

app-emulation/virtualbox-additions-7.2.14

Description

CD image containing guest additions for VirtualBox

Added to portage

2026-07-23

virtualbox-extpack-oracle - 7.2.14
Ebuild name:

app-emulation/virtualbox-extpack-oracle-7.2.14

Description

PUEL extensions for VirtualBox

Added to portage

2026-07-23

virtualbox-guest-additions - 7.2.14
Ebuild name:

app-emulation/virtualbox-guest-additions-7.2.14

Description

VirtualBox kernel modules and user-space tools for

Added to portage

2026-07-23

virtualbox-guest-modules - 7.2.14
Ebuild name:

app-emulation/virtualbox-guest-modules-7.2.14

Description

Kernel Modules for Virtualbox Guest Additions

Added to portage

2026-07-23

virtualbox-kvm - 7.2.14_pre20260201
Ebuild name:

app-emulation/virtualbox-kvm-7.2.14_pre20260201

Description

Family of powerful x86 virtualization products for

Added to portage

2026-07-23

virtualbox-modules - 7.2.14
Ebuild name:

app-emulation/virtualbox-modules-7.2.14

Description

Kernel Modules for Virtualbox

Added to portage

2026-07-23

wayvnc - 0.10.1
Ebuild name:

gui-apps/wayvnc-0.10.1

Description

VNC server for wlroots based Wayland compositors

Added to portage

2026-07-23

weechat - 4.9.3
Ebuild name:

net-irc/weechat-4.9.3

Description

Portable and multi-interface IRC client

Added to portage

2026-07-23

weechat - 4.9.4
Ebuild name:

net-irc/weechat-4.9.4

Description

Portable and multi-interface IRC client

Added to portage

2026-07-23

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