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:

82838

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-16
alsa-lib - 1.2.15.3
Ebuild name:

media-libs/alsa-lib-1.2.15.3

Description

Advanced Linux Sound Architecture Library

Added to portage

2026-01-16

alsa-topology-conf - 1.2.5.1-r1
Ebuild name:

media-libs/alsa-topology-conf-1.2.5.1-r1

Description

ALSA topology configuration files

Added to portage

2026-01-16

alsa-ucm-conf - 1.2.15.3
Ebuild name:

media-libs/alsa-ucm-conf-1.2.15.3

Description

ALSA ucm configuration files

Added to portage

2026-01-16

aseprite - 1.3.16.1
Ebuild name:

dev-games/aseprite-1.3.16.1

Description

Animated sprite editor & pixel art tool

Added to portage

2026-01-16

babl - 0.1.120
Ebuild name:

media-libs/babl-0.1.120

Description

A dynamic, any to any, pixel format conversion library

Added to portage

2026-01-16

blake3 - 1.8.3
Ebuild name:

dev-libs/blake3-1.8.3

Description

a fast cryptographic hash function

Added to portage

2026-01-16

capstone - 6.0.0_alpha6
Ebuild name:

dev-libs/capstone-6.0.0_alpha6

Description

disassembly/disassembler framework + bindings

Added to portage

2026-01-16

gajim - 2.4.2
Ebuild name:

net-im/gajim-2.4.2

Description

GTK XMPP Client

Added to portage

2026-01-16

icecast - 2.5.0
Ebuild name:

net-misc/icecast-2.5.0

Description

Opensource alternative to shoutcast that supports mp3, ogg and aac streaming

Added to portage

2026-01-16

ktls-utils - 1.3.0
Ebuild name:

net-misc/ktls-utils-1.3.0

Description

Kernel TLS helper utilities

Added to portage

2026-01-16

libigloo - 0.9.5
Ebuild name:

dev-libs/libigloo-0.9.5

Description

Generic framework for C development - used by the Icecast project

Added to portage

2026-01-16

libnice - 0.1.23
Ebuild name:

net-libs/libnice-0.1.23

Description

Implementation of the Interactice Connectivity Establishment standard (ICE)

Added to portage

2026-01-16

libnvidia-container - 1.18.1
Ebuild name:

sys-libs/libnvidia-container-1.18.1

Description

NVIDIA container runtime library

Added to portage

2026-01-16

ltrace - 0.8.1
Ebuild name:

dev-debug/ltrace-0.8.1

Description

trace library calls made at runtime

Added to portage

2026-01-16

mysql-connector-c - 8.0.36-r1
Ebuild name:

dev-db/mysql-connector-c-8.0.36-r1

Description

C client library for MariaDB/MySQL

Added to portage

2026-01-16

mysql-connector-c - 8.0.41-r1
Ebuild name:

dev-db/mysql-connector-c-8.0.41-r1

Description

C client library for MariaDB/MySQL

Added to portage

2026-01-16

nvidia-container-toolkit - 1.18.1
Ebuild name:

app-containers/nvidia-container-toolkit-1.18.1

Description

NVIDIA container runtime toolkit

Added to portage

2026-01-16

openpgp-keys-alsa - 20260116
Ebuild name:

sec-keys/openpgp-keys-alsa-20260116

Description

OpenPGP keys used by the Alsa Project

Added to portage

2026-01-16

openpgp-keys-dwz - 20260115
Ebuild name:

sec-keys/openpgp-keys-dwz-20260115

Description

OpenPGP key used to sign dwz releases

Added to portage

2026-01-16

openpgp-keys-less - 20260115
Ebuild name:

sec-keys/openpgp-keys-less-20260115

Description

OpenPGP keys used by less

Added to portage

2026-01-16

openpgp-keys-smartmontools - 20260116
Ebuild name:

sec-keys/openpgp-keys-smartmontools-20260116

Description

OpenPGP key used to sign smartmontools releases

