Re: systemd-networkd: switch between several static network setups on wired connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Torsten,

On Wed, Mar 29, 2023 at 02:58:05PM +0200, fi@xxxxxx wrote:
> 
> Dear Systemd Folx,
> 
> 
> 
> I have a laptop that I run at different locations with different
> networks. I want to have static(!) network setup (address, gateway, DNS,
> NTP) for my wired adapter on these networks. I can define setup for
> each of them in a .network file matching my interface (eth0), but only
> the alphabetically first of them is taken into account.
> 
> For now I create a symbolic link to the desired config and restart
> systemd-netword.
> 
> Is there a more straight forward way for chosing the actual setup, for
> instance using networkctl?

Unless you have something that networkd can notice is different about
the interface from one location to another (cf. [Match] in the
systemd.network(5) man page [1]), you will have to give it a kick in
order to change its behaviour.

But restarting the entire daemon is not strictly necessary. You can
update the symlink you described and then run 'networkctl reload' to
make it reload the .network and .link files. I think you will then have
to run 'networkctl reconfigure eth0' as well.

[1] https://www.freedesktop.org/software/systemd/man/systemd.network.html#%5BMatch%5D%20Section%20Options

> 
> Might there also be a chance to automatically chose a wired setup
> depending on a local SSID visible?

SSID is a wireless thing so it will not be something that a wired
interface can match on. But for wireless interfaces you can achieve what
you want much better by using SSID= in the [Match] section.

> 
> Thanks and best regards
> 
> 
> Torsten

Kind regards,
Alvin




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux