connecting to an endpoint whose IP is not public - networking

I developed a decentralized gaming app, where players connecting to the backend from GUI using websockets. On my test environment my backend nodes have static public IP's, so I'm able to establish the websocket connections and test the game.
I'm planning to release the game to the community to test the game, but it was the case that not many have static IP's to test. So it all boils down to the situation that I feel I messed up with the design at the initial stage in using static IP's for connection b/w GUI and backend.
What I'm looking for the possibility is, say suppose if my machine is connected to the internet, is there a way I can assign some end point address to my machine and I can connect to this end point address using MQTT or any other possible way.
Can you please share your inputs on how can I overcome this problem.
Thank you.

One more important thing you should consider for a decentralized network is that we have many NAT devices(routers) during the Internet. So, we cannot connect to each other as we want to.
You should do something like bt download apps have done. For example, you can have a tracker(centralized controller). If you don't want it, then DHT and LSD is what you must learn. Using these protocols, you can realise your design.

The community needs a static public ip , and all people have one .
The IPs they have are not 1 IP per computer .
Now days since IPV4 addresses are not alot they are using NAT ( Network Address Translation )
so PC's can have all an IP address in common within the same LAN .
so your app will still be usable they IPs will be static , thus the ports used will varey .
you can see more about NAT here :
https://en.wikipedia.org/wiki/Network_address_translation

Related

Floating IPs usage on Digital Ocean

