Is portforwarding necessary for website without a domain - raspberry-pi

I am quite ignorant to the nitty gritty of networking. I am about to create a program for the raspberry pi that tells me the humidity of the room, then proceeds to put it on a web page.
I know how to set this up for my network, but if i wanted to give it to some random person then a problem presents itself.
My question is, it it possible to host a website without a domain, and without port forwarding. And connect to it by http://publiciphere:porthere

If your raspberry pi is hosted on a private network you would need to configure your router to forward requests on a given port (e.g. 80) to your internal ip for the pi.

Related

How is data shared across ip address

I'm not sure I've phrased the question correctly but I'll explain a bit more.
I have a server running on a virtual machine on PC1. I can access this through a particular IP address on the same computer.
Now on a different PC2, when I try the same IP address I see the content served by PC1's server. Both computers are on the same network.
I don't really understand how that IP address is serving the same info on PC2. I'm not sure of the mechanics in the background either and it would really help if someone could explain what's happening here.
If you are using a wifi network then it is because of it you can access the content of the server you have created.
You can see the architecture as that of the internet but on a small scale. Your IP addresses are stores in the wifi (routing tables) so that it can send packets accordingly (See hoping and packet transmission). To be precise, each and every individual system maintains a routing table in it. Thus, in order to fetch a particular site, a system sees its routing table. If the particular IP address is present, the router returns it and the system shows that page. On the contrary, if the IP address is not present the router asks the nearby systems/servers for that particular IP address and the phenomenon continues till the IP address is found.
So, when you search for a local server via system B, whose data is in system A, then the router requests all its child systems to search for the particular IP address in their routing tables, and thus you can access the local server via systems connected on the same network.
To add furthermore, since the local servers are known to be locally operated, the router just sends the seek requests to its child systems only and not globally.
I have tried to keep it as simple as possible supposing that you have not learned about computer networks yet.

Two router setup with public ip to allow port forwarding

In my country, our internet is accessed, in most homes, through the phone cables.
So you normally have a simple modem/router that accepts a dsl-cable.
Now, I have a project where I need to put an application online.
For this, I have bought a TP-Link TL-R407t+ and I have a Technicolor modem/router with wifi.
The setup now goes like this: phone outlet --> technicolor --> TP-Link.
This gives me wifi from the technicolor and the internet through the tp-link works through an ethernet too.
The TP-Link, I have set up for port forwarding. Yet, what remains is that the TP-Link has a private ip. I am lost in figuring out how I get it to use the public IP, so that once I write xx.xx.xx.xx:8080 or whatever into a browser, my app shows up.
So my question is, how do I setup my routers, or add stuff, to allow the port forwarding to work.

How to make an instant messenger system in current internet settings?

First I want to define my question:
1, I am talking about computer program doing the IM, not mobile app. The program should be working in every home, or office environment.
2, Right now all (or most) home computers are behind a router, protected by ISP's security policy. It is not like 20 years ago, when a computer connects to an adapter, it gets a universal IP, as good as Microsoft.com and whitehouse.gov. 10 years ago, you can advise user to do port forwarding, or use UPnP to stealthily perform the port forwarding task. But now in the name of security, ISP is taking port forwarding out from the ISP-managed router (xfinity is doing that, as far as I know).
I know how to do IM in LAN setting, or the universal IP setting, that you get the IP of the friend, establish connection using TCP or UDP, then transfer information. Now when all computers are behind the routers, what is the feasible way / popular way / right way to do IM again? Using a central server to transfer information, by establishing connections of UserA-Server and UserB-Server? I know it would work, but not very "instant", in my humble opinion.
Please advise, thanks.
Upnp and NAT-PMP can still work, it will map a external port like punchhole. The problem is that our external IP may not be sure. So if you want to send IM, there are two choices, DHT or Central Controller.
I suggest you to use DHT and a central server using ICE structure, if DHT can work then it is ok, or we can use the central server to do the UDP/TCP traversal. In some circumstances like symmetric NAT, the server need to do relay, but in others, it just start the connection and then it is a p2p connection without server.

Coordinating peer-to-peer messages using multicast, how to get receiving IP?

