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:

85215

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-05-18
RyzenAdj - 0.19.0
Ebuild name:

sys-power/RyzenAdj-0.19.0

Description

The power management tool for mobile and desktop Ryzen APUs

Added to portage

2026-05-18

apparmor - 4.1.7
Ebuild name:

sys-apps/apparmor-4.1.7

Description

Userspace utils and init scripts for the AppArmor application security syst

Added to portage

2026-05-18

apparmor-profiles - 4.1.7
Ebuild name:

sec-policy/apparmor-profiles-4.1.7

Description

A collection of profiles for the AppArmor application security s

Added to portage

2026-05-18

apparmor-utils - 4.1.7
Ebuild name:

sys-apps/apparmor-utils-4.1.7

Description

Additional userspace utils to assist with AppArmor profile management

Added to portage

2026-05-18

bird - 2.17.3-r1
Ebuild name:

net-misc/bird-2.17.3-r1

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

bird - 2.17.4
Ebuild name:

net-misc/bird-2.17.4

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

bird - 2.18.1
Ebuild name:

net-misc/bird-2.18.1

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

bird - 3.1.5-r1
Ebuild name:

net-misc/bird-3.1.5-r1

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

bird - 3.1.6
Ebuild name:

net-misc/bird-3.1.6

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

bird - 3.2.1
Ebuild name:

net-misc/bird-3.2.1

Description

A routing daemon implementing OSPF, RIPv2 & BGP for IPv4 & IPv6

Added to portage

2026-05-18

boost - 1.91.0
Ebuild name:

dev-libs/boost-1.91.0

Description

Boost Libraries for C++

Added to portage

2026-05-18

clog - 1.3.0-r2
Ebuild name:

app-admin/clog-1.3.0-r2

Description

Colorized log tail utility

Added to portage

2026-05-18

dbus-fast - 4.2.8
Ebuild name:

dev-python/dbus-fast-4.2.8

Description

A faster version of dbus-next

Added to portage

2026-05-18

dbus-fast - 4.3.0
Ebuild name:

dev-python/dbus-fast-4.3.0

Description

A faster version of dbus-next

Added to portage

2026-05-18

dist-kernel - 5.15.207_p1
Ebuild name:

virtual/dist-kernel-5.15.207_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-18

dist-kernel - 6.1.173_p1
Ebuild name:

virtual/dist-kernel-6.1.173_p1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-18

dist-kernel - 6.12.90
Ebuild name:

virtual/dist-kernel-6.12.90

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-18

dist-kernel - 6.18.32
Ebuild name:

virtual/dist-kernel-6.18.32

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-18

dist-kernel - 7.0.9
Ebuild name:

virtual/dist-kernel-7.0.9

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-05-18

facter - 4.10.0-r1
Ebuild name:

dev-ruby/facter-4.10.0-r1

Description

A cross-platform ruby library for retrieving facts from operating systems

Added to portage

2026-05-18

gcc - 17.0.0_p20260517
Ebuild name:

sys-devel/gcc-17.0.0_p20260517

Description

The GNU Compiler Collection

Added to portage

2026-05-18

gentoo-kernel - 5.15.207_p1
Ebuild name:

sys-kernel/gentoo-kernel-5.15.207_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel - 6.1.173_p1
Ebuild name:

sys-kernel/gentoo-kernel-6.1.173_p1

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel - 6.12.90
Ebuild name:

sys-kernel/gentoo-kernel-6.12.90

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel - 6.18.32
Ebuild name:

sys-kernel/gentoo-kernel-6.18.32

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel - 7.0.9
Ebuild name:

sys-kernel/gentoo-kernel-7.0.9

Description

Linux kernel built with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel-bin - 5.15.207_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.15.207_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel-bin - 6.1.173_p1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.173_p1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel-bin - 6.12.90
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.90

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel-bin - 6.18.32
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.32

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-18

gentoo-kernel-bin - 7.0.9
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.0.9

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-05-18

gentoo-sources - 6.12.90
Ebuild name:

sys-kernel/gentoo-sources-6.12.90

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-18

gentoo-sources - 6.18.32
Ebuild name:

sys-kernel/gentoo-sources-6.18.32

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-18

gentoo-sources - 6.6.140
Ebuild name:

sys-kernel/gentoo-sources-6.6.140

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-18

gentoo-sources - 7.0.9
Ebuild name:

sys-kernel/gentoo-sources-7.0.9

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-05-18

git-sources - 7.1_rc4
Ebuild name:

sys-kernel/git-sources-7.1_rc4

Description

The very latest -git version of the Linux kernel

Added to portage

2026-05-18

hd-idle - 1.05-r5
Ebuild name:

sys-apps/hd-idle-1.05-r5

