Ok, so my question is a bit out there, and I've read a lot of similar questions but they never actually are doing what I am trying to accomplish.
So the best way to describe it is with this scenario:
I have 3 computers, all have Ethernet Adapters.
- Desktop Computer - Windows, one I work from, have Cygwin.
- A portable Raspberry Pi - One I use when I go to different places.
- Laptop with Ubuntu - I take this just about everywhere as a backup plan
When I move my raspberry pi to another setup location, I need to be able to connect it directly to another computer via eth0. The issue is that I hate pulling out my laptop and enabling a bunch of forwarding solutions to allow this other persons machine to work with my pi.
I have to set the static IP of the Pi to something like 192.168.0.* and the work computer 192.168.0.1 each time I want to connect to it. I want to stop having to pull out a keyboard and other tools to try to set these options. Now, I've already made a python script that sets the Pi's IP to 192.168.0.3 as soon as it starts up and find its without a connection via DHCP.
This is good for connecting to my desktop that I'm forcing my Ethernet to stay at a certain IP, and have some hacks in the back for sharing connection interfaces. I just cant use this with other machines.
Which leads to the real question: How, if possible, can I get my Pi to somehow query the Ethernet to see if the computer its directly connected to already has a static IP address set, and then simply set its own to a matching IP to pair?
So what I'm saying is, I need to be able to just plug this pi into a machine. Which the IP for their adapter(the host) is already set to something. Say it's actually 192.168.172.1 right now; and the pi will recognize 192.168.172._ and set it's address to something like 3 or 31 so I can SSH into it.
I've have been told by "professionals" that this cannot be done, but I don't believe it. This is the 21st century and we don't have mutative connections. Blasphemy. Haha, I want to figure this out and I think it will be useful to have this in my Linux arsenal. "The assimilate Ethernet daemon"
[EDITS:] As a clarification, the connection will be on a single cable. If it's in a network like a hub or switch, they have DHCP and the PCs will be given addresses automatically. So our solution only needs to be concerned with the random connection to another machine.