<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de-x-formal">
	<id>http://wiki.frank-wulf.de/index.php?action=history&amp;feed=atom&amp;title=Access_from_Internet_with_dedicated_IP_address</id>
	<title>Access from Internet with dedicated IP address - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.frank-wulf.de/index.php?action=history&amp;feed=atom&amp;title=Access_from_Internet_with_dedicated_IP_address"/>
	<link rel="alternate" type="text/html" href="http://wiki.frank-wulf.de/index.php?title=Access_from_Internet_with_dedicated_IP_address&amp;action=history"/>
	<updated>2026-05-13T14:27:49Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in wiki.frank-wulf.de</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>http://wiki.frank-wulf.de/index.php?title=Access_from_Internet_with_dedicated_IP_address&amp;diff=672&amp;oldid=prev</id>
		<title>Wulf: Die Seite wurde neu angelegt: „=== Description === This solution requires renting a VPS server which comes with a static public IP address, costs are starting at 1 Euro per month (in 2024 at ionos.de or strato.de). As this server is used only to forward data from the internet to the local server and back to the internet, the cheapest offer will most likely be sufficient. The local server will be connected to the VPS server using a VPN tunnel. All traffic aiming the public IP address of…“</title>
		<link rel="alternate" type="text/html" href="http://wiki.frank-wulf.de/index.php?title=Access_from_Internet_with_dedicated_IP_address&amp;diff=672&amp;oldid=prev"/>
		<updated>2025-09-14T07:31:39Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „=== Description === This solution requires renting a VPS server which comes with a static public IP address, costs are starting at 1 Euro per month (in 2024 at ionos.de or strato.de). As this server is used only to forward data from the internet to the local server and back to the internet, the cheapest offer will most likely be sufficient. The local server will be connected to the VPS server using a VPN tunnel. All traffic aiming the public IP address of…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Description ===&lt;br /&gt;