Description

Utility for spinning down hard disks after a period of idle time

Added to portage

2026-05-18

json-schema - 5.2.2
Ebuild name:

dev-ruby/json-schema-5.2.2

Description

Ruby JSON Schema Validator

Added to portage

2026-05-18

libapparmor - 4.1.7
Ebuild name:

sys-libs/libapparmor-4.1.7

Description

Library to support AppArmor userspace utilities

Added to portage

2026-05-18

libfido2 - 1.17.0
Ebuild name:

dev-libs/libfido2-1.17.0

Description

Provides library functionality for FIDO 2.0

Added to portage

2026-05-18

mirrorselect - 2.6.4
Ebuild name:

app-portage/mirrorselect-2.6.4

Description

Tool to help select distfiles mirrors for Gentoo

Added to portage

2026-05-18

openfact - 5.6.1
Ebuild name:

dev-ruby/openfact-5.6.1

Description

OpenFact, a system inventory tool (community implementation of Facter)

Added to portage

2026-05-18

openvox - 8.27.0
Ebuild name:

app-admin/openvox-8.27.0

Description

OpenVox agent and apply tools for Puppet-compatible configuration manageme

Added to portage

2026-05-18

rpi-eeprom - 28.17_p1
Ebuild name:

dev-embedded/rpi-eeprom-28.17_p1

Description

Updater for Raspberry Pi 4/5 bootloader and the VL805 USB controll

Added to portage

2026-05-18

scanf - 1.0.0
Ebuild name:

dev-ruby/scanf-1.0.0

Description

Ruby implementation of the C function scanf(3)

Added to portage

2026-05-18

vanilla-kernel - 6.12.90
Ebuild name:

sys-kernel/vanilla-kernel-6.12.90

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-18

vanilla-kernel - 6.18.32
Ebuild name:

sys-kernel/vanilla-kernel-6.18.32

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-18

vanilla-kernel - 7.0.9
Ebuild name:

sys-kernel/vanilla-kernel-7.0.9

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-18

zedis - 0.4.0
Ebuild name:

dev-db/zedis-0.4.0

Description

Blazing-fast native Redis GUI built with Rust and GPUI

Added to portage

2026-05-18

zynaddsubfx - 3.0.6-r8
Ebuild name:

media-sound/zynaddsubfx-3.0.6-r8

Description

Software synthesizer capable of making a countless number of instr

Added to portage

2026-05-18

2026-05-17
atril - 1.28.4
Ebuild name:

app-text/atril-1.28.4

Description

Atril document viewer for MATE

Added to portage

2026-05-17

black - 26.5.0
Ebuild name:

dev-python/black-26.5.0

Description

The uncompromising Python code formatter

Added to portage

2026-05-17

cachetools - 7.1.2
Ebuild name:

dev-python/cachetools-7.1.2

Description

Extensible memoizing collections and decorators

Added to portage

2026-05-17

cherrytree - 1.6.3
Ebuild name:

app-text/cherrytree-1.6.3

Description

A hierarchical note taking application (C++ version)

Added to portage

2026-05-17

cholmod - 5.3.4-r1
Ebuild name:

sci-libs/cholmod-5.3.4-r1

Description

Sparse Cholesky factorization and update/downdate library

Added to portage

2026-05-17

cli-helpers - 2.15.0
Ebuild name:

dev-python/cli-helpers-2.15.0

Description

Python helpers for common CLI tasks

Added to portage

2026-05-17

cmark - 0.31.2
Ebuild name:

app-text/cmark-0.31.2

Description

CommonMark parsing and rendering library and program in C

Added to portage

2026-05-17

corrosion - 0.6.1-r1
Ebuild name:

dev-build/corrosion-0.6.1-r1

Description

Marrying Rust and CMake - Easy Rust and C/C++ Integration

Added to portage

2026-05-17

dbus-fast - 4.2.7
Ebuild name:

dev-python/dbus-fast-4.2.7

Description

A faster version of dbus-next

Added to portage

2026-05-17

dynamips - 0.2.24
Ebuild name:

app-emulation/dynamips-0.2.24

Description

Cisco 7200/3600 Simulator

Added to portage

2026-05-17

fetchmail - 6.6.4
Ebuild name:

net-mail/fetchmail-6.6.4

Description

the legendary remote-mail retrieval and forwarding utility

Added to portage

2026-05-17

gcc - 16.1.1_p20260516
Ebuild name:

sys-devel/gcc-16.1.1_p20260516

Description

The GNU Compiler Collection

Added to portage

2026-05-17

heroic-bin - 2.22.0
Ebuild name:

games-util/heroic-bin-2.22.0

Description

GOG and Epic Games Launcher for Linux

