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:

88484

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-09-19
clang-runtime - 19.1.7-r2
Ebuild name:

llvm-runtimes/clang-runtime-19.1.7-r2

Description

Meta-ebuild for clang runtime libraries

Added to portage

2026-09-19

clang-runtime - 20.1.8-r2
Ebuild name:

llvm-runtimes/clang-runtime-20.1.8-r2

Description

Meta-ebuild for clang runtime libraries

Added to portage

2026-09-19

clang-runtime - 21.1.8-r1
Ebuild name:

llvm-runtimes/clang-runtime-21.1.8-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2026-09-19

clang-runtime - 22-r1
Ebuild name:

llvm-runtimes/clang-runtime-22-r1

Description

Meta-ebuild for clang runtime libraries

Added to portage

2026-09-19

clang-runtime - 23-r2
Ebuild name:

llvm-runtimes/clang-runtime-23-r2

Description

Meta-ebuild for clang runtime libraries

Added to portage

2026-09-19

parse - 1.22.2
Ebuild name:

dev-python/parse-1.22.2

Description

Parse strings using a specification based on the Python format() syntax

Added to portage

2026-09-19

2026-09-18
Coro - 6.570.0-r1
Ebuild name:

dev-perl/Coro-6.570.0-r1

Description

The only real threads in perl

Added to portage

2026-09-18

awkward - 2.14.0
Ebuild name:

dev-python/awkward-2.14.0

Description

Manipulate JSON-like data with NumPy-like idioms

Added to portage

2026-09-18

awkward-cpp - 57
Ebuild name:

dev-python/awkward-cpp-57

Description

CPU kernels and compiled extensions for Awkward Array

Added to portage

2026-09-18

awscli - 2.36.48
Ebuild name:

app-admin/awscli-2.36.48

Description

Universal Command Line Environment for AWS

Added to portage

2026-09-18

barman - 3.20.0
Ebuild name:

dev-db/barman-3.20.0

Description

Administration tool for disaster recovery of PostgreSQL servers

Added to portage

2026-09-18

blockbuster - 1.5.28
Ebuild name:

dev-python/blockbuster-1.5.28

Description

Utility to detect blocking calls in the async event loop

Added to portage

2026-09-18

boto3 - 1.43.97
Ebuild name:

dev-python/boto3-1.43.97

Description

The AWS SDK for Python

Added to portage

2026-09-18

botocore - 1.43.97
Ebuild name:

dev-python/botocore-1.43.97

Description

Low-level, data-driven core of boto 3

Added to portage

2026-09-18

cfn-lint - 1.57.0
Ebuild name:

dev-python/cfn-lint-1.57.0

Description

CloudFormation Linter

Added to portage

2026-09-18

elfutils - 0.196
Ebuild name:

dev-libs/elfutils-0.196

Description

Libraries/utilities to handle ELF objects (drop in replacement for libelf)

Added to portage

2026-09-18

firewalld - 2.5.2
Ebuild name:

net-firewall/firewalld-2.5.2

Description

Firewall daemon with D-Bus interface providing a dynamic firewall

Added to portage

2026-09-18

flang-rt - 21.1.8-r1
Ebuild name:

llvm-runtimes/flang-rt-21.1.8-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

flang-rt - 22.1.8-r1
Ebuild name:

llvm-runtimes/flang-rt-22.1.8-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

flang-rt - 23.1.1-r1
Ebuild name:

llvm-runtimes/flang-rt-23.1.1-r1

Description

LLVM's Fortran runtime

Added to portage

2026-09-18

gcc - 14.4.1_p20260917
Ebuild name:

sys-devel/gcc-14.4.1_p20260917

Description

The GNU Compiler Collection

Added to portage

2026-09-18

git-lfs - 3.8.0
Ebuild name:

dev-vcs/git-lfs-3.8.0

Description

Command line extension and specification for managing large files with git

Added to portage

2026-09-18

google-api-core - 2.38.0
Ebuild name:

dev-python/google-api-core-2.38.0

Description

Core Library for Google Client Libraries

Added to portage

2026-09-18

grafana-bin - 12.1.10
Ebuild name:

www-apps/grafana-bin-12.1.10

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Ope

Added to portage

2026-09-18

grafana-bin - 12.2.10
Ebuild name:

www-apps/grafana-bin-12.2.10

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Ope

Added to portage

