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:

80934

userrating:

average rating: 1.2 (50 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-09-18
apulse - 0.1.14
Ebuild name:

media-sound/apulse-0.1.14

Description

PulseAudio emulation for ALSA

Added to portage

2025-09-18

blazesym_c - 0.1.4
Ebuild name:

dev-libs/blazesym_c-0.1.4

Description

C bindings for blazesym, a library for address symbolization and related

Added to portage

2025-09-18

bpftrace - 0.24.0
Ebuild name:

dev-debug/bpftrace-0.24.0

Description

High-level tracing language for eBPF

Added to portage

2025-09-18

driftnet - 1.5.0
Ebuild name:

net-analyzer/driftnet-1.5.0

Description

Watches network traffic and displays media from TCP streams observed

Added to portage

2025-09-18

element-desktop-bin - 1.11.112
Ebuild name:

net-im/element-desktop-bin-1.11.112

Description

A glossy Matrix collaboration client for desktop (binary packag

Added to portage

2025-09-18

esptool - 4.10.0
Ebuild name:

dev-embedded/esptool-4.10.0

Description

Utility to communicate with the ROM bootloader in Espressif ESP8266 and

Added to portage

2025-09-18

esptool - 5.1.0
Ebuild name:

dev-embedded/esptool-5.1.0

Description

Serial utility for flashing and interacting with Espressif ESP8266 and E

Added to portage

2025-09-18

fex-xtajit - 2509
Ebuild name:

app-emulation/fex-xtajit-2509

Description

A wine emulation dll for running x86 application on an arm64 host

Added to portage

2025-09-18

fheroes2 - 1.1.11
Ebuild name:

games-engines/fheroes2-1.1.11

Description

Recreation of HoMM2 game engine

Added to portage

2025-09-18

gmtp - 1.3.11-r4
Ebuild name:

media-sound/gmtp-1.3.11-r4

Description

Simple MTP client for MP3 players

Added to portage

2025-09-18

jsoncons - 1.4.0
Ebuild name:

dev-cpp/jsoncons-1.4.0

Description

C++ header-only library for JSON and JSON-like data formats

Added to portage

2025-09-18

libfmt - 12.0.0
Ebuild name:

dev-libs/libfmt-12.0.0

Description

Small, safe and fast formatting library

Added to portage

2025-09-18

libwebsockets - 4.4.1-r1
Ebuild name:

net-libs/libwebsockets-4.4.1-r1

Description

A flexible pure-C library for implementing network protocols

Added to portage

2025-09-18

llvm-mingw64 - 13.0.0-r1
Ebuild name:

dev-util/llvm-mingw64-13.0.0-r1

Description

Clang/LLVM based mingw64 toolchain

Added to portage

2025-09-18

mathgl - 8.0.3
Ebuild name:

sci-libs/mathgl-8.0.3

Description

Math Graphics Library

Added to portage

2025-09-18

mesa - 25.2.3
Ebuild name:

media-libs/mesa-25.2.3

Description

OpenGL-like graphic library for Linux

Added to portage

2025-09-18

mesa_clc - 25.2.3
Ebuild name:

dev-util/mesa_clc-25.2.3

Description

mesa_clc tool used for building OpenCL C to SPIR-V

Added to portage

2025-09-18

microsoft-edge - 140.0.3485.66-r1
Ebuild name:

www-client/microsoft-edge-140.0.3485.66-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-beta - 140.0.3485.49-r1
Ebuild name:

www-client/microsoft-edge-beta-140.0.3485.49-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-beta - 140.0.3485.54-r1
Ebuild name:

www-client/microsoft-edge-beta-140.0.3485.54-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-beta - 141.0.3537.13-r1
Ebuild name:

www-client/microsoft-edge-beta-141.0.3537.13-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-dev - 141.0.3514.0-r1
Ebuild name:

www-client/microsoft-edge-dev-141.0.3514.0-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-dev - 141.0.3525.0-r1
Ebuild name:

www-client/microsoft-edge-dev-141.0.3525.0-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

microsoft-edge-dev - 141.0.3537.9-r1
Ebuild name:

www-client/microsoft-edge-dev-141.0.3537.9-r1

Description

The web browser from Microsoft

Added to portage

2025-09-18

openrgb - 1.0_rc2
Ebuild name:

app-misc/openrgb-1.0_rc2

Description

Open source RGB lighting control

Added to portage

2025-09-18

openrgb-plugin-effects - 1.0_rc2
Ebuild name:

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

Description

Plugin for OpenRGB with various Effects that can be synced

Added to portage

2025-09-18

openrgb-plugin-skin - 1.0_rc2
Ebuild name:

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

Description

Plugin for OpenRGB that allows you to customize the look and f

Added to portage

2025-09-18

openrgb-plugin-visualmap - 1.0_rc2
Ebuild name:

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

Description

Plugin for OpenRGB to create virtual devices out of multi

Added to portage

2025-09-18

simdjson - 4.0.4
Ebuild name:

dev-libs/simdjson-4.0.4

Description

SIMD accelerated C++ JSON library

Added to portage

2025-09-18

vlc - 3.0.22_rc1-r2
Ebuild name:

media-video/vlc-3.0.22_rc1-r2

Description

Media player and framework with support for most multimedia files and

Added to portage

2025-09-18

2025-09-17
aspell-af - 0.50.0-r1
Ebuild name:

app-dicts/aspell-af-0.50.0-r1

Description

Aspell () language dictionary

Added to portage

2025-09-17

aspell-am - 0.03.1-r1
Ebuild name:

app-dicts/aspell-am-0.03.1-r1

Description

Aspell () language dictionary

Added to portage

2025-09-17

aspell-ar - 1.2.0-r1
Ebuild name:

app-dicts/aspell-ar-1.2.0-r1

Description

Aspell () language dictionary

Added to portage

2025-09-17

awscli - 1.42.32
Ebuild name:

app-admin/awscli-1.42.32

Description

Universal Command Line Environment for AWS

Added to portage

2025-09-17

boto3 - 1.40.32
Ebuild name:

dev-python/boto3-1.40.32

Description

The AWS SDK for Python

Added to portage

2025-09-17

botocore - 1.40.32
Ebuild name:

dev-python/botocore-1.40.32

Description

Low-level, data-driven core of boto 3

Added to portage

2025-09-17

cJSON - 1.7.19
Ebuild name:

dev-libs/cJSON-1.7.19

Description

Ultralightweight JSON parser in ANSI C

Added to portage

2025-09-17

ceph - 20.1.0-r2
Ebuild name:

sys-cluster/ceph-20.1.0-r2

Description

Ceph distributed filesystem

Added to portage

2025-09-17

claude-code - 1.0.117
Ebuild name:

dev-util/claude-code-1.0.117

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2025-09-17

cmd2 - 3.0.0_beta1
Ebuild name:

dev-python/cmd2-3.0.0_beta1

Description

Extra features for standard library's cmd module

Added to portage

2025-09-17

cryptography - 46.0.1
Ebuild name:

dev-python/cryptography-46.0.1

Description

Library providing cryptographic recipes and primitives

Added to portage

2025-09-17

cython - 3.1.4
Ebuild name:

dev-python/cython-3.1.4

Description

A Python to C compiler

Added to portage

2025-09-17

dkms - 3.2.2
Ebuild name:

sys-kernel/dkms-3.2.2

Description

Dynamic Kernel Module Support

Added to portage

2025-09-17

dust - 1.2.3
Ebuild name:

sys-block/dust-1.2.3

Description

A more intuitive version of du

Added to portage

2025-09-17

erlang - 26.2.5.15
Ebuild name:

dev-lang/erlang-26.2.5.15

Description

Erlang programming language, runtime environment and libraries (OTP)

Added to portage

2025-09-17

erlang - 27.3.4.3
Ebuild name:

dev-lang/erlang-27.3.4.3

Description

Erlang programming language, runtime environment and libraries (OTP)

Added to portage

2025-09-17

erlang - 28.0.4
Ebuild name:

dev-lang/erlang-28.0.4

Description

Erlang programming language, runtime environment and libraries (OTP)

Added to portage

2025-09-17

erlang - 28.1
Ebuild name:

dev-lang/erlang-28.1

Description

Erlang programming language, runtime environment and libraries (OTP)

Added to portage

2025-09-17

expat - 2.7.2
Ebuild name:

dev-libs/expat-2.7.2

Description

Stream-oriented XML parser library

Added to portage

2025-09-17

folly - 2025.04.14.00-r2
Ebuild name:

dev-cpp/folly-2025.04.14.00-r2

Description

An open-source C++ library developed and used at Facebook

Added to portage

2025-09-17

ghostty - 1.2.0
Ebuild name:

x11-terms/ghostty-1.2.0

Description

Fast, feature-rich, and cross-platform terminal emulator

Added to portage

2025-09-17

ghostty-terminfo - 1.2.0
Ebuild name:

x11-terms/ghostty-terminfo-1.2.0

Description

Terminfo for ghostty, a fast, feature-rich, and cross-platform ter

Added to portage

2025-09-17

gmmlib - 22.8.2
Ebuild name:

media-libs/gmmlib-22.8.2

Description

Intel Graphics Memory Management Library

Added to portage

2025-09-17

google-api-python-client - 2.182.0
Ebuild name:

dev-python/google-api-python-client-2.182.0

Description

Google API Client for Python

Added to portage

2025-09-17

grpcio - 1.75.0
Ebuild name:

dev-python/grpcio-1.75.0

Description

HTTP/2-based RPC framework

Added to portage

2025-09-17

grpcio-status - 1.75.0
Ebuild name:

dev-python/grpcio-status-1.75.0

Description

Reference package for GRPC Python status proto mapping

Added to portage

2025-09-17

gtk4-layer-shell - 1.1.1-r1
Ebuild name:

gui-libs/gtk4-layer-shell-1.1.1-r1

Description

A library for using the Layer Shell Wayland protocol with GTK4.

Added to portage

2025-09-17

hypothesis - 6.139.1
Ebuild name:

dev-python/hypothesis-6.139.1

Description

A library for property based testing

Added to portage

2025-09-17

ibus-typing-booster - 2.27.75
Ebuild name:

app-i18n/ibus-typing-booster-2.27.75

Description

Completion input method for IBus

Added to portage

2025-09-17

libva-intel-media-driver - 25.3.4
Ebuild name:

media-libs/libva-intel-media-driver-25.3.4

Description

Intel Media Driver for VA-API (iHD)

Added to portage

2025-09-17

log4cplus - 2.1.2-r1
Ebuild name:

dev-libs/log4cplus-2.1.2-r1

Description

C++ port of the Log for Java (log4j) logging library

Added to portage

2025-09-17

m17n-db - 1.8.10
Ebuild name:

dev-db/m17n-db-1.8.10

Description

Database for the m17n library

Added to portage

2025-09-17

m17n-lib - 1.8.6
Ebuild name:

dev-libs/m17n-lib-1.8.6

Description

Multilingual Library for Unix/Linux

Added to portage

2025-09-17

mvfst - 2025.04.14.00-r1
Ebuild name:

dev-cpp/mvfst-2025.04.14.00-r1

Description

An implementation of the QUIC transport protocol

Added to portage

2025-09-17

nbclassic - 1.3.3
Ebuild name:

dev-python/nbclassic-1.3.3

Description

Jupyter Notebook as a Jupyter Server Extension

Added to portage

2025-09-17

ngx-auth-ldap - 0.1_p20240424
Ebuild name:

www-nginx/ngx-auth-ldap-0.1_p20240424

Description

LDAP authentication module for NGINX

Added to portage

2025-09-17

ngx-push-stream - 0.6.0
Ebuild name:

www-nginx/ngx-push-stream-0.6.0

Description

Added to portage

2025-09-17

notus-scanner - 22.7.2
Ebuild name:

net-analyzer/notus-scanner-22.7.2

Description

Notus is a vulnerability scanner for creating results from local

Added to portage

2025-09-17

openjdk - 25_p36
Ebuild name:

dev-java/openjdk-25_p36

Description

Open source implementation of the Java programming language

Added to portage

2025-09-17

openpgp-keys-gentoo-developers - 20250915
Ebuild name:

sec-keys/openpgp-keys-gentoo-developers-20250915

Description

Gentoo Authority Keys (GLEP 79)

Added to portage

2025-09-17

phonenumbers - 9.0.14
Ebuild name:

dev-python/phonenumbers-9.0.14

Description

Python port of Google's libphonenumber

Added to portage

2025-09-17

pymongo - 4.15.1
Ebuild name:

dev-python/pymongo-4.15.1

Description

Python driver for MongoDB

Added to portage

2025-09-17

pyopenssl - 25.3.0
Ebuild name:

dev-python/pyopenssl-25.3.0

Description

Python interface to the OpenSSL library

Added to portage

2025-09-17

pytest-lazy-fixtures - 1.4.0
Ebuild name:

dev-python/pytest-lazy-fixtures-1.4.0

Description

Allows you to use fixtures in @pytest.mark.parametrize

Added to portage

2025-09-17

pytest-mock - 3.15.1
Ebuild name:

dev-python/pytest-mock-3.15.1

Description

Thin-wrapper around the mock package for easier use with pytest

Added to portage

2025-09-17

qgpgme - 2.0.0-r2
Ebuild name:

dev-libs/qgpgme-2.0.0-r2

Description

GnuPG Made Easy is a library for making GnuPG easier to use (Qt bindings)

Added to portage

2025-09-17

rspamd - 3.13.0
Ebuild name:

mail-filter/rspamd-3.13.0

Description

Rapid spam filtering system

Added to portage

2025-09-17

subtitlecomposer - 0.8.2
Ebuild name:

media-video/subtitlecomposer-0.8.2

Description

Text-based subtitles editor

Added to portage

2025-09-17

sudo-rs - 0.2.8-r4
Ebuild name:

app-admin/sudo-rs-0.2.8-r4

Description

A memory safe implementation of sudo and su.

Added to portage

2025-09-17

thunderbird - 143.0
Ebuild name:

mail-client/thunderbird-143.0

Description

Thunderbird Mail Client

Added to portage

2025-09-17

thunderbird-bin - 143.0
Ebuild name:

mail-client/thunderbird-bin-143.0

Description

Thunderbird Mail Client

Added to portage

2025-09-17

tig - 2.6.0
Ebuild name:

dev-vcs/tig-2.6.0

Description

text mode interface for git

Added to portage

2025-09-17

wakeonlan - 0.42
Ebuild name:

net-misc/wakeonlan-0.42

Description

Client for Wake-On-LAN

Added to portage

2025-09-17

wiremix - 0.7.0
Ebuild name:

media-sound/wiremix-0.7.0

Description

A TUI mixer for PipeWire

Added to portage

2025-09-17

yash - 2.60
Ebuild name:

app-shells/yash-2.60

Description

Yash is a POSIX-compliant command line shell

Added to portage

2025-09-17

yubikey-manager - 5.8.0
Ebuild name:

app-crypt/yubikey-manager-5.8.0

Description

Python library and command line tool for configuring a YubiKey

Added to portage

2025-09-17

yubioath-flutter-bin - 7.1.1
Ebuild name:

app-crypt/yubioath-flutter-bin-7.1.1

Description

Yubico Authenticator for TOTP

Added to portage

2025-09-17

yubioath-flutter-bin - 7.2.3
Ebuild name:

app-crypt/yubioath-flutter-bin-7.2.3

Description

Yubico Authenticator for TOTP

Added to portage

2025-09-17

zoom - 6.6.0.4410
Ebuild name:

net-im/zoom-6.6.0.4410

Description

Video conferencing and web conferencing service

Added to portage

2025-09-17

zulucrypt - 7.0.0
Ebuild name:

app-crypt/zulucrypt-7.0.0

Description

Front end to cryptsetup

Added to portage

2025-09-17

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: 58.9 ms