This solution requires renting a VPS server which comes with a static public IP address, costs are starting at 1 Euro per month (in 2024 at ionos.de or strato.de). As this server is used only to forward data from the internet to the local server and back to the internet, the cheapest offer will most likely be sufficient. The local server will be connected to the VPS server using a VPN tunnel. All traffic aiming the public IP address of the VPS server is then being forwarded to the local server through this tunnel. Results from the local server are sent back through the tunnel to the VPS server and from there to the respective sender.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;&amp;lt;big&amp;gt;Internet&amp;lt;/big&amp;gt; &amp;lt;―――――(Public IP 85.215.213.68)―――――&amp;gt; &amp;lt;big&amp;gt;VPS server&amp;lt;/big&amp;gt; &amp;lt;―――――(VPN tunnel 192.168.142.x)―――――&amp;gt; &amp;lt;big&amp;gt;Local server&amp;lt;/big&amp;gt;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Basically the VPN connection is triggered automatically by the client (local server). Hence the local server is permanently accessable from the internet. Security settings are maintained in the local network like fail2ban and firewall rules to protect the local server against external attacks.&lt;br /&gt;
&lt;br /&gt;
=== Terminology ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
|! style=&amp;quot;text-align:center; font-weight:bold; background-color:Moccasin&amp;quot;| Term&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Moccasin&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
|VPS Server&lt;br /&gt;
|Virtual Private Server with a static public IP address assigned&lt;br /&gt;
|-&lt;br /&gt;
|Local Server&lt;br /&gt;
|Server in local network (192.168.141.1)&lt;br /&gt;
|-&lt;br /&gt;
|IP subnet for local network&lt;br /&gt;
|192.168.141.0/24&lt;br /&gt;
|-&lt;br /&gt;
|IP subnet for VPN tunnel&lt;br /&gt;
|192.168.142.1/32 (VPS server)&lt;br /&gt;
192.168.142.100/32 (local server)&lt;br /&gt;
|-&lt;br /&gt;
|Static public IP address&lt;br /&gt;
|85.215.213.68&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;big&amp;gt;Configuration&amp;lt;/big&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Wireguard VPN tunnel maintain the firewall rules on the VPS server to open port 51820 for incoming UDP traffic:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Cornsilk&amp;quot;| Action&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Cornsilk&amp;quot;| Allowed IP&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Cornsilk&amp;quot;| Protocol&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Cornsilk&amp;quot;| Port(s)&lt;br /&gt;
! style=&amp;quot;text-align:center; font-weight:bold; background-color:Cornsilk&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
|Allow&lt;br /&gt;
|All&lt;br /&gt;
|TCP&lt;br /&gt;
|22&lt;br /&gt;
|&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|Allow&lt;br /&gt;
|All&lt;br /&gt;
|TCP&lt;br /&gt;
|80&lt;br /&gt;
|&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|Allow&lt;br /&gt;
|All&lt;br /&gt;
|TCP&lt;br /&gt;
|443&lt;br /&gt;
|&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|Allow&lt;br /&gt;
|All&lt;br /&gt;
|TCP&lt;br /&gt;
|8443&lt;br /&gt;
|&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|Allow&lt;br /&gt;
|All&lt;br /&gt;
|TCP&lt;br /&gt;
|8447&lt;br /&gt;
|&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Allow&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;All&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;UDP&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;51820&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Wireguard&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable packet forwarding for IPv4 in file &amp;#039;&amp;#039;&amp;#039;/etc/sysctl.conf&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: silver; background: black;&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Uncomment the next line to enable packet forwarding for IPv4&lt;br /&gt;
net.ipv4.ip_forward=1&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable the changes made in &amp;#039;&amp;#039;&amp;#039;/etc/sysctl.conf&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sysctl -p&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install Wireguard VPN software on both VPS server and local server:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apt install wireguard&lt;br /&gt;
mkdir --mode=700 /etc/wireguard&lt;br /&gt;
chown root:root /etc/wireguard&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate server key pair on both VPS server and local server:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /etc/wireguard&lt;br /&gt;
umask 077; wg genkey | tee privatekey | wg pubkey &amp;gt; publickey&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create config file &amp;#039;&amp;#039;&amp;#039;/etc/wireguard/wg0.conf&amp;#039;&amp;#039;&amp;#039; on VPS server:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: silver; background: black;&amp;quot;&amp;gt;&lt;br /&gt;
[Interface]&lt;br /&gt;
PrivateKey = &amp;lt;Private key from VPS server&amp;gt;&lt;br /&gt;
ListenPort = 51820&lt;br /&gt;
Address = 192.168.142.1/24&lt;br /&gt;
PostUp = iptables -t nat -A PREROUTING -p tcp -d 85.215.213.68 -j DNAT --to 192.168.142.100&lt;br /&gt;
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens6 -j MASQUERADE&lt;br /&gt;
PostDown = iptables -t nat -D PREROUTING -p tcp -d 85.215.213.68 -j DNAT --to 192.168.142.100&lt;br /&gt;
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens6 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
[Peer]&lt;br /&gt;
PublicKey = &amp;lt;Public key from local server&amp;gt;&lt;br /&gt;
AllowedIPs = 192.168.142.100/32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create config file &amp;#039;&amp;#039;&amp;#039;/etc/wireguard/wg0.conf&amp;#039;&amp;#039;&amp;#039; on local server:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: silver; background: black;&amp;quot;&amp;gt;&lt;br /&gt;
[Interface]&lt;br /&gt;
PrivateKey = &amp;lt;Private key from local server&amp;gt;&lt;br /&gt;
Address = 192.168.142.100/24&lt;br /&gt;
&lt;br /&gt;
[Peer]&lt;br /&gt;
PublicKey = &amp;lt;Public key from VPS server&amp;gt;&lt;br /&gt;
AllowedIPs = 0.0.0.0/0&lt;br /&gt;
Endpoint = 85.215.213.68:51820&lt;br /&gt;
PersistentKeepalive = 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;/etc/systemd/resolved.conf&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;15-20&amp;quot;&amp;gt;&lt;br /&gt;
#  This file is part of systemd.&lt;br /&gt;
#&lt;br /&gt;
#  systemd is free software; you can redistribute it and/or modify it&lt;br /&gt;
#  under the terms of the GNU Lesser General Public License as published by&lt;br /&gt;
#  the Free Software Foundation; either version 2.1 of the License, or&lt;br /&gt;
#  (at your option) any later version.&lt;br /&gt;
#&lt;br /&gt;
# Entries in this file show the compile time defaults.&lt;br /&gt;
# You can change settings by editing this file.&lt;br /&gt;
# Defaults can be restored by simply deleting this file.&lt;br /&gt;
#&lt;br /&gt;
# See resolved.conf(5) for details&lt;br /&gt;
&lt;br /&gt;
[Resolve]&lt;br /&gt;
#&amp;gt;&amp;gt;&amp;gt;2024-10-30 Frank Wulf&lt;br /&gt;
#DNS=&lt;br /&gt;
DNS=192.168.141.10&lt;br /&gt;
#FallbackDNS=&lt;br /&gt;
FallbackDNS=1.1.1.1 1.0.0.1&lt;br /&gt;
#&amp;lt;&amp;lt;&amp;lt;2024-10-30 Frank Wulf&lt;br /&gt;
#Domains=&lt;br /&gt;
#LLMNR=no&lt;br /&gt;
#MulticastDNS=no&lt;br /&gt;
#DNSSEC=no&lt;br /&gt;
#DNSOverTLS=no&lt;br /&gt;
#Cache=no-negative&lt;br /&gt;
#DNSStubListener=yes&lt;br /&gt;
#ReadEtcHosts=yes&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable VPN interface to start at boot time on both VPS server and local server, then start the interface:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
systemctl enable wg-quick@wg0&lt;br /&gt;
systemctl start wg-quick@wg0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wulf</name></author>
	</entry>
</feed>