Port Forwarding VPN Server - raspberry-pi

i'm planning on implementing web server hosted by Raspberry Pi at home, while also having a Dedicated Server with public IP.
The main problem is that my provider charge a lot for a static ip, so i simply dont want to pay.
And here is the question:
Is it possible to achieve what i've mentioned on given diagram (if yes, then maybe some hints?)
Will RPi be accessible through local network while connected to VPN
Thank you for any help!

1.
That is basically possible, it is called a Reverse-Proxy (See wiki for a brief description). The exact implementation depends on the web server you use.
Your dedicated Server will then accept client connections, get the content over the VPN from your Raspberry and serve it to the client like it's his.
2.
Your Pi will still be accessible from the local network while being in the VPN, since it should use a virtual adapter for the connection if its a client on its own. Otherwise, if the router acts as a gateway to the VPN it will do the routing and again your Pi will be fine.

Related

Remote.it and openVPN together

So this is a classic question that I’ve seen many times before...
I’m trying to connect to my home network when not at home using a raspberry pi.
I’m well aware that the way to go with this is to use a vpn server such as OpenVPN.
However, in order to connect to the vpn I would need to forward a port on my router... which I can’t do.
I’ve found remote.it which allows remote connection to a computer (pi) without port forwarding.
What I would like to know is how would I set about using the 2 together, I.e. connecting to remote.it which in turn connects me to my vpn server?
I'm sorry to be finding this question just now, but in case it's still useful to you or to anyone else, here's what you need to do:
Install remote.it
Set-up a remote.it connection to use the protocol (TCP/UDP) and port required by the VPN application
Make a remote.it connection/adding the service to your network (remoteit - Desktop application UI terminology)
Use this connection info (URL/port or localhost:port) with the VPN client
Send an e-mail to support#remote.it if you need help
I would recommend ZeroTier(https://www.zerotier.com/). It haves its own linux client , and you can connect to as many networks as you would like.
You can also configure IP address from the website.
There is also an Android an IOS app that is really simple to connect.

connecting a raspberry pi to a google home

I want to control my raspberry pi with my Google Home at college, but everything I find involves a server and opening a port which I can not do on my schools network.
Is there another way I can do this?
The Google Home has no way to directly control other devices on the same network or through other wireless protocols. Everything goes through an Internet-based service and expects to communicate with devices via a server-based proxy. How that server communicates with the device is up to the developer.
Depending on your needs and capabilities, you do have a few options.
One option, for example, is to use a tool like ngrok to create a tunnel between the device itself and a service run by ngrok on the public Internet. Calls to the public https address are sent to a service running locally on your device, and you can handle it accordingly.
Another is to have your device connect to a server and listen for command changes, and then execute those changes. If you don't want to run a server, you can even use something like Firebase - have your device listen for changes on the real-time database (which can use the HTTPS port to communicate as a client, so you don't open anything) and have something like a Firebase Cloud Function act as the webhook for your Action.
Go through this blog post: http://nilhcem.com/android-things/google-assistant-smart-home
You will have to set up a OAuth server but as #Prisoner said you can use ngrok to tunnel the device to internet, BUT I would recommend using "localtunnel" as it provides a free static url and the set-up is also easy. NO Port Forwarding is required with this method.
More info on localtunnel setup:-
How to generate fixed url with ngrok
Moreover you need to activate the OAuth server only once for account linking & than you can close it.
The simplest way I can think of is to expose your Pi to the internet (using port forwarding, ngrok, or whatever) then set up an IFTTT Google Assistant trigger to invoke a webhook which points to your exposed Pi.

Activating port forwarding disables local access

I have a new internet service provider, and thus a new broadband router, a Sagemcom Fast 3890. I have some Raspberry Pis on the inside, that I need to open to the internet, so I've set up some port forwarding. However, when I activate port forwarding, local access is no longer possible.
Example: I configure the Pi on 192.168.0.15 as a web server. I can access http://192.168.0.15/ and see the web page. When I activate port forwarding, I can now see the web page on my external IP address, but I no longer get a response from http://192.168.0.15/ - the request simply times out.
This is a basic Raspbian install, nothing funny. Only thing is my broadband router is new. Is this a feature or a bug?
This is obviously just the behavior of some broadband routers.

socket communication to private network without port forwarding

I have an android client which has to communicate through socket to a c# based pc server. The question is, if the pc server is behind a router which somwhow does not seem to support port forwarding through upnp, or even through configuration, it simply cant get connection.
These routers are some kind of free wifi zones prepared for free by some kind of companies, so I can't have any access to it's configs. The upnp or configuring my router both works fine, but I dont really know what to do about these routers.
It's common for a home router to only allow established connections by default. Even with a VPN tunnel or CHAP Callback, you would still need configuration on both ends imho.

How to set up http server on iPhone behind firewall

I want to develop an iPhone app with a simple IM feature. I am thinking about setting up an HTTP server on an iPhone. If the iPhone is using wifi and is behind a firewall, how can I make sure that other iPhone clients can connect to it?
It's not the firewall that will disturb the connection as much it is the NAT.
When you are connected through wireless router to connect the internet you are surfing via NAT. it means you dont really have an extenral IP but once you initiate connection the router will map your intenral IP to one of his externatl ports and for certain time window he will pass connections to you if he will get it to the right port.
That being said, there is no actual way of setting a server behind a NAT unless you can configure port forwarding in the router and internal static IP.
Hope i was clear enough, good luck
I do not really think that you need to get an HTPP server up and running on iPhone to make an application that can send and receive messages (IM). The idea of making one iPhone user to directly connect to one another does not seem right to me since the users will need to know IP addresses of one another to do that.
Interconnectivity between different users of the chat can be solved by making your application communicate via a dedicated TCP port. It is generally advisable to choose ports with a number higher than 1024 since those below are generally found on the list of so-called well-known ports and are used for Web (like port 80), FTP (port 21), SSH (22), DNS (53), etc., it will be the responsibility of the user to make sure the port used by your application is open on the firewall. In order to solve this problem you can actually use port 80 for communication if you find that the port you have selected is blocked. You can do this because you know that this port will not be blocked in most cases. Indeed Yahoo Messenger is reported to use this technique when the firewall blocks the port it uses for communication.
The port should be used by your application to connect to the Web-server that will actually store user credentials, perform authentication, message transmission, etc., and the server should reside on capable hardware to be able to support large number of simultaneous connections. I can suggest using either a VPS (like the one provided by Linode) or a cloud (like Amazon EC2, Google Application Engine, Rackspace).