[ltp] automatic network probing

André Wyrwa linux-thinkpad@linux-thinkpad.org
Sat, 22 Nov 2003 03:18:18 +0100


Hi,

> I know you were being snide and sarcastic, but a really good thing to
> consider doing is to set up your laptop to automatically figure out
> when it's on your home LAN (possibly by looking at its ip address, or
> probing to see if your home raid-based fileserver's MAC address is
> available on the ethernet), and automatically doing an rsync to backup
> your notebook files if it is left on at 2am in the morning when at
> home.

This just brought up a question i was asking myself some time ago.

I'd like to probe for in which network i am without interfering too much
with the network. To explain a bit more, imagine the following situation
(the actual problem I had was solved by using a dock and wireless at
home and no dock and wired lan at work, but I'm still interested in the
case):

Let's say i have a home network with IPs from 192.168.1.x to
192.168.3.x, where all IPs ending on .10 are assigned to the nics in my
linux router. IPs are assigned statically.

Then there is the network at work with IPs from 192.168.0.x to
192.168.x.x with some IPs existing, that don't exist in the home
network. IPs are assigned dynamically (except for important servers).

Let's say I'm doing both connections with the builtin wired lan card and
I have no dock anywhere.

Problem is that if I just connect (by accident) my notebook to the
network at work using the configuration for the home network (which is
default), the IP i assigned to my notebook confuses the network - this
actually happened, I wondered why I had such a lot of network traffic
until I realized that probably DNS requests were sent to my notebook.

So I was asking myself if there would be a way to probe for the network
I'm connected to without interfering with the network at all or if
that's not possible what would be the way with least interference.

I could imagine probing for an IP which doesn't exist at home and then
shutting down eth and reupping it with the proper config for the
situation. But this would already mean confusing the network for some
short period of time. Is there a way to get information from the net
without risking to take the same IP as some server but without knowing
all the IPs of servers in the net?

I know this sounds clumsy and there are a lot of ways to workaround
this, but i find this an interesting problem. Or maybe I'm just a
weirdo. ;-)

Is there a way of getting the MAC address of the card on the opposite
site of the wire before setting up the IP layer? Think that would be a
way, if it be possible.

Andre.