In last blog, I had hosted my webserver in BeagleBone Black(BBB) locally via router on 192.168.1.20 IP address.
But problem with that kind of approach is that it in not visible to client outside my local network. In this Blog we will approach toward ‘how to make that webserver global’.
Every website/computer is linked with one ip address(website can be linked more than one ip address, ie when you buy premium hosting. You are provided with more than one ip address for greater bandwidth, by distributing load). For Example, my college website, www.nsit.ac.in is hosted at 184.108.40.206 . When you type this address in address bar of browser you will be redirected to this website. But this is a case when only one site is hosted in that web Hosting. If more than one site is hosted that hosting then you will get error, its because your browser is not sure which site to approach. Their is a provision in Apache for multiple hosting, technically saying virtual hosting. Virtual hosting is also of two types name based and ip based but we are not going into that much details in this post.
So, gist of last paragraph is, for making your webserver global you have to redirect every request on your external IP address to BBB’s IP address. But our router by default don’t allow such request to access beaglebone. A router has much more capabilities than a hub or switch. Unlike hub it may analyze data which is being transferred through this. It can change how it is packaged and send in other network.
We have assigned our Beaglebone Black 192.168.1.20 IP but the browser in another network which is looking for the site can search for ISP’s (internet service provider) IP (in figure 220.127.116.11). Also router will not allow that request to enter local network unless we allow them.
On HTTP daemon, port 80 is the port that the server listens to or expect to receive request from webClient.
So answer to problem is either open that port 80, like we do in multiplayer game server but this will allow access to every other devices in local network to get access on that port. Another option will be DMZ . DMZ stands for demilitarized zone. It acts as a neutral zone between private network and public network. A DMZ is an optional and more secure approach to a firewall and effectively acts as a proxy server.
both option can be found in NAT tab of router. NAT stands for network address translation. NAT was introduced after the development of IPv6 to modify entire infrastructure of the internet and allow a single device to act as agent between Global (Internet) and local network. Which means a single ip provided by ISP can act as representative of entire group of devices.
Allowing access of local network from router
- Method 1:- open port and redirect to a particular local IP (eg. 192.168.1.20)
- Method 2 (Recommended):- Setup a DMZ machine for local ip