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:

61760

userrating:

average rating: 1.5 (4 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: 2.4 (16 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
2022-08-13
chromium-bin - 104.0.5112.79
Ebuild name:

www-client/chromium-bin-104.0.5112.79

Description

Open-source version of Google Chrome web browser

Added to portage

2022-08-13

consul - 1.12.4
Ebuild name:

app-admin/consul-1.12.4

Description

A tool for service discovery, monitoring and configuration

Added to portage

2022-08-13

consul - 1.13.1
Ebuild name:

app-admin/consul-1.13.1

Description

A tool for service discovery, monitoring and configuration

Added to portage

2022-08-13

fennel-mode - 0.5.0
Ebuild name:

app-emacs/fennel-mode-0.5.0

Description

Emacs support for the Fennel programming language

Added to portage

2022-08-13

fzf - 0.32.1
Ebuild name:

app-shells/fzf-0.32.1

Description

General-purpose command-line fuzzy finder, written in Golang

Added to portage

2022-08-13

gnu-efi - 3.0.15
Ebuild name:

sys-boot/gnu-efi-3.0.15

Description

Library for build EFI Applications

Added to portage

2022-08-13

htpdate - 1.3.6
Ebuild name:

net-misc/htpdate-1.3.6

Description

Synchronize local workstation with time offered by remote webservers

Added to portage

2022-08-13

iproute2 - 5.19.0-r1
Ebuild name:

sys-apps/iproute2-5.19.0-r1

Description

kernel routing and traffic control utilities

Added to portage

2022-08-13

libjpeg-turbo - 2.1.4
Ebuild name:

media-libs/libjpeg-turbo-2.1.4

Description

MMX, SSE, and SSE2 SIMD accelerated JPEG library

Added to portage

2022-08-13

nfs-utils - 2.6.2
Ebuild name:

net-fs/nfs-utils-2.6.2

Description

NFS client and server daemons

Added to portage

2022-08-13

nlohmann_json - 3.11.2
Ebuild name:

dev-cpp/nlohmann_json-3.11.2

Description

JSON for Modern C++

Added to portage

2022-08-13

openpgp-keys-sergehallyn - 20220812
Ebuild name:

sec-keys/openpgp-keys-sergehallyn-20220812

Description

OpenPGP keys used by Serge Hallyn

Added to portage

2022-08-13

opentelemetry-cpp - 1.5.0
Ebuild name:

dev-cpp/opentelemetry-cpp-1.5.0

Description

The OpenTelemetry C++ Client

Added to portage

2022-08-13

podman - 4.2.0
Ebuild name:

app-containers/podman-4.2.0

Description

Library and podman tool for running OCI-based containers in Pods

Added to portage

2022-08-13

slang - 2.3.3
Ebuild name:

sys-libs/slang-2.3.3

Description

Multi-platform library designed to allow a developer to create robust software

Added to portage

2022-08-13

strace - 5.19
Ebuild name:

dev-util/strace-5.19

Description

A useful diagnostic, instructional, and debugging tool

Added to portage

2022-08-13

sysklogd - 2.4.3
Ebuild name:

app-admin/sysklogd-2.4.3

Description

Standard log daemons

Added to portage

2022-08-13

uwsgi_exporter - 1.1.0
Ebuild name:

app-metrics/uwsgi_exporter-1.1.0

Description

uWSGI metrics exporter for prometheus.io

Added to portage

2022-08-13

weggli - 0.2.4
Ebuild name:

app-misc/weggli-0.2.4

Description

a fast and robust semantic search tool for C and C++ codebases

Added to portage

2022-08-13

xz-utils - 5.2.6
Ebuild name:

app-arch/xz-utils-5.2.6

Description

Utils for managing LZMA compressed files

Added to portage

2022-08-13

2022-08-12
android-tools - 31.0.3_p2
Ebuild name:

dev-util/android-tools-31.0.3_p2

Description

Android platform tools (adb, fastboot, and mkbootimg)

Added to portage

2022-08-12

aspell-qu - 0.02.0-r1
Ebuild name:

app-dicts/aspell-qu-0.02.0-r1

Description

Added to portage

2022-08-12

aspell-ro - 3.3.10-r1
Ebuild name:

app-dicts/aspell-ro-3.3.10-r1

Description

Added to portage

2022-08-12

awscli - 1.25.50
Ebuild name:

app-admin/awscli-1.25.50

Description

Universal Command Line Environment for AWS

Added to portage

2022-08-12

balloonchase - 0.9.6-r2
Ebuild name:

games-arcade/balloonchase-0.9.6-r2

Description

Fly a hot air balloon and try to blow the other player out of th

Added to portage

2022-08-12

boto3 - 1.24.50
Ebuild name:

dev-python/boto3-1.24.50

Description

The AWS SDK for Python

Added to portage

2022-08-12

botocore - 1.27.50
Ebuild name:

dev-python/botocore-1.27.50

Description

Low-level, data-driven core of boto 3

Added to portage

2022-08-12

cfn-lint - 0.61.5
Ebuild name:

dev-python/cfn-lint-0.61.5

Description

CloudFormation Linter

Added to portage

2022-08-12

cliff - 4.0.0
Ebuild name:

dev-python/cliff-4.0.0

Description

Command Line Interface Formulation Framework

Added to portage

2022-08-12

cob - 0.9-r2
Ebuild name:

games-arcade/cob-0.9-r2

Description

Cruising on Broadway a painting-type game

Added to portage

2022-08-12

conveysdl - 1.3-r2
Ebuild name:

games-arcade/conveysdl-1.3-r2

Description

Guide the blob along the conveyer belt collecting the red blobs

Added to portage

2022-08-12

criticalmass - 1.0.2-r2
Ebuild name:

games-arcade/criticalmass-1.0.2-r2

Description

SDL/OpenGL space shoot'em up game

Added to portage

2022-08-12

defcon - 0.10.2
Ebuild name:

dev-python/defcon-0.10.2

Description

A set of UFO based objects for use in font editing applications

Added to portage

2022-08-12

dist-kernel - 5.10.136
Ebuild name:

virtual/dist-kernel-5.10.136

Description

Virtual to depend on any Distribution Kernel

Added to portage

2022-08-12

dist-kernel - 5.15.60
Ebuild name:

virtual/dist-kernel-5.15.60

Description

Virtual to depend on any Distribution Kernel

Added to portage

2022-08-12

dist-kernel - 5.18.17
Ebuild name:

virtual/dist-kernel-5.18.17

Description

Virtual to depend on any Distribution Kernel

Added to portage

2022-08-12

dist-kernel - 5.4.210
Ebuild name:

virtual/dist-kernel-5.4.210

Description

Virtual to depend on any Distribution Kernel

Added to portage

2022-08-12

dns-lexicon - 3.11.4
Ebuild name:

dev-python/dns-lexicon-3.11.4

Description

Manipulate DNS records on various DNS providers in a standardized/agn

Added to portage

2022-08-12

erofs-utils - 1.5
Ebuild name:

sys-fs/erofs-utils-1.5

Description

Userspace tools for EROFS

Added to portage

2022-08-12

gentoo-kernel - 5.10.136
Ebuild name:

sys-kernel/gentoo-kernel-5.10.136

Description

Linux kernel built with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel - 5.15.60
Ebuild name:

sys-kernel/gentoo-kernel-5.15.60

Description

Linux kernel built with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel - 5.18.17
Ebuild name:

sys-kernel/gentoo-kernel-5.18.17

Description

Linux kernel built with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel - 5.4.210
Ebuild name:

sys-kernel/gentoo-kernel-5.4.210

Description

Linux kernel built with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel-bin - 5.10.136
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.10.136

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel-bin - 5.15.60
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.15.60

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel-bin - 5.18.17
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.18.17

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2022-08-12

gentoo-kernel-bin - 5.4.210
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.4.210

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2022-08-12

git - 2.37.2
Ebuild name:

dev-vcs/git-2.37.2

Description

stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2022-08-12

gssapi - 1.8.0
Ebuild name:

dev-python/gssapi-1.8.0

Description

Low and high level wrappers around the GSSAPI C libraries

Added to portage

2022-08-12

help2man - 1.49.2
Ebuild name:

sys-apps/help2man-1.49.2

Description

GNU utility to convert program --help output to a man page

Added to portage

2022-08-12

hwinfo - 22.1
Ebuild name:

sys-apps/hwinfo-22.1

Description

Hardware detection tool used in SuSE Linux

Added to portage

2022-08-12

nbconvert - 6.5.3
Ebuild name:

dev-python/nbconvert-6.5.3

Description

Converting Jupyter Notebooks

Added to portage

2022-08-12

netdata - 1.36.0
Ebuild name:

net-analyzer/netdata-1.36.0

Description

Linux real time system monitoring, done right

Added to portage

2022-08-12

networkmanager - 1.38.4
Ebuild name:

net-misc/networkmanager-1.38.4

Description

A set of co-operative tools that make networking simple and straight

Added to portage

2022-08-12

partd - 1.3.0
Ebuild name:

dev-python/partd-1.3.0

Description

Appendable key-value storage

Added to portage

2022-08-12

plotly - 5.10.0
Ebuild name:

dev-python/plotly-5.10.0

Description

Browser-based graphing library for Python

Added to portage

2022-08-12

pydantic - 1.9.2
Ebuild name:

dev-python/pydantic-1.9.2

Description

Data parsing and validation using Python type hints

Added to portage

2022-08-12

pyside2 - 5.15.5
Ebuild name:

dev-python/pyside2-5.15.5

Description

Python bindings for the Qt framework

Added to portage

2022-08-12

pyside2-tools - 5.15.5
Ebuild name:

dev-python/pyside2-tools-5.15.5

Description

PySide development tools (pyside2-lupdate with support for Python)

Added to portage

2022-08-12

pyside6 - 6.3.1
Ebuild name:

dev-python/pyside6-6.3.1

Description

Python bindings for the Qt framework

Added to portage

2022-08-12

pyside6-tools - 6.3.1
Ebuild name:

dev-python/pyside6-tools-6.3.1

Description

PySide development tools (pyside6-lupdate with support for Python)

Added to portage

2022-08-12

python-sense-hat - 2.4.0
Ebuild name:

dev-python/python-sense-hat-2.4.0

Description

Raspberry Pi Sense HAT python library

Added to portage

2022-08-12

pytz - 2022.2
Ebuild name:

dev-python/pytz-2022.2

Description

World timezone definitions for Python

Added to portage

2022-08-12

pyzmq - 23.2.1
Ebuild name:

dev-python/pyzmq-23.2.1

Description

Lightweight and super-fast messaging library built on top of the ZeroMQ lib

Added to portage

2022-08-12

rsync - 3.2.5_pre2
Ebuild name:

net-misc/rsync-3.2.5_pre2

Description

File transfer program to keep remote files into sync

Added to portage

2022-08-12

saslprep - 1.1-r1
Ebuild name:

dev-java/saslprep-1.1-r1

Description

SASLprep Stringprep Profile for User Names and Passwords

Added to portage

2022-08-12

sentry-sdk - 1.9.4
Ebuild name:

dev-python/sentry-sdk-1.9.4

Description

Python client for Sentry

Added to portage

2022-08-12

setproctitle - 1.3.2
Ebuild name:

dev-python/setproctitle-1.3.2

Description

Allow customization of the process title

Added to portage

2022-08-12

shiboken2 - 5.15.5
Ebuild name:

dev-python/shiboken2-5.15.5

Description

Python binding generator for C++ libraries

Added to portage

2022-08-12

shiboken6 - 6.3.1
Ebuild name:

dev-python/shiboken6-6.3.1

Description

Python binding generator for C++ libraries

Added to portage

2022-08-12

smartdns - 37
Ebuild name:

net-dns/smartdns-37

Description

A local DNS server returns the fastest access results

Added to portage

2022-08-12

tor - 0.4.7.9
Ebuild name:

net-vpn/tor-0.4.7.9

Description

Anonymizing overlay network for TCP

Added to portage

2022-08-12

tumbler - 4.16.1
Ebuild name:

xfce-extra/tumbler-4.16.1

Description

A thumbnail service for Thunar

Added to portage

2022-08-12

uptimed - 0.4.6-r1
Ebuild name:

app-misc/uptimed-0.4.6-r1

Description

System uptime record daemon that keeps track of your highest uptimes

Added to portage

2022-08-12

vanilla-kernel - 5.10.136
Ebuild name:

sys-kernel/vanilla-kernel-5.10.136

Description

Linux kernel built from vanilla upstream sources

Added to portage

2022-08-12

vanilla-kernel - 5.15.60
Ebuild name:

sys-kernel/vanilla-kernel-5.15.60

Description

Linux kernel built from vanilla upstream sources

Added to portage

2022-08-12

vanilla-kernel - 5.18.17
Ebuild name:

sys-kernel/vanilla-kernel-5.18.17

Description

Linux kernel built from vanilla upstream sources

Added to portage

2022-08-12

vanilla-kernel - 5.4.210
Ebuild name:

sys-kernel/vanilla-kernel-5.4.210

Description

Linux kernel built from vanilla upstream sources

Added to portage

2022-08-12

varnish - 7.1.1
Ebuild name:

www-servers/varnish-7.1.1

Description

Varnish is a state-of-the-art, high-performance HTTP accelerator

Added to portage

2022-08-12

vivaldi - 5.4.2753.28
Ebuild name:

www-client/vivaldi-5.4.2753.28

Description

A browser for our friends

Added to portage

2022-08-12

vivaldi-snapshot - 5.4.2753.27
Ebuild name:

www-client/vivaldi-snapshot-5.4.2753.27

Description

A browser for our friends

Added to portage

2022-08-12

vivaldi-snapshot - 5.4.2763.3
Ebuild name:

www-client/vivaldi-snapshot-5.4.2763.3

Description

A browser for our friends

Added to portage

2022-08-12

vkd3d - 1.4
Ebuild name:

app-emulation/vkd3d-1.4

Description

D3D12 to Vulkan translation library

Added to portage

2022-08-12

xfce4-screenshooter - 1.9.11
Ebuild name:

xfce-extra/xfce4-screenshooter-1.9.11

Description

Xfce4 screenshooter application and panel plugin

Added to portage

2022-08-12

xmlschema - 2.0.2
Ebuild name:

dev-python/xmlschema-2.0.2

Description

An XML Schema validator and decoder

Added to portage

2022-08-12

xorg-proto - 2022.2
Ebuild name:

x11-base/xorg-proto-2022.2

Description

X.Org combined protocol headers

Added to portage

2022-08-12

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.5 ms