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 ...
- The network's IP address is next to useless with so many networks being 192.168.1.0/24 or similar.
- Nodes at specific addresses with specific services is too detailed, cumbersome to maintain and anyway such nodes may not be up.
- Perhaps the best way to identify a network is by the MAC address(es) of its gateway(s) -- and their IP addresses are conveniently given by the DHCP server.
But how to get the MAC addresses? nmap will do it but takes ~14 seconds; too long. rarp is obsolete, according to its man page: "This program is obsolete. From version 2.3, the Linux kernel no longer contains RARP support. For a replacement RARP daemon, see ftp://ftp.dementia.org/pub/net-tools
" (address did not load).
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.