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:

81993

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.7 (41 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
2025-11-09
SVG-Graph - 0.40.0
Ebuild name:

dev-perl/SVG-Graph-0.40.0

Description

Visualize your data in Scalable Vector Graphics (SVG) format

Added to portage

2025-11-09

Sys-Virt - 11.8.0
Ebuild name:

dev-perl/Sys-Virt-11.8.0

Description

API for using the libvirt library from Perl

Added to portage

2025-11-09

Test-Fatal - 0.18.0
Ebuild name:

dev-perl/Test-Fatal-0.18.0

Description

Incredibly simple helpers for testing code with exceptions

Added to portage

2025-11-09

Text-BibTeX - 0.910.0
Ebuild name:

dev-perl/Text-BibTeX-0.910.0

Description

A Perl library for reading, parsing, and processing BibTeX files

Added to portage

2025-11-09

audiocd-kio - 25.08.3-r1
Ebuild name:

kde-apps/audiocd-kio-25.08.3-r1

Description

KIO worker for accessing audio CDs

Added to portage

2025-11-09

dbus-fast - 2.45.0
Ebuild name:

dev-python/dbus-fast-2.45.0

Description

A faster version of dbus-next

Added to portage

2025-11-09

hishel - 1.1.5
Ebuild name:

dev-python/hishel-1.1.5

Description

An elegant HTTP Cache implementation for HTTPX and HTTP Core

Added to portage

2025-11-09

hypercorn - 0.18.0
Ebuild name:

dev-python/hypercorn-0.18.0

Description

A ASGI Server based on Hyper libraries and inspired by Gunicorn

Added to portage

2025-11-09

kdemultimedia-meta - 25.08.3-r1
Ebuild name:

kde-apps/kdemultimedia-meta-25.08.3-r1

Description

kdemultimedia - merge this to pull in all kdemultimedia-deri

Added to portage

2025-11-09

ntl - 11.6.0
Ebuild name:

dev-libs/ntl-11.6.0

Description

High-performance and portable C++ number theory library

Added to portage

2025-11-09

pytest - 9.0.0
Ebuild name:

dev-python/pytest-9.0.0

Description

Simple powerful testing with Python

Added to portage

2025-11-09

pytest-asyncio - 1.2.0-r1
Ebuild name:

dev-python/pytest-asyncio-1.2.0-r1

Description

Library for testing asyncio code with pytest

Added to portage

2025-11-09

pytest-describe - 3.0.0-r1
Ebuild name:

dev-python/pytest-describe-3.0.0-r1

Description

Describe-style plugin for pytest

Added to portage

2025-11-09

pytest-httpx - 0.35.0-r1
Ebuild name:

dev-python/pytest-httpx-0.35.0-r1

Description

Send responses to HTTPX using pytest

Added to portage

2025-11-09

radare2 - 6.0.4
Ebuild name:

dev-util/radare2-6.0.4

Description

unix-like reverse engineering framework and commandline tools

Added to portage

2025-11-09

tavern - 3.0.0-r1
Ebuild name:

dev-python/tavern-3.0.0-r1

Description

A tool, library, and Pytest plugin for testing RESTful APIs

Added to portage

2025-11-09

2025-11-08
amazon-ecr-credential-helper - 0.11.0
Ebuild name:

app-containers/amazon-ecr-credential-helper-0.11.0

Description

Automatically gets credentials for Amazon ECR on

Added to portage

2025-11-08

awscli - 1.42.69
Ebuild name:

app-admin/awscli-1.42.69

Description

Universal Command Line Environment for AWS

Added to portage

2025-11-08

bats - 1.13.0
Ebuild name:

dev-util/bats-1.13.0

Description

Bats-core Bash Automated Testing System

Added to portage

2025-11-08

boto3 - 1.40.69
Ebuild name:

dev-python/boto3-1.40.69

Description

The AWS SDK for Python

Added to portage

2025-11-08

botocore - 1.40.69
Ebuild name:

dev-python/botocore-1.40.69

Description

Low-level, data-driven core of boto 3

Added to portage

2025-11-08

bspwm - 0.9.12
Ebuild name:

x11-wm/bspwm-0.9.12

Description

Tiling window manager based on binary space partitioning

Added to portage

2025-11-08

cargo-audit - 0.22.0
Ebuild name:

dev-util/cargo-audit-0.22.0

Description

Audit Cargo.lock for crates with security vulnerabilities

Added to portage

2025-11-08

cheroot - 11.1.2
Ebuild name:

dev-python/cheroot-11.1.2

Description

High-performance, pure-Python HTTP server used by CherryPy

Added to portage

2025-11-08

clang - 22.0.0_pre20251108
Ebuild name:

dev-python/clang-22.0.0_pre20251108

Description

Python bindings for llvm-core/clang

Added to portage

2025-11-08

clang - 22.0.0_pre20251108
Ebuild name:

llvm-core/clang-22.0.0_pre20251108

Description

C language family frontend for LLVM

Added to portage

2025-11-08

clang-common - 22.0.0_pre20251108
Ebuild name:

llvm-core/clang-common-22.0.0_pre20251108

Description

Common files shared between multiple slots of clang

Added to portage

2025-11-08

claude-code - 2.0.35
Ebuild name:

dev-util/claude-code-2.0.35

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2025-11-08

compiler-rt - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/compiler-rt-22.0.0_pre20251108

Description

Compiler runtime library for clang (built-in part)

Added to portage

2025-11-08

compiler-rt-sanitizers - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/compiler-rt-sanitizers-22.0.0_pre20251108

Description

Compiler runtime libraries for clang (sanit

Added to portage

2025-11-08

coverage - 7.11.1
Ebuild name:

dev-python/coverage-7.11.1

Description

Code coverage measurement for Python

Added to portage

2025-11-08

cython-test-exception-raiser - 25.11.1
Ebuild name:

dev-python/cython-test-exception-raiser-25.11.1

Description

A trivial extension that just raises an exception (

Added to portage

2025-11-08

dracut - 109
Ebuild name:

sys-kernel/dracut-109

Description

Generic initramfs generation tool

Added to portage

2025-11-08

flang - 22.0.0_pre20251108
Ebuild name:

llvm-core/flang-22.0.0_pre20251108

Description

LLVM's Fortran frontend

Added to portage

2025-11-08

flang-rt - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/flang-rt-22.0.0_pre20251108

Description

LLVM's Fortran runtime

Added to portage

2025-11-08

gscan2pdf - 2.13.5
Ebuild name:

media-gfx/gscan2pdf-2.13.5

Description

Scan documents, perform OCR, produce PDFs and DjVus

Added to portage

2025-11-08

hcloud - 2.10.0
Ebuild name:

dev-python/hcloud-2.10.0

Description

Official Hetzner Cloud python library

Added to portage

2025-11-08

ibus-typing-booster - 2.28.3
Ebuild name:

app-i18n/ibus-typing-booster-2.28.3

Description

Completion input method for IBus

Added to portage

2025-11-08

inline-snapshot - 0.31.1
Ebuild name:

dev-python/inline-snapshot-0.31.1

Description

Create and update inline snapshots in your Python tests

Added to portage

2025-11-08

libclc - 22.0.0_pre20251108
Ebuild name:

llvm-core/libclc-22.0.0_pre20251108

Description

OpenCL C library

Added to portage

2025-11-08

libcxx - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/libcxx-22.0.0_pre20251108

Description

New implementation of the C++ standard library, targeting C

Added to portage

2025-11-08

libcxxabi - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/libcxxabi-22.0.0_pre20251108

Description

Low level support for a standard C++ library

Added to portage

2025-11-08

libgcc - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/libgcc-22.0.0_pre20251108

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2025-11-08

libunwind - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/libunwind-22.0.0_pre20251108

Description

C++ runtime stack unwinder from LLVM

Added to portage

2025-11-08

lit - 22.0.0_pre20251108
Ebuild name:

dev-python/lit-22.0.0_pre20251108

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2025-11-08

lld - 22.0.0_pre20251108
Ebuild name:

llvm-core/lld-22.0.0_pre20251108

Description

The LLVM linker (link editor)

Added to portage

2025-11-08

lldb - 22.0.0_pre20251108
Ebuild name:

llvm-core/lldb-22.0.0_pre20251108

Description

The LLVM debugger

Added to portage

2025-11-08

llvm - 22.0.0_pre20251108
Ebuild name:

dev-ml/llvm-22.0.0_pre20251108

Description

OCaml bindings for LLVM

Added to portage

2025-11-08

llvm - 22.0.0_pre20251108
Ebuild name:

llvm-core/llvm-22.0.0_pre20251108

Description

Low Level Virtual Machine

Added to portage

2025-11-08

llvm-common - 22.0.0_pre20251108
Ebuild name:

llvm-core/llvm-common-22.0.0_pre20251108

Description

Common files shared between multiple slots of LLVM

Added to portage

2025-11-08

mlir - 22.0.0_pre20251108
Ebuild name:

llvm-core/mlir-22.0.0_pre20251108

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2025-11-08

nginx - 1.29.3
Ebuild name:

www-servers/nginx-1.29.3

Description

Added to portage

2025-11-08

offload - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/offload-22.0.0_pre20251108

Description

OpenMP offloading support

Added to portage

2025-11-08

openmp - 22.0.0_pre20251108
Ebuild name:

llvm-runtimes/openmp-22.0.0_pre20251108

Description

OpenMP runtime library for LLVM/clang compiler

Added to portage

2025-11-08

openpgp-keys-unbound - 20251107
Ebuild name:

sec-keys/openpgp-keys-unbound-20251107

Description

OpenPGP keys used by unbound

Added to portage

2025-11-08

pgFormatter - 5.8
Ebuild name:

dev-db/pgFormatter-5.8

Description

PostgreSQL SQL syntax beautifier

Added to portage

2025-11-08

phonenumbers - 9.0.18
Ebuild name:

dev-python/phonenumbers-9.0.18

Description

Python port of Google's libphonenumber

Added to portage

2025-11-08

polly - 22.0.0_pre20251108
Ebuild name:

llvm-core/polly-22.0.0_pre20251108

Description

Polyhedral optimizations for LLVM

Added to portage

2025-11-08

pyglet - 2.1.11
Ebuild name:

dev-python/pyglet-2.1.11

Description

Cross-platform windowing and multimedia library for Python

Added to portage

2025-11-08

signal-desktop-bin - 7.78.0
Ebuild name:

net-im/signal-desktop-bin-7.78.0

Description

Allows you to send and receive messages of Signal Messenger on you

Added to portage

2025-11-08

spirv-llvm-translator - 22.0.0_pre20251107
Ebuild name:

dev-util/spirv-llvm-translator-22.0.0_pre20251107

Description

Bi-directional translator between SPIR-V and LLVM

Added to portage

2025-11-08

spyview - 2018.12.24-r2
Ebuild name:

sci-visualization/spyview-2018.12.24-r2

Description

2D and 3D data visualization and analysis program

Added to portage

2025-11-08

ssdeep - 2.14.1-r1
Ebuild name:

app-crypt/ssdeep-2.14.1-r1

Description

Computes context triggered piecewise hashes (fuzzy hashes)

Added to portage

2025-11-08

ssss - 0.5.7-r3
Ebuild name:

app-crypt/ssss-0.5.7-r3

Description

Shamir's Secret Sharing Scheme

Added to portage

2025-11-08

stan - 0.4.1-r1
Ebuild name:

app-crypt/stan-0.4.1-r1

Description

Stan analyzes binary streams and calculates statistical information

Added to portage

2025-11-08

steve - 9999
Ebuild name:

dev-build/steve-9999

Description

A simple jobserver for Gentoo

Added to portage

2025-11-08

stoken - 0.92-r3
Ebuild name:

app-crypt/stoken-0.92-r3

Description

Software Token for Linux/UNIX

Added to portage

2025-11-08

swtpm - 0.10.0
Ebuild name:

app-crypt/swtpm-0.10.0

Description

Libtpms-based TPM emulator

Added to portage

2025-11-08

systemd - 258.2
Ebuild name:

sys-apps/systemd-258.2

Description

System and service manager for Linux

Added to portage

2025-11-08

telegram-desktop-bin - 6.2.4-r1
Ebuild name:

net-im/telegram-desktop-bin-6.2.4-r1

Description

Official desktop client for Telegram (binary package)

Added to portage

2025-11-08

unbound - 1.24.1-r1
Ebuild name:

net-dns/unbound-1.24.1-r1

Description

A validating, recursive and caching DNS resolver

Added to portage

2025-11-08

unicode-cldr - 48.0
Ebuild name:

app-i18n/unicode-cldr-48.0

Description

Unicode Common Locale Data Repository

Added to portage

2025-11-08

uv - 0.9.8
Ebuild name:

dev-python/uv-0.9.8

Description

A Python package installer and resolver, written in Rust

Added to portage

2025-11-08

uv-build - 0.9.8
Ebuild name:

dev-python/uv-build-0.9.8

Description

PEP517 uv build backend

Added to portage

2025-11-08

yt-dlp-ejs - 0.3.1
Ebuild name:

dev-python/yt-dlp-ejs-0.3.1

Description

External JavaScript for yt-dlp supporting many runtimes

Added to portage

2025-11-08

zdkimfilter - 3.23
Ebuild name:

mail-filter/zdkimfilter-3.23

Description

DKIM filter for Courier-MTA

Added to portage

2025-11-08

zope-event - 6.1
Ebuild name:

dev-python/zope-event-6.1

Description

Event publishing / dispatch, used by Zope Component Architecture

Added to portage

2025-11-08

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 50.7 ms