I Need Help - Internal Port Forwarding & Dynamic DNS

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
Syntech
Posts: 2
Joined: Sun Sep 16, 2018 11:29 am

I Need Help - Internal Port Forwarding & Dynamic DNS

Post by Syntech » Sun Sep 16, 2018 11:49 am

Hi,

I have installed softether onto a Raspberry PI3 and can access internal IP addresses via a 4G Dongle from the vpnazure client app without any issues.

Is it possible for a fixed internal IP address other than the raspberry PI to redirect its webpage the outside world or from a URL on our server. See below.

Setup
Raspberry PI3 With 4G PAYG SIM & Dongle installed (this is a standalone network without a router)
Device with Web Server (which I would like to access from a sub-domain on our server)

IP Address 192.168.2.240 = Raspberry PI Physical Address
IP Address 192.168.2.241 = VPN Virtual address with DHCP - Bridged with Physical Address .240
IP Address 192.168.2.11 (Web Server Installed with gateway and DNS set to 192.168.2.241)

I guess I need to do 2 steps but have no clue where to start?

1. Setup port forwarding say 80 or 443 to the outside world.

2. Re-direct requests from the internet from xxx.vpnazure.net to subdomain.mysite.com

Any help would be greatly appreciated.

Thanks,

Tony

davidebeatrici
Posts: 3
Joined: Tue Aug 28, 2018 6:44 am

Re: I Need Help - Internal Port Forwarding & Dynamic DNS

Post by davidebeatrici » Sun Sep 16, 2018 12:49 pm

Hi,

You can forward an internal port using a local bridge and iptables:

Code: Select all

#!/bin/sh

PUBLIC_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"

# Web server - port 80
iptables -t nat -A PREROUTING -d ${PUBLIC_IP} -p tcp --dport 80 -j DNAT --to-dest 192.168.250.11:80
iptables -t nat -A POSTROUTING -d 192.168.2.11 -p tcp --dport 80 -j SNAT --to-source 192.168.2.241

# Web server - port 443
iptables -t nat -A PREROUTING -d ${PUBLIC_IP} -p tcp --dport 443 -j DNAT --to-dest 192.168.250.11:443
iptables -t nat -A POSTROUTING -d 192.168.2.11 -p tcp --dport 443 -j SNAT --to-source 192.168.2.241
The script gets the public IP address from OpenDNS.

Syntech
Posts: 2
Joined: Sun Sep 16, 2018 11:29 am

Re: I Need Help - Internal Port Forwarding & Dynamic DNS

Post by Syntech » Tue Sep 18, 2018 11:24 am

Thanks for the instructions, I'll give this a try.

Post Reply