auto assign a static ip on RPi3 - raspberry-pi

This is my first post but I have read a lot of great answers from this community, so first of all, thanks to all the people who indirectly had helped me.
At this time I want to know how can I achieve the following;
I'm working with a Raspberry Pi 3 using the last stable Raspbian and I will access internet via a router connected trough eth, not WiFi, so the router will assign it an IP through DHCP.
What I want to do it's to "automatically" and without my intervention, a script or something that can take that assigned data (IP, DNS, Subnet mask, etc) and use it as values to ask for a static IP the next time the RPi3 reboots (also disabling DHCP).
So can someone please help me to know if this can be done and how?
Thanks!

Related

How to setup a global static IP address?

So I'm trying to setup a global static IP address for my on-prem server.
I can't find any company/service that can give me an IP address that can be accessed globally.
Please help me because I put hours of work into my server and would hate to see it go to waste.
PS: I'm new to stackoverflow so I don't know the way to be "professional".
I've searched time and time again but I can't find an application that suited my needs.

IP address for fly.io app not recognised in MongoDB Atlas

I'm trying to limit connection to my MongoDB Atlas cluster from only my fly.io app. I have its IPv4 address from the app deployment page (screenshot below)
and added it to the whitelist in MongoDB Atlas (screenshot below)
The problem is that this doesn't even appear to be enough to allow a connection from my app to my cluster. Even increasing the IP range to 137.66.12.0/23 doesn't help. I've had to allow connection from anywhere in order to get my fly app to connect. I don't have this problem if I'm trying to whitelist my own laptop to develop locally.
I should clarify that performing a dig on my app's URL does bring up the IP address in the first screenshot, so at least this confirms that the IP address is not internal to fly.io.
Can anyone explain what's happening here? Is there a way I can work around this?
Thanks in advance!
I think at the time of writing this there's no way for you to do this see here
However they've given out some IP's based on a few regions that you can try your hand at
list of some outbound IP's based on location
Be warned though, these ip's can change on a whim though

Is portforwarding necessary for website without a domain

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.

iphone app can't see internal network

I'm working on an Enterprise app that communicates with our company servers. I have full two-way communication between the phone and the server through 3G/4G, and it works from my home wifi, but using the wifi at the office where it is connected to the company network the app doesn't see the server that way.
The app is set to look for our external IP address, and the port is open to the server. But I guess the external IP address is not 'visible' from within the network. When I plug in the internal IP address of the server, it goes through just fine.
For the vast number of our users, that would not be a problem. Most of our users (employees) work in the field or in other offices. But for users inside our network, this arrangement is useless unless the user turned off his wifi. But that's not a professional way to do it.
I need to know if there's a way for my app to either use 3G/4G exclusively, or to discover the SSID of the wifi and decide which IP address to use. I'm guessing that the answers to both of these will be, "you can't do that," But I thought I'd ask anyway.
Thanks!
You could have it attempt the internal IP, and fall back to the external IP if it can't connect. A better solution might be to have an internal DNS server that serves the internal IP to in-network devices, though.
Well, I discovered this code is exactly what I need. It gives me the SSID in string form, and I can compare the SSID string with a string of our wifi's SSID, and if it matches then the app uses the internal IP address. And if it doesn't match, it will connect to the external IP address. So far it works perfectly!
Followup: ceejayoz, I don't know if your second suggestion is the same as what our IT guy did, but he created a domain name that will resolve to the server whether it's internal or external. That seems to be the best way to go. So even though I had a workable answer, the URL works better with less code.

What is the preferred way to find all other clients on local network?

Writing an iPhone app in which I want to save the user the grief of typing in IP addresses by finding other clients on the local network.
Is this possible?
If so, what is the preferred way of doing this?
Yes, use Bonjour. See NSNetService.
This class is used to advertise information about the service you're running using multicast DNS. Use NSNetServiceBrowser to find published services of the type you're interested in.
The clients need some way to register with the server. Or you can use portknocking. Long time back there was a protocol from Novell SLP. There is a OpenSLP now. Found a interesting link, I hope this helps
http://www.opendoor.com/shareway/slp.html