Added to portage

2026-05-17

intellij-idea - 2026.1.2
Ebuild name:

dev-util/intellij-idea-2026.1.2

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-05-17

iterable-io - 1.0.4
Ebuild name:

dev-python/iterable-io-1.0.4

Description

Adapt generators and other iterables to a file-like interface

Added to portage

2026-05-17

libei - 1.6.0
Ebuild name:

dev-libs/libei-1.6.0

Description

Library for Emulated Input, primarily aimed at the Wayland stack

Added to portage

2026-05-17

libinput - 1.31.2
Ebuild name:

dev-libs/libinput-1.31.2

Description

Library to handle input devices in Wayland

Added to portage

2026-05-17

libusb1 - 3.4.0
Ebuild name:

dev-python/libusb1-3.4.0

Description

Python ctype-based wrapper around libusb1

Added to portage

2026-05-17

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

media-libs/libva-intel-media-driver-26.2.0

Description

Intel Media Driver for VA-API (iHD)

Added to portage

2026-05-17

master-pdf-editor - 5.9.98-r1
Ebuild name:

app-text/master-pdf-editor-5.9.98-r1

Description

A complete solution for viewing and editing PDF files

Added to portage

2026-05-17

mgorny-dev-scripts - 73
Ebuild name:

app-portage/mgorny-dev-scripts-73

Description

Handy scripts for ebuild development and more

Added to portage

2026-05-17

narwhals - 2.21.2
Ebuild name:

dev-python/narwhals-2.21.2

Description

Extremely lightweight compatibility layer between dataframe libraries

Added to portage

2026-05-17

nct6687d - 0_pre20260313
Ebuild name:

sys-power/nct6687d-0_pre20260313

Description

Kernel module for the Nuvoton NCT6687-R

Added to portage

2026-05-17

nct6687d - 9999
Ebuild name:

sys-power/nct6687d-9999

Description

Kernel module for the Nuvoton NCT6687-R

Added to portage

2026-05-17

nmap - 7.99
Ebuild name:

net-analyzer/nmap-7.99

Description

Network exploration tool and security / port scanner

Added to portage

2026-05-17

prismlauncher - 11.0.2
Ebuild name:

games-action/prismlauncher-11.0.2

Description

Custom, open source Minecraft launcher

Added to portage

2026-05-17

suitesparseconfig - 7.12.2-r1
Ebuild name:

sci-libs/suitesparseconfig-7.12.2-r1

Description

Common configurations for all packages in suitesparse

Added to portage

2026-05-17

teamspeak-client - 6.0.0_beta4
Ebuild name:

media-sound/teamspeak-client-6.0.0_beta4

Description

A client software for quality voice communication via the

Added to portage

2026-05-17

tvheadend - 4.3_p20260516
Ebuild name:

media-tv/tvheadend-4.3_p20260516

Description

Tvheadend is a TV streaming server and digital video recorder

Added to portage

2026-05-17

uhd - 4.9.0.1-r1
Ebuild name:

net-wireless/uhd-4.9.0.1-r1

Description

Universal Software Radio Peripheral (USRP) Hardware Driver

Added to portage

2026-05-17

vanilla-kernel - 6.18.9999
Ebuild name:

sys-kernel/vanilla-kernel-6.18.9999

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-05-17

vanilla-sources - 6.12.90
Ebuild name:

sys-kernel/vanilla-sources-6.12.90

Description

Full sources for the Linux kernel

Added to portage

2026-05-17

vanilla-sources - 6.18.32
Ebuild name:

sys-kernel/vanilla-sources-6.18.32

Description

Full sources for the Linux kernel

Added to portage

2026-05-17

vanilla-sources - 6.6.140
Ebuild name:

sys-kernel/vanilla-sources-6.6.140

Description

Full sources for the Linux kernel

Added to portage

2026-05-17

vanilla-sources - 7.0.9
Ebuild name:

sys-kernel/vanilla-sources-7.0.9

Description

Full sources for the Linux kernel

Added to portage

2026-05-17

vlc - 3.0.23-r1
Ebuild name:

media-video/vlc-3.0.23-r1

Description

Media player and framework with support for most multimedia files and str

Added to portage

2026-05-17

webkit-gtk - 2.52.3-r411
Ebuild name:

net-libs/webkit-gtk-2.52.3-r411

Description

Open source web browser engine

Added to portage

2026-05-17

webkit-gtk - 2.52.3-r601
Ebuild name:

net-libs/webkit-gtk-2.52.3-r601

Description

Open source web browser engine

Added to portage

2026-05-17

zeroconf - 0.149.3
Ebuild name:

dev-python/zeroconf-0.149.3

Description

Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi comp

Added to portage

2026-05-17

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