Am Freitag, 19. März 2021, 20:45:36 CET schrieb James Knott:
On 2021-03-19 3:39 p.m., Mathias Homann wrote:
would be nice now is for the Ethernet connections to recognize
location and switch zones.
Networkmanager is your friend - there's a folder
/etc/NetworkManager/dispatcher.d which holds any number of scripts
that get executed in alphabetical order every time a connection goes
up or down.
One way to "recognize locations" would be to get the address of the
default gateway from the routing table, then get the mac address for
that ip address - MAC addresses are supposed to be unique.
My laptop recognizes my home network that way, and enable and disable
a few odds and ends that I don't need at home, and enable and disable
some odds and ends that I don't need
elsewhere - not just firewall zones:
I'll have to look into that.
the script I have is here:
I have it stored as /etc/NetworkManager/dispatcher.d/zz-amihome.sh to make
sure it gets executed after everything else.
The lines that are interesting for your are 10,11 and 12.
Everything else just actually starts and stops stuff.
Jabber (XMPP): lemmy(a)tuxonline.tech
IRC: [Lemmy] on freenode and ircnet (bouncer active)
gpg key fingerprint: 8029 2240 F4DD 7776 E7D2 C042 6B8E 029E 13F2 C102