Added to portage

2026-01-16

openpgp-keys-tytso - 20260115
Ebuild name:

sec-keys/openpgp-keys-tytso-20260115

Description

OpenPGP keys used by Theodore Ts'o

Added to portage

2026-01-16

pdns-recursor - 5.3.4
Ebuild name:

net-dns/pdns-recursor-5.3.4

Description

The PowerDNS Recursor

Added to portage

2026-01-16

pipewire - 1.4.9-r3
Ebuild name:

media-video/pipewire-1.4.9-r3

Description

Multimedia processing graphs

Added to portage

2026-01-16

sccache - 0.13.0
Ebuild name:

dev-util/sccache-0.13.0

Description

ccache/distcc like tool with support for rust and cloud storage

Added to portage

2026-01-16

sssd - 2.12.0
Ebuild name:

sys-auth/sssd-2.12.0

Description

System Security Services Daemon provides access to identity and authentication

Added to portage

2026-01-16

systemd-utils - 259
Ebuild name:

sys-apps/systemd-utils-259

Description

Utilities split out from systemd for OpenRC users

Added to portage

2026-01-16

termsyn - 1.8.7-r1
Ebuild name:

media-fonts/termsyn-1.8.7-r1

Description

Monospaced font based on terminus and tamsyn

Added to portage

2026-01-16

trojan - 1.16.0-r4
Ebuild name:

net-proxy/trojan-1.16.0-r4

Description

An unidentifiable mechanism that helps you bypass GFW

Added to portage

2026-01-16

yara-x - 1.11.0
Ebuild name:

app-forensics/yara-x-1.11.0

Description

A malware identification and classification tool

Added to portage

2026-01-16

zen-sources - 6.18.4
Ebuild name:

sys-kernel/zen-sources-6.18.4

Description

The Zen Kernel Live Sources

Added to portage

2026-01-16

zen-sources - 6.18.5
Ebuild name:

sys-kernel/zen-sources-6.18.5

Description

The Zen Kernel Live Sources

Added to portage

2026-01-16

2026-01-15
alembic - 1.18.1
Ebuild name:

dev-python/alembic-1.18.1

Description

Database migrations tool, written by the author of SQLAlchemy

Added to portage

2026-01-15

atuin - 18.11.0
Ebuild name:

app-shells/atuin-18.11.0

Description

Shell history manager supporting encrypted synchronisation

Added to portage

2026-01-15

awscli - 1.44.18
Ebuild name:

app-admin/awscli-1.44.18

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-15

boto3 - 1.42.28
Ebuild name:

dev-python/boto3-1.42.28

Description

The AWS SDK for Python

Added to portage

2026-01-15

botocore - 1.42.28
Ebuild name:

dev-python/botocore-1.42.28

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-15

chef-utils - 18.9.4
Ebuild name:

dev-ruby/chef-utils-18.9.4

Description

Basic utility functions for Core Chef Infra development

Added to portage

2026-01-15

claude-code - 2.1.8
Ebuild name:

dev-util/claude-code-2.1.8

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-15

deno-bin - 2.6.5
Ebuild name:

dev-lang/deno-bin-2.6.5

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-01-15

dict2xml - 1.7.8
Ebuild name:

dev-python/dict2xml-1.7.8

Description

Small utility to convert a python dictionary into an XML string

Added to portage

2026-01-15

django-polymorphic - 4.10.2
Ebuild name:

dev-python/django-polymorphic-4.10.2

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-01-15

egl-gbm - 1.1.3
Ebuild name:

gui-libs/egl-gbm-1.1.3

Description

NVIDIA GBM EGL external platform library

Added to portage

2026-01-15

fastfetch - 2.57.1
Ebuild name:

app-misc/fastfetch-2.57.1

Description

Fast neofetch-like system information tool

Added to portage

2026-01-15

fido2 - 2.1.0
Ebuild name:

dev-python/fido2-2.1.0

Description