I have been working on a local LAN service which uses a multicast port to coordinate several machines. Each machine listens on the multicast port for instructions, and when a certain instruction is received, will send messages directly to other machines.
In other words the multicast port is used to coordinate peer-to-peer UDP messaging.
In practice this works quite well but there is a lingering issue related to correctly setting up these peer-to-peer transmissions. Basically, each machine needs to announce on the multicast port its own IP address, so that other machines know where to send messages when they wish to start a P2P transmission.
I realize that in general the idea of identifying the local IP is not necessarily sensible, but I don't see any other way-- the local receiving IP must be announced one way or another. At least I am not working on the internet, so in general I won't need to worry about NATs, just need to identify the local LAN IP. (No more than 1 hop for the multicast packets is allowed.)
I wanted to, if possible, determine the IP passively, i.e., without sending any messages.
I have been using code that calls getifaddrs(), which returns a linked list of NICs on the machine, and I scan this list for non-zero IP addresses and choose the first one.
In general this has worked okay, but we have had issues where for example a machine with both a wired and wifi connection are active, it will identify the wrong one, and the only work-around we found was to turn off the wifi.
Now, I imagine that a more reliable solution would be to send a message to the multicast telling other machines to report back with the source address of the message; that might allow to identify which IP is actually visible to the other machines on the net. Alternatively maybe even just looking at the multicast loopback message would work.
What do you think, are there any passive solutions to identify which address to use? If not, what's the best active solution?
I'm using POSIX socket API from C. Must work on Linux, OS X, Windows. (For Windows I have been using GetAdapterAddresses().)
Your question about how to get the address so you can advertise it right is looking at it from the wrong side. It's a losing proposition to try to guess what your address is. Better for the other side to detect it itself.
When a listening machine receives a message, it is probably doing do using recvfrom(2). The fifth argument is a buffer into which the kernel will store the address of the peer, if the underlying protocol offers it. Since you are using IP/UDP, the buffer should get filled in with a sockaddr_in showing the IP address of the sender.
I'd use the address on the interface I use to send the announcement multicast message -- on the wired interface announce the wired address and on the wireless interface announce the wireless address.
When all the receivers live on the wired side, they will never see the message on the wireless network.
When there is a bridge between the wired and the wireless network, add a second step in discovery for round-trip time estimation, and include a unique host ID in the announcement packet, so multiple routes to the same host can be detected and the best one chosen.
Also, it may be a good idea to add a configuration option to limit the service to certain interfaces.

Can a computer behind a NAT-router receive realtime-updates from facebook?

I'm currently writing a desktop application that integrates facebook using the graph API. I'd like to implement real-time updates (http://developers.facebook.com/docs/api/realtime/), but in the doc it say's that you have to establish a http server that facebook will address to send the updates to. My problem is now that my box is sitting behind a router with only one IP-address (so the router uses NAT).
Will it still be possible for facebook to contact my webserver for sending me updates?
#kohlehydrat: Every webserver needs to have an IP address that can be reached from "anywhere" on the internet. Since your webserver is sitting behind a NAT with only one IP, I seriously doubt Facebook can reach your webserver.
However, see if you can configure the NAT in such a way to reserve a dedicated port for your application.
For example:
10.122.48.222:4231
traffic to port 4231 is directed towards your application.
10.122.48.222 is outward facing NAT IP address.
I am not sure if we can do this, but its an idea.
The router should catch port 80 requests (or whatever port your webserver is supposed to listen on) and forward it to your internal computer port 80, preferably in a consistent NAT style.
Basically, IP based communication with proper routing should not be an issue if both parties can find each other.
You Need to Do what is called as "PORT FORWARDING".
I had a similar issue initially, Then I forwarded my port where in my IP was Made Public from being local only to the company.
And now my issue is solved.
hope this helps.
this question is already closed, but since you have not received this particular answer (which is what I believe most facebook developers do in order to develop behind firewalls) I will post it here:
You can reverse tunnel your machine to any machine with a publically available ip.
see blog post on this topic
in a lot of facebook sdks, this functionality is even included ( for instance, facebooker, a ruby gem provides the functionality to rake facebooker:tunnel:start after you setup the appropriate settings)