How to identify a network?
Hello :)
Is there a "best practice" way to identify a network? A portable computer may be connected to one of several networks (home, office, public hotspot ...). Ideally it would identify the network and configure itself accordingly (mount specific networked file systems, start sshd or not ...). Thinking so far ...
Failing a gateway's MAC solution I did try setting the home LAN to the deliberately obscure 10.35.136.0/28 but was unable to ping the WAN default gateway or DNS server from 10.35.136.7 via LAN gateway 10.35.136.1. Could ping the gateway. Maybe too obscure for the ADSL modem/router? Or netadmin error? In case it matters, I'm not looking for a very secure solution, more of a practicable convenience. |
I like using wicd to address this problem as it allows you to setup profiles for each connection that you make. You can use the post connect scripting options to do things like mount network shares.
|
Hi.
The 'arp' command should work. Maybe something like: Code:
#!/bin/bash |
Quote:
Have just started using wicd and saw the profiles. Presumably it's a manual thing rather than automatic. |
Quote:
What I forgot to put in the OP is that I'd tried it and the ARP cache was not populated (except for the local machine) during boot but you set me to thinking -- perhaps pinging the default gateway would be enough to put it in the ARP cache. I'll try it and post back. |
Quote:
|
Thanks fruttenboel :)
Quote:
Quote:
Quote:
|
Quote:
EDIT: here's bash script to do it Code:
found= More elegant code, thanks to konsolebox in this LQ thread Code:
# Get the default gateway hardware address |
All times are GMT -5. The time now is 01:26 AM. |