On 2022-03-23, Zé Loff <[email protected]> wrote:
>
> Hi all
>
> I have a laptop in which I use ifstated to determine whether it is "at
> home" or whether it is "roaming", and bring up the VPN -- used to be
> iked, now its wg -- for unwind and some NFS shares, if it is.
>
> My question is: how would you detect if the machine it's "at home"? 

If you use a "non default" subnet for your home network (not anything
common like 192.168.0.0/24, 192.168.1.0/24 etc) then checking the gateway
IP address might be good enough.

You could check the MAC address of the gateway, if you're using
something more common.

> My present setup is a combination of checking the BSSID of the AP if it
> is connected to one, and some MAC addresses of other machines on the
> network.  I can think of a couple other ways (SSH host keys, external IP
> -- though it might change --, DHCP-assigned domain, etc).  Is there an
> easier way I'm not thinking of?  How would you do it?
>
> Note that this doesn't have 100% fail proof nor am I worried about
> covering absolutely all corner cases, or paranoid about someone spoofing
> my network's BSSID, MAC addresses, etc, etc, just to prevent me from
> setting up a VPN.  This is just for convenience.

Alternatively you could just leave the tunnel connected.. wg is pretty quick.


-- 
Please keep replies on the mailing list.

Reply via email to