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:

82213

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-29
ansible - 12.2.0
Ebuild name:

app-admin/ansible-12.2.0

Description

Model-driven deployment, config management, and command execution framewor

Added to portage

2025-11-29

ansible - 13.0.0
Ebuild name:

app-admin/ansible-13.0.0

Description

Model-driven deployment, config management, and command execution framewor

Added to portage

2025-11-29

ansible-core - 2.20.0
Ebuild name:

app-admin/ansible-core-2.20.0

Description

Model-driven deployment, config management, and command execution fra

Added to portage

2025-11-29

autoconf - 2.72-r5
Ebuild name:

dev-build/autoconf-2.72-r5

Description

Used to create autoconfiguration files

Added to portage

2025-11-29

dropbox - 237.4.5655
Ebuild name:

net-misc/dropbox-237.4.5655

Description

Dropbox daemon (pretends to be GUI-less)

Added to portage

2025-11-29

ell - 0.81
Ebuild name:

dev-libs/ell-0.81

Description

Embedded Linux Library provides core, low-level functionality for system daemons

Added to portage

2025-11-29

fotocx - 25.5
Ebuild name:

media-gfx/fotocx-25.5

Description

Program for improving image files made with a digital camera

Added to portage

2025-11-29

libtsm - 4.3.0
Ebuild name:

dev-libs/libtsm-4.3.0

Description

Terminal Emulator State Machine

Added to portage

2025-11-29

marksman - 2025.11.25
Ebuild name:

dev-util/marksman-2025.11.25

Description

LSP language server for editing Markdown files

Added to portage

2025-11-29

memtest86+ - 8.00
Ebuild name:

sys-apps/memtest86+-8.00

Description

Memory tester based on PCMemTest

Added to portage

2025-11-29

nginx - 1.28.0-r4
Ebuild name:

www-servers/nginx-1.28.0-r4

Description

Added to portage

2025-11-29

nginx - 1.29.3-r2
Ebuild name:

www-servers/nginx-1.29.3-r2

Description

Added to portage

2025-11-29

2025-11-28
blender - 4.2.16
Ebuild name:

media-gfx/blender-4.2.16

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender - 4.5.5
Ebuild name:

media-gfx/blender-4.5.5

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender - 4.5.9999
Ebuild name:

media-gfx/blender-4.5.9999

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender - 5.0.0
Ebuild name:

media-gfx/blender-5.0.0

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender - 5.0.9999
Ebuild name:

media-gfx/blender-5.0.9999

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender-bin - 3.6.23
Ebuild name:

media-gfx/blender-bin-3.6.23

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender-bin - 4.2.16
Ebuild name:

media-gfx/blender-bin-4.2.16

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender-bin - 4.5.5
Ebuild name:

media-gfx/blender-bin-4.5.5

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

blender-bin - 5.0.0
Ebuild name:

media-gfx/blender-bin-5.0.0

Description

3D Creation/Animation/Publishing System

Added to portage

2025-11-28

boehm-gc - 8.2.10
Ebuild name:

dev-libs/boehm-gc-8.2.10

Description

The Boehm-Demers-Weiser conservative garbage collector

Added to portage

2025-11-28

ccache - 4.12.2
Ebuild name:

dev-util/ccache-4.12.2

Description

Fast compiler cache

Added to portage

2025-11-28

chrome-binary-plugins - 143.0.7499.40_beta
Ebuild name:

www-plugins/chrome-binary-plugins-143.0.7499.40_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2025-11-28

chrome-binary-plugins - 144.0.7534.0_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-144.0.7534.0_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2025-11-28

clang - 22.0.0_pre20251127
Ebuild name:

dev-python/clang-22.0.0_pre20251127

Description

Python bindings for llvm-core/clang

Added to portage

2025-11-28

clang - 22.0.0_pre20251127
Ebuild name:

llvm-core/clang-22.0.0_pre20251127

Description

C language family frontend for LLVM

Added to portage

2025-11-28

