[systemd-devel] network config file - [Match] by AccessPointName, AccessPointMAC

Amish anon.amish at gmail.com
Wed Jun 27 05:17:22 UTC 2018


Hello,

Is there a way to do a [Match] in .network file to match wireless 
AccessPoint (by Name or MAC)?

The reason is I go to 2-3 companies (plus home/friend's home wifi).

2 places dont have DHCP server ON; on wifi router but asks to set 
pre-defined static IP.

Other places have DHCP active.

So my idea is to have three .network files.

File: 50-wlan0-c1.network.

[Match]
# this is wifi adapter MAC (not AP MAC)
MACAddress=00:11:22:33:44:55
AccessPointName=company1-AP-Name

[Network]
Address=192.168.1.55/24
Gateway=192.168.1.1

=====

File: 50-wlan0-c2.conf

[Match]
# this is wifi adapter MAC (not AP MAC)
MACAddress=00:11:22:33:44:55
AccessPointMAC=company2-AP-MAC

[Network]
Address=192.168.2.28/24
Gateway=192.168.2.10

====

# anything else on DHCP (50 processed before 51)
File: 51-wlan0-dhcp.conf

[Match]
# this is wifi adapter MAC (not AP MAC)
MACAddress=00:11:22:33:44:55

[Network]
DHCP=yes


This is how Android and iOS work i.e. they allow to set IP address per 
AP. I think Windows allows it too. (not sure though)

Thanks and regards,

PS: Hope I have not overlooked any existing setting or an easier way to 
do it.

Amish.



More information about the systemd-devel mailing list