Hallo,
der Raspberry Pi soll die Einstellungen von
- static ip_address
- static routers
- static domain_name_servers
in Abhängigkeit des zu Verfügung stehenden WLan Netzes treffen.
Als OS kommt Raspbian GNU/Linux 9 (stretch) lite 4.14.98-v7+ zum Einsatz.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE
network={
ssid="SSID1"
scan_ssid=1
psk="***"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
}
network={
ssid="SSID2"
scan_ssid=1
psk="***"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
}
Alles anzeigen
Um die oben gewünschten Einstellungen zu treffen wird die dhcpcd.conf entsprechend angepasst, was wenn man nur ein Wlan Netz zur Verfügung hat "immer wunderbar" funktioniert, jedoch muss ich die Einstellungen jetzt in Abhängigkeit einstellen, ob SSID1 oder SSID2 zur Verfügung steht.
interface wlan0
static ip_address=x
static routers=y
static domain_name_servers=z
x, y, z ist der Teil der in Abhängigkeit der SSID passend zum Netzwerk gesetzt werden muss.
Hierzu hätte ich hofft etwas passendes hier entdeckt zu haben:
Punkt arping
Zitat von http://manpages.ubuntu.com/manpages/precise/man5/dhcpcd.conf.5.htmlarping address [address] dhcpcd will arping each address in order before attempting DHCP. If an address is found, we will select the replying hardware address as the profile, otherwise the ip address. Example:
interface bge0arping 192.168.0.1
profile 192.168.0.1static ip_address=192.168.0.10/24
Wenn ich dies jedoch mit in die dhcpcd.conf mit einbaue, funktioniert nichts mehr und der Pi bekommt auch eine völlig unbrauchbare IP Adresse.
interface wlan0
arping 192.168.26.<x>
profile <macadresse von x>
static ip_address=x
static routers=y
static domain_name_servers=z
Jetzt die Grundsatzfrage, wie löse ich mein Vorhaben?