clang-common - 22.0.0_pre20251127
Ebuild name:

llvm-core/clang-common-22.0.0_pre20251127

Description

Common files shared between multiple slots of clang

Added to portage

2025-11-28

claws-mail - 4.3.1-r2
Ebuild name:

mail-client/claws-mail-4.3.1-r2

Description

An email client (and news reader) based on GTK+

Added to portage

2025-11-28

compiler-rt - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/compiler-rt-22.0.0_pre20251127

Description

Compiler runtime library for clang (built-in part)

Added to portage

2025-11-28

compiler-rt-sanitizers - 22.0.0_pre20251127
Ebuild name:

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

Description

Compiler runtime libraries for clang (sanit

Added to portage

2025-11-28

cpupower - 6.16-r1
Ebuild name:

sys-power/cpupower-6.16-r1

Description

Shows and sets processor power related values

Added to portage

2025-11-28

edbrowse - 3.8.15
Ebuild name:

app-accessibility/edbrowse-3.8.15

Description

Combination editor, browser, and mail client that is 100% text ba

Added to portage

2025-11-28

flang - 22.0.0_pre20251127
Ebuild name:

llvm-core/flang-22.0.0_pre20251127

Description

LLVM's Fortran frontend

Added to portage

2025-11-28

flang-rt - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/flang-rt-22.0.0_pre20251127

Description

LLVM's Fortran runtime

Added to portage

2025-11-28

gitlab-runner - 18.6.2
Ebuild name:

dev-util/gitlab-runner-18.6.2

Description

The official GitLab Runner, written in Go

Added to portage

2025-11-28

gmpy2 - 2.2.2
Ebuild name:

dev-python/gmpy2-2.2.2

Description

Python bindings for GMP, MPC, MPFR and MPIR libraries

Added to portage

2025-11-28

google-chrome-beta - 143.0.7499.40
Ebuild name:

www-client/google-chrome-beta-143.0.7499.40

Description

The web browser from Google

Added to portage

2025-11-28

google-chrome-unstable - 144.0.7534.0
Ebuild name:

www-client/google-chrome-unstable-144.0.7534.0

Description

The web browser from Google

Added to portage

2025-11-28

google-protobuf - 4.33.1
Ebuild name:

dev-ruby/google-protobuf-4.33.1

Description

Protocol Buffers are Google's data interchange format

Added to portage

2025-11-28

gr - 0.73.6-r1
Ebuild name:

sci-visualization/gr-0.73.6-r1

Description

Universal framework for cross-platform visualization applications

Added to portage

2025-11-28

guildmaster - 0_pre20251122
Ebuild name:

dev-build/guildmaster-0_pre20251122

Description

FIFO-like jobserver node via CUSE

Added to portage

2025-11-28

guildmaster - 9999
Ebuild name:

dev-build/guildmaster-9999

Description

FIFO-like jobserver node via CUSE

Added to portage

2025-11-28

hip - 6.4.3-r2
Ebuild name:

dev-util/hip-6.4.3-r2

Description

C++ Heterogeneous-Compute Interface for Portability

Added to portage

2025-11-28

hip - 7.0.2-r1
Ebuild name:

dev-util/hip-7.0.2-r1

Description

C++ Heterogeneous-Compute Interface for Portability

Added to portage

2025-11-28

hip - 7.1.0-r1
Ebuild name:

dev-util/hip-7.1.0-r1

Description

C++ Heterogeneous-Compute Interface for Portability

Added to portage

2025-11-28

hypothesis - 6.148.3
Ebuild name:

dev-python/hypothesis-6.148.3

Description

A library for property based testing

Added to portage

2025-11-28

imv - 5.0.1
Ebuild name:

media-gfx/imv-5.0.1

Description

Minimal image viewer designed for tiling window manager users

Added to portage

2025-11-28

libclc - 22.0.0_pre20251127
Ebuild name:

llvm-core/libclc-22.0.0_pre20251127

Description

OpenCL C library

Added to portage

2025-11-28

libcxx - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libcxx-22.0.0_pre20251127

Description

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

Added to portage

2025-11-28

libcxxabi - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libcxxabi-22.0.0_pre20251127

Description

Low level support for a standard C++ library

Added to portage

2025-11-28

libgcc - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libgcc-22.0.0_pre20251127

Description

Compiler runtime library for clang, compatible with libgcc_

Added to portage

2025-11-28

libunwind - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/libunwind-22.0.0_pre20251127

Description

C++ runtime stack unwinder from LLVM

Added to portage

2025-11-28

lit - 22.0.0_pre20251127
Ebuild name:

dev-python/lit-22.0.0_pre20251127

Description

A stand-alone install of the LLVM suite testing tool

Added to portage

2025-11-28

lld - 22.0.0_pre20251127
Ebuild name:

llvm-core/lld-22.0.0_pre20251127

Description

The LLVM linker (link editor)

Added to portage

2025-11-28

lldb - 22.0.0_pre20251127
Ebuild name:

llvm-core/lldb-22.0.0_pre20251127

Description

The LLVM debugger

Added to portage

2025-11-28

llvm - 22.0.0_pre20251127
Ebuild name:

dev-ml/llvm-22.0.0_pre20251127

Description

OCaml bindings for LLVM

Added to portage

2025-11-28

llvm - 22.0.0_pre20251127
Ebuild name:

llvm-core/llvm-22.0.0_pre20251127

Description

Low Level Virtual Machine

Added to portage

2025-11-28

llvm-common - 22.0.0_pre20251127
Ebuild name:

llvm-core/llvm-common-22.0.0_pre20251127

Description

Common files shared between multiple slots of LLVM

Added to portage

2025-11-28

logbook - 1.9.2
Ebuild name:

dev-python/logbook-1.9.2

Description

A logging replacement for Python

Added to portage

2025-11-28

maildrop - 3.2.1-r1
Ebuild name:

mail-filter/maildrop-3.2.1-r1

Description

Mail delivery agent/filter

Added to portage

2025-11-28

microsoft-edge - 142.0.3595.94
Ebuild name:

www-client/microsoft-edge-142.0.3595.94

Description

The web browser from Microsoft

Added to portage

2025-11-28

microsoft-edge-beta - 143.0.3650.37
Ebuild name:

www-client/microsoft-edge-beta-143.0.3650.37

Description

The web browser from Microsoft

Added to portage

2025-11-28

microsoft-edge-beta - 143.0.3650.46
Ebuild name:

www-client/microsoft-edge-beta-143.0.3650.46

Description

The web browser from Microsoft

Added to portage

2025-11-28

microsoft-edge-dev - 144.0.3677.0
Ebuild name:

www-client/microsoft-edge-dev-144.0.3677.0

Description

The web browser from Microsoft

Added to portage

2025-11-28

miopen - 7.1.0-r1
Ebuild name:

sci-libs/miopen-7.1.0-r1

Description

AMD's Machine Intelligence Library

Added to portage

2025-11-28

mkdocstrings - 1.0.0
Ebuild name:

dev-python/mkdocstrings-1.0.0

Description

Automatic documentation from sources, for MkDocs

Added to portage

2025-11-28

mkdocstrings-python - 2.0.0
Ebuild name:

dev-python/mkdocstrings-python-2.0.0

Description

Python handler for dev-python/mkdocstrings

Added to portage

2025-11-28

mlir - 22.0.0_pre20251127
Ebuild name:

llvm-core/mlir-22.0.0_pre20251127

Description

Multi-Level Intermediate Representation (library only)

Added to portage

2025-11-28

offload - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/offload-22.0.0_pre20251127

Description

OpenMP offloading support

Added to portage

2025-11-28

openexr - 3.3.5
Ebuild name:

media-libs/openexr-3.3.5

Description

ILM's OpenEXR high dynamic-range image file format libraries

Added to portage

2025-11-28

openexr - 3.4.4
Ebuild name:

media-libs/openexr-3.4.4

Description

ILM's OpenEXR high dynamic-range image file format libraries

Added to portage

2025-11-28

openimageio - 2.5.19.1
Ebuild name:

media-libs/openimageio-2.5.19.1

Description

A library for reading and writing images

Added to portage

2025-11-28

openimageio - 3.0.11.0
Ebuild name:

media-libs/openimageio-3.0.11.0

Description

A library for reading and writing images

Added to portage

2025-11-28

openimageio - 3.1.7.0-r1
Ebuild name:

media-libs/openimageio-3.1.7.0-r1

Description

A library for reading and writing images

Added to portage

2025-11-28

openimageio - 9999
Ebuild name:

media-libs/openimageio-9999

Description

A library for reading and writing images

Added to portage

2025-11-28

openmp - 22.0.0_pre20251127
Ebuild name:

llvm-runtimes/openmp-22.0.0_pre20251127

Description

OpenMP runtime library for LLVM/clang compiler

Added to portage

2025-11-28

opera - 124.0.5705.65
Ebuild name:

www-client/opera-124.0.5705.65

Description

A fast and secure web browser

Added to portage

2025-11-28

opera-beta - 124.0.5705.51
Ebuild name:

www-client/opera-beta-124.0.5705.51

Description

A fast and secure web browser

Added to portage

2025-11-28

opera-developer - 125.0.5727.1
Ebuild name:

www-client/opera-developer-125.0.5727.1

Description

A fast and secure web browser

Added to portage

2025-11-28

osl - 1.14.7.0
Ebuild name:

media-libs/osl-1.14.7.0

Description

Advanced shading language for production GI renderers

Added to portage

2025-11-28

osl - 1.14.9999
Ebuild name:

media-libs/osl-1.14.9999

Description

Advanced shading language for production GI renderers

Added to portage

2025-11-28

polly - 22.0.0_pre20251127
Ebuild name:

llvm-core/polly-22.0.0_pre20251127

Description

Polyhedral optimizations for LLVM

Added to portage

2025-11-28

protobuf - 33.1
Ebuild name:

dev-libs/protobuf-33.1

Description

Google's Protocol Buffers - Extensible mechanism for serializing structured

Added to portage

2025-11-28

qgis - 3.44.5
Ebuild name:

sci-geosciences/qgis-3.44.5

Description

User friendly Geographic Information System

Added to portage

2025-11-28

qutebrowser - 3.6.2
Ebuild name:

www-client/qutebrowser-3.6.2

Description

Keyboard-driven, vim-like browser based on Python and Qt

Added to portage

2025-11-28

rasdaemon - 0.8.4
Ebuild name:

app-admin/rasdaemon-0.8.4

Description

Reliability, Availability and Serviceability logging tool

Added to portage

2025-11-28

rocm_bandwidth_test - 7.1.0-r2
Ebuild name:

dev-util/rocm_bandwidth_test-7.1.0-r2

Description

Bandwidth test for ROCm

Added to portage

2025-11-28

sonata - 1.7.2
Ebuild name:

media-sound/sonata-1.7.2

Description

Elegant GTK+ music client for the Music Player Daemon (MPD)

Added to portage

2025-11-28

sphinx - 9.0.0_rc1
Ebuild name:

dev-python/sphinx-9.0.0_rc1

Description

Python documentation generator

Added to portage

2025-11-28

steve - 1.0.2
Ebuild name:

dev-build/steve-1.0.2

Description

A simple jobserver for Gentoo

Added to portage

2025-11-28

swaylock - 1.8.4
Ebuild name:

gui-apps/swaylock-1.8.4

Description

Screen locker for Wayland

Added to portage

2025-11-28

types-psutil - 7.1.3.20251127
Ebuild name:

dev-python/types-psutil-7.1.3.20251127

Description

Typing stubs for psutil

Added to portage

2025-11-28

xdotool - 3.20211022.1-r2
Ebuild name:

x11-misc/xdotool-3.20211022.1-r2

Description

Simulate keyboard input and mouse activity, move and resize window

Added to portage

2025-11-28

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