Python based FIDO 2.0 library

Added to portage

2026-01-15

jupyter-server-terminals - 0.5.4
Ebuild name:

dev-python/jupyter-server-terminals-0.5.4

Description

A Jupyter Server Extension Providing Terminals

Added to portage

2026-01-15

librt - 0.7.8
Ebuild name:

dev-python/librt-0.7.8

Description

Mypyc runtime library

Added to portage

2026-01-15

mattermost-desktop-bin - 6.0.3_rc1
Ebuild name:

net-im/mattermost-desktop-bin-6.0.3_rc1

Description

Mattermost Desktop application

Added to portage

2026-01-15

mothur - 1.48.2
Ebuild name:

sci-biology/mothur-1.48.2

Description

Suite of algorithms for ecological bioinformatics

Added to portage

2026-01-15

oidc-agent - 5.3.4
Ebuild name:

net-misc/oidc-agent-5.3.4

Description

Agent and tools for managing OpenID Connect tokens on the command line

Added to portage

2026-01-15

osm - 1.9
Ebuild name:

app-emacs/osm-1.9

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2026-01-15

pandas - 3.0.0_rc2
Ebuild name:

dev-python/pandas-3.0.0_rc2

Description

Powerful data structures for data analysis and statistics

Added to portage

2026-01-15

parser - 3.3.10.1
Ebuild name:

dev-ruby/parser-3.3.10.1

Description

A production-ready Ruby parser written in pure Ruby

Added to portage

2026-01-15

pixi - 0.63.0
Ebuild name:

dev-util/pixi-0.63.0

Description

A package management and workflow tool

Added to portage

2026-01-15

plotly - 6.5.2
Ebuild name:

dev-python/plotly-6.5.2

Description

Browser-based graphing library for Python

Added to portage

2026-01-15

prometheus-client - 0.24.1
Ebuild name:

dev-python/prometheus-client-0.24.1

Description

Python client for the Prometheus monitoring system

Added to portage

2026-01-15

regex - 2026.1.15
Ebuild name:

dev-python/regex-2026.1.15

Description

Alternative regular expression module to replace re

Added to portage

2026-01-15

resolv-replace - 0.2.0
Ebuild name:

dev-ruby/resolv-replace-0.2.0

Description

Replace Socket DNS with Resolv

Added to portage

2026-01-15

ruby - 3.2.10
Ebuild name:

dev-lang/ruby-3.2.10

Description

An object-oriented scripting language

Added to portage

2026-01-15

send2trash - 2.1.0
Ebuild name:

dev-python/send2trash-2.1.0

Description

Sends files to the Trash (or Recycle Bin)

Added to portage

2026-01-15

sphinx-pytest - 0.3.0
Ebuild name:

dev-python/sphinx-pytest-0.3.0

Description

Helpful pytest fixtures for Sphinx extensions

Added to portage

2026-01-15

synapse - 1.145.0
Ebuild name:

net-im/synapse-1.145.0

Description

Reference implementation of Matrix homeserver

Added to portage

2026-01-15

tifffile - 2026.1.14
Ebuild name:

dev-python/tifffile-2026.1.14

Description

Read and write TIFF files

Added to portage

2026-01-15

translate-toolkit - 3.18.1
Ebuild name:

dev-python/translate-toolkit-3.18.1

Description

Toolkit to convert between many translation formats

Added to portage

2026-01-15

trove-classifiers - 2026.1.14.14
Ebuild name:

dev-python/trove-classifiers-2026.1.14.14

Description

Canonical source for classifiers on PyPI (pypi.org)

Added to portage

2026-01-15

xcp - 0.24.2
Ebuild name:

sys-fs/xcp-0.24.2

Description

A 'cp' alternative with user-friendly feedback and performance optimisations

Added to portage

2026-01-15

yamllint - 1.38.0
Ebuild name:

dev-util/yamllint-1.38.0

Description

A linter for YAML files

Added to portage

2026-01-15

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