I am looking for a basic thing yet I have not found not even a single good documentation on getting it done.
I want to allocate a floating IP, then associate it to a network interface of a droplet other than eth0.
The reason is I want to have the ability to very easily switch from one IP to the other with a programming language.
In a few words, I want to be able to do these two commands and both should provide a different response.
curl --interface eth0 https://icanhazip.com
curl --interface eth1 https://icanhazip.com
Also, I want to know what to do once I release the Floating IP, how do I roll back to the starting point.
All documentation I read, rely heavily on "ip route" and "route", most did not even work, some worked but replaced completely the old IP by the floating and that's not what I want, and also they did not show how to rollback the introduced configuration changes.
Please help, I spent 1 whole day now trying to get this to work for a project, and no results so far.
I guess there is no need to know DigitalOcean, how to make this work on other Cloud Providers would apply here too I think.
Update
After asking this on DigitalOcean community forum (https://www.digitalocean.com/community/questions/clear-guide-on-outbound-network-through-floating-ip), they claim that is not supported, although there may be some solutions to this if somebody can provide such a "hacky" solution I would take it too. Thanks
In the cloud (AWS. GCP etc.) ARP is emulated by the virtual network layer, meaning that only IPs assigned to VMs by the cloud platform can be resolved. Most of the L2 failover protocols do break for that reason. Even if ARP worked,the IP allocation process for these IPs (often called “floating IPs”) would not integrate with the virtual network in a standard way, so your OS can't just "grab" the IP using ARP and route the packets to itself.
I have not personally done this on Digital Ocean, but I assume that you can call the cloud's proprietary API to do this functionality if you would like to go this route.
See this link on GCP about floating IPs and their implementation. Hope this is helpful.
Here's an idea that needs to be tested:
Let's say you have Node1(10.1.1.1/24) and Node2(10.1.1.2/24)
Create a loopback interface on both VMs and set the same IP address for both like (10.2.1.1/32)
Start a heartbeat send/receive between them
When NodeA starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 2
When NodeB starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 1
The nodes could monitor each other to withdraw the static routes if the other fails. Ideally you would need a 3rd node to reach quorum and prevent split brain scenarios, but you get the idea right?

Connect two entities from different LANs without extra configuration

This may seem a naive question, since the computer networks knowledge from university days has almost vanished throughout the years, but before getting my hands on a book relevant on this topic, I would like to find out what more experienced folks out there know about this.
Basically I would like to be able to connect a client (C) to a remote server (S), sitting in separate LANs, without adding special rules (e.g. port forwarding) to any of the routers in between.
I know that some applications (TeamViewer) use broker servers for connecting a client to a remote machine, but what I don't know is if the whole traffic between them goes through the broker server.
For my use case, I would use such a server only for initial discovery of the peers (more exactly the discovery of S by C), then the traffic would go through a connection directly initiated by C towards S.
Would such an approach be possible?
Thank you!
Unfortunately if the devices reside in networks separated by the Internet your first hurdle concerns RFC1918. In order to connect to a private IP you will have to use some level of NAT. To over come this is to build a VPN connection between the two networks affectively connecting as if each are local to the other. Please note that to avoid any NAT configuration in this scenario requires that the private networks are using different subnets IPs

P2P vs Client Server Architecture

which one to choose between p2p or client-server network architecture for advanced file sharing option with less resources and manpower. will u illustrate with strong opinion??
I would like to know more if anyone can intrude between and get access between the two users in P2P??
For long run and big scale I will obviously pick client-server mode.
It's indeed need more resources at the beginning than the P2P, but it's way more manageable (both in software and hardware) and make my life easier to maintain the performance.
Client server mode is only useful if you are planning to do the file sharing within LAN, otherwise you need to have a public IP. The PC with public IP acts as a server. If you have a p2p file sharing system then you probably need only one server with public IP for the rendezvous and hole punching process. so many PC can connect with each other and share. What do you mean by advance file sharing ?

Creating a networking application that can work over internet connections

I have a somewhat basic understanding of network programming (and networking concepts in general) from taking a networking course in university a few years ago.
I remember being able to create a simple chat application, where the chat server is used as a central directory aware of which clients are currently online, but once a client knows another client it wants to chat with, the actual messages between them don't need to go through the server. I remember we could only test this over a bunch of LAN machines.
This C# chat program also has several comments mentioning that the program does not work over the internet: http://www.geekpedia.com/tutorial239_Csharp-Chat-Part-1---Building-the-Chat-Client.html
My question is why do these applications not work over the internet when "commercial" chat applications can. Surely, there is some way to make my computer accessible to the outer network even if its IP address is not valid outside the network of the ISP.
I see no problem with the linked-to code. The server doesn't even bind to a local address, which means it will listen for connections on all ip-addresses on the computer. There is however a comment for in the server article where the user changed the TcpListener object creation to bind to a specific address, which means clients only can connect to that specific address.
In the original server design, with using TcpListenet with only a port number, there should be nothing preventing its use on an Internet connected computer, unless there is a firewall blocking access.
Were you aware of networkComms.net and in particular the short chat example demonstrating the functionality here (It's less than 15 lines of code)? This was written specifically for people writing server-client apps in c# and given most of the problems you might come across will already have been solved and it might save you some time. This library is completely plug & play and has no issues working over the internet (as long as you can setup the necessary port forwarding where necessary).
Generally if both of your targets are behind NAT (so no true external ip addresses) and you are unable to configure port forwarding you need to look at 'TCP / UDP hole punching', quite an advanced technique.

AIR/Flash Player connect to another machine without cirrus/stratus

Is it possible to connect to a Air app running on another machine via socket(assuming we know ip) or some other mechanism(which doesnt use Cirrus/stratus)? If it is can someone please help me on how?
Let me rephrase question, I dont want to connect to a server over socket. I would like to know if it is possible to connect from one AIR app on machine A to connect to another AIR app on machine B via sockets without cirrus. I'm not asking for someone else to do my work, I couldnt find any documentation or possibility of the above thing. My conclusion now is that it is not possible, but I would just like it to be verified by other people(experts).
Absolutely, as3 supports sockets. http://www.ultrashock.com/forum/viewthread/81676/
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
There are two ways to do it. One AIR app can act as a server by creating a ServerSocket object while the other app connects to this with the Socket class. The other way is to use the DatagramSocket class.
In both cases, the trick is that because of network access translation, the IP address to use is not always easily discoverable unless at least one of the computers has a static IP. If both computers are on the same network subnet you can look up the IP address needed to reach one computer from the other manually. Otherwise, the IP one computer must use to reach the other won't be the same IP that the computer sees for itself. This matchmaking is the service that stratus/cirrus provides.
See http://www.brynosaurus.com/pub/net/p2pnat/ for a description of the problem.

Resources