[ltp] automatic network probing
Sun, 23 Nov 2003 13:43:16 -0500
[root@snake tharter]#arping -I eth0 192.168.168.10
ARPING 192.168.168.10 from 192.168.168.102 eth0
Unicast reply from 192.168.168.10 [00:80:C8:E8:4D:DA] 0.951ms
Unicast reply from 192.168.168.10 [00:80:C8:E8:4D:DA] 0.647ms
Unicast reply from 192.168.168.10 [00:80:C8:E8:4D:DA] 0.638ms
Unicast reply from 192.168.168.10 [00:80:C8:E8:4D:DA] 0.648ms
Sent 4 probes (1 broadcast(s))
Received 4 response(s)
which as you can see provides the MAC address of the pinged machine. Given=
that ARP is a network layer protocol you should be able to do an arping=20
BEFORE you bring up IP on the interface. So basically one would construct a=
network initialization script which did an arping to a known address, check=
the expected MAC address to see which network you're on, and set everything=
else up accordingly.=20
Of course I am not saying all this hackery is necessarily EASY to accomplis=
but in theory it shouldn't be all that hard and it aught to be quite robust=
The impact on the network will be miniscule as well, you're just sending ou=
an ordinary ARP request, which your system would have to do anyway.=20
On Friday 21 November 2003 9:18 pm, Andr=C3=A9 Wyrwa wrote:
> > 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
> 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.
Giant Electronic Brain