Webserver on client machine.

This forum is for general conversation and user-user networking.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
seba.nowak
OpenVpn Newbie
Posts: 3
Joined: Sat Sep 30, 2017 9:37 am

Webserver on client machine.

Post by seba.nowak » Sat Sep 30, 2017 9:49 am

Hi everyone,

At home I have Raspberry Pi with tvheadend stream serwer working on port 9981. This Raspberry is connected via OpenVPN to my VPS (OpenVPN serwer) and has static internal IP, for example 172.26.0.3

I would like to have ability to reach this Raspberry from internet. I other words, in browser I would like to put:

Code: Select all

http://IP_OF_MY_VPS:9981
and have connection to my Raspberry at home.

Is this possible?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Webserver on client machine.

Post by TinCanTech » Sat Sep 30, 2017 1:43 pm


TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Webserver on client machine.

Post by TinCanTech » Sat Sep 30, 2017 2:09 pm

You don't even need that just use the VPN IP.

seba.nowak
OpenVpn Newbie
Posts: 3
Joined: Sat Sep 30, 2017 9:37 am

Re: Webserver on client machine.

Post by seba.nowak » Sat Sep 30, 2017 4:44 pm

TinCanTech wrote:
Sat Sep 30, 2017 2:09 pm
You don't even need that just use the VPN IP.
Doesn't work :(

Of course everything is working but I need to be on VPS via VNC for example. Then on VPS if I put internal static ip IP of raspberry pi (which is connected to VPN) with 9981 port, all working fine. I would like to do the same, but from outside by just putting VPS adress with 9981 port to connect with raspberry.

seba.nowak
OpenVpn Newbie
Posts: 3
Joined: Sat Sep 30, 2017 9:37 am

Re: Webserver on client machine.

Post by seba.nowak » Sun Oct 01, 2017 10:15 am

Ok, is working :)

Need to set iptables command:

Code: Select all

iptables -t nat -I PREROUTING -p tcp -i eth0 --dport 9981 -j DNAT --to RASPBERRY_INTERNAL_IP:9981 
iptables -I FORWARD -p tcp -d RASPBERRY_INTERNAL_IP --dport 9981 -j ACCEPT

Post Reply