2026-09-18

grafana-bin - 12.3.11
Ebuild name:

www-apps/grafana-bin-12.3.11

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Ope

Added to portage

2026-09-18

grafana-bin - 12.4.11
Ebuild name:

www-apps/grafana-bin-12.4.11

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Ope

Added to portage

2026-09-18

grafana-bin - 13.1.6
Ebuild name:

www-apps/grafana-bin-13.1.6

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Open

Added to portage

2026-09-18

grafana-bin - 13.2.2
Ebuild name:

www-apps/grafana-bin-13.2.2

Description

Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Open

Added to portage

2026-09-18

hatch-jupyter-builder - 0.10.0
Ebuild name:

dev-python/hatch-jupyter-builder-0.10.0

Description

A hatch plugin to help build Jupyter packages

Added to portage

2026-09-18

hidapi-hotplug - 0.15.0
Ebuild name:

dev-libs/hidapi-hotplug-0.15.0

Description

Fork of dev-libs/hidapi with hotplug support

Added to portage

2026-09-18

imapclient - 4.1.0
Ebuild name:

dev-python/imapclient-4.1.0

Description

easy-to-use, pythonic, and complete IMAP client library

Added to portage

2026-09-18

iminuit - 2.33.0
Ebuild name:

dev-python/iminuit-2.33.0

Description

Minuit numerical function minimization in Python

Added to portage

2026-09-18

inform-mode - 2.0.1
Ebuild name:

app-emacs/inform-mode-2.0.1

Description

A major mode for editing Inform programs

Added to portage

2026-09-18

kirigami-addons - 1.14.0
Ebuild name:

dev-libs/kirigami-addons-1.14.0

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-09-18

libde265 - 1.1.3
Ebuild name:

media-libs/libde265-1.1.3

Description

Open h.265 video codec implementation

Added to portage

2026-09-18

libdwarf - 2.3.2
Ebuild name:

dev-libs/libdwarf-2.3.2

Description

Library intended to simplify reading (and writing) applications using DWARF

Added to portage

2026-09-18

libmaxminddb - 1.14.1
Ebuild name:

dev-libs/libmaxminddb-1.14.1

Description

C library for the MaxMind DB file format

Added to portage

2026-09-18

lyx - 2.5.3
Ebuild name:

app-office/lyx-2.5.3

Description

WYSIWYM (What You See Is What You Mean) document processor based on LaTeX

Added to portage

2026-09-18

moarvm - 2026.08
Ebuild name:

dev-lang/moarvm-2026.08

Description

A 6model-based VM for NQP and Raku

Added to portage

2026-09-18

multidict - 6.9.0
Ebuild name:

dev-python/multidict-6.9.0

Description

multidict implementation

Added to portage

2026-09-18

nqp - 2026.08
Ebuild name:

dev-lang/nqp-2026.08

Description

Not Quite Perl, a Raku bootstrapping compiler

Added to portage

2026-09-18

openrgb - 1.0
Ebuild name:

app-misc/openrgb-1.0

Description

Open source RGB lighting control

Added to portage

2026-09-18

openrgb-plugin-effects - 1.0
Ebuild name:

app-misc/openrgb-plugin-effects-1.0

Description

Plugin for OpenRGB with various Effects that can be synced acro

Added to portage

2026-09-18

openrgb-plugin-effects - 1.0_rc2-r1
Ebuild name:

app-misc/openrgb-plugin-effects-1.0_rc2-r1

Description

Plugin for OpenRGB with various Effects that can be sync

Added to portage

2026-09-18

openrgb-plugin-skin - 1.0_rc2-r1
Ebuild name:

app-misc/openrgb-plugin-skin-1.0_rc2-r1

Description

Plugin for OpenRGB that allows you to customize the look an

Added to portage

2026-09-18

openrgb-plugin-visualmap - 1.0
Ebuild name:

app-misc/openrgb-plugin-visualmap-1.0

Description

Plugin for OpenRGB to create virtual devices out of multiple

Added to portage

2026-09-18

openrgb-plugin-visualmap - 1.0_rc2-r1
Ebuild name:

app-misc/openrgb-plugin-visualmap-1.0_rc2-r1

Description

Plugin for OpenRGB to create virtual devices out of mu

Added to portage

2026-09-18

pandas - 3.0.6
Ebuild name:

dev-python/pandas-3.0.6

Description

Powerful data structures for data analysis and statistics

Added to portage

2026-09-18

pipewire - 1.6.9
Ebuild name:

media-video/pipewire-1.6.9

Description

Multimedia processing graphs

Added to portage

2026-09-18

platformdirs - 4.11.10
Ebuild name:

dev-python/platformdirs-4.11.10

Description

A small Python module for determining appropriate platform-specific

Added to portage

2026-09-18

pulseaudio-qt - 1.9.0
Ebuild name:

media-libs/pulseaudio-qt-1.9.0

Description

Qt bindings for libpulse

Added to portage

2026-09-18

pyproject-api - 1.11.2
Ebuild name:

dev-python/pyproject-api-1.11.2

Description

API to interact with the python pyproject.toml based projects

Added to portage

2026-09-18

python-discovery - 1.6.1
Ebuild name:

dev-python/python-discovery-1.6.1

Description

Python interpreter discovery

Added to portage

2026-09-18

quiche - 0.30.0
Ebuild name:

net-libs/quiche-0.30.0

Description

Implementation of the QUIC transport protocol and HTTP/3

Added to portage

2026-09-18

rakudo - 2026.08
Ebuild name:

dev-lang/rakudo-2026.08

Description

A compiler for the Raku programming language

Added to portage

2026-09-18

redis - 8.10.2
Ebuild name:

dev-db/redis-8.10.2

Description

A persistent caching system, key-value, and data structures database

Added to portage

2026-09-18

redis - 8.2.10
Ebuild name:

dev-db/redis-8.2.10

Description

A persistent caching system, key-value, and data structures database

Added to portage

2026-09-18

redis - 8.4.7
Ebuild name:

dev-db/redis-8.4.7

Description

A persistent caching system, key-value, and data structures database

Added to portage

2026-09-18

redis - 8.6.7
Ebuild name:

dev-db/redis-8.6.7

Description

A persistent caching system, key-value, and data structures database

Added to portage

2026-09-18

redis - 8.8.3
Ebuild name:

dev-db/redis-8.8.3

Description

A persistent caching system, key-value, and data structures database

Added to portage

2026-09-18

secret-service - 0-r2
Ebuild name:

virtual/secret-service-0-r2

Description

Virtual for a freedesktop.org Secret Service API provider

Added to portage

2026-09-18

sphinx-autodoc-typehints - 3.13.7
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.13.7

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-09-18

strace - 7.2
Ebuild name:

dev-debug/strace-7.2

Description

Useful diagnostic, instructional, and debugging tool

Added to portage

2026-09-18

stunnel - 5.81
Ebuild name:

net-misc/stunnel-5.81

Description

TLS/SSL - Port Wrapper

Added to portage

2026-09-18

tree-sitter - 0.26.0_p20260816-r1
Ebuild name:

dev-python/tree-sitter-0.26.0_p20260816-r1

Description

Python bindings to the Tree-sitter parsing library

Added to portage

2026-09-18

urwid - 4.1.5
Ebuild name:

dev-python/urwid-4.1.5

Description

Curses-based user interface library for Python

Added to portage

2026-09-18

uv - 0.12.16
Ebuild name:

dev-python/uv-0.12.16

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-09-18

uv-build - 0.12.16
Ebuild name:

dev-python/uv-build-0.12.16

Description

PEP517 uv build backend

Added to portage

2026-09-18

virtualenv - 21.7.11
Ebuild name:

dev-python/virtualenv-21.7.11

Description

Virtual Python Environment builder

Added to portage

2026-09-18

virtualenv - 21.7.14
Ebuild name:

dev-python/virtualenv-21.7.14

Description

Virtual Python Environment builder

Added to portage

2026-09-18

wcwidth - 0.8.4
Ebuild name:

dev-python/wcwidth-0.8.4

Description

Measures number of Terminal column cells of wide-character codes

Added to portage

2026-09-18

wireplumber - 0.5.17
Ebuild name:

media-video/wireplumber-0.5.17

Description

Replacement for pipewire-media-session

Added to portage

2026-09-18

wordpress - 7.1.1
Ebuild name:

www-apps/wordpress-7.1.1

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2026-09-18

xfsprogs - 7.2.0
Ebuild name:

sys-fs/xfsprogs-7.2.0

Description

XFS filesystem utilities

Added to portage

2026-09-18

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