visucius
Goto Top

Raspi: Speicherort Netzwerkdaten bzw. IP-Adresse

Hallo in die Runde,

mal ne Grundsatzfrage: Wo speichert z.B. ein Raspi seine Netzwerkinformationen (zB. fixe IP, Maske, usw.) ?!

Ich bin davon ausgegangen, dass solche Infos auf der Speicherkarte hinterlegt werden?! Wenn ich die HW jedoch austausche und mit der konfigurierten Speicherkarte bestücke, haben die Geräte schon das zweite Mal Probleme im Netzwerk erkannt zu werden?!

Kann das sein?! Bzw. warum ist das so?!

ERGÄNZUNG: Es handelte sich um Modell 3+ und 4, die ich gegeneinander tauschte.

Ups. Oder ist das am Ende kein Speicher, sondern schlicht ein Treiberproblem?!

Content-Key: 560014

Url: https://administrator.de/contentid/560014

Printed on: April 26, 2024 at 13:04 o'clock

Member: fredmy
fredmy Mar 21, 2020 at 14:07:18 (UTC)
Goto Top
Hallo,
was hast du denn eingestellt ?
fix IPs oder DHCP ?

bei Fixen IPs gibts wieder paar Möglichkeiten face-wink

Fred
Member: aqui
Solution aqui Mar 21, 2020 updated at 14:15:39 (UTC)
Goto Top
Wo speichert z.B. ein Raspi seine Netzwerkinformationen (zB. fixe IP, Maske, usw.) ?!
Wird alles in der /etc/dhcpcd.conf geregelt !
Man achte auf das "d" !
Es handelte sich um Modell 3+ und 4, die ich gegeneinander tauschte.
Ist irrelevant. Entscheident ist die Raspian Version. In Stretch und Buster ist das aber identisch !
Member: Visucius
Visucius Mar 21, 2020 at 14:11:44 (UTC)
Goto Top
Fixe IP, das ist ja das Problem face-wink

In Zukunft werde ich wohl vor dem Wechsel DHCP aktivieren. Aber die Karte wird ja im gleichen Netzwerk wieder eingesetzt.

Fürs Wifi gabs mal ne Möglichkeit einer zusätzlichen config-Datei aber irgendwie finde ich das nicht mehr.
Member: aqui
aqui Mar 21, 2020 updated at 14:16:36 (UTC)
Goto Top
Fixe IP, das ist ja das Problem
Warum ? Trage die Mac Adresse des RasPis im DHCP Server deines Routers ein und weise ihm immer eine feste IP zu ! Fertisch.
Ansonsten immer über die gut dokumentierte /etc/dhcpcd.conf face-wink

Über das Static Backup Profil dort in der dhcpcd.conf kannst du ihm auch eine statische IP zuweisen die er verwendet wenn er DHCP Client ist aber wenn er keinen DHCP Server im Netz findet !
Member: Visucius
Visucius Mar 21, 2020 updated at 14:24:16 (UTC)
Goto Top
Ach, ich hatte "damals" vor nem halben Jahr das Standard-Setup vom PiHole durchlaufen. Da wird das fixe Setup ja präferiert. Habs beim abbau der HW etwas eilig gehabt und die Folgen nicht so eingeplant face-wink

Bei anderen Geräten im gleichen Netzwerk läufts über den DHCP.


/etc/dhcpcd.conf
Dafür müsste ich aber doch auf die ssh-Oberfläche?! Der Netzwerkzugang klappt ja gerade nicht. Deshalb ja die Idee, das irgendwie über die Speicherkarte und einer zus. Startup-config zu lösen.

Achso, ist natürlich ien Headless-System - sonst hätte ich hier keinen Thread aufgemacht.
Member: aqui
aqui Mar 21, 2020 updated at 16:41:23 (UTC)
Goto Top
Dafür müsste ich aber doch auf die ssh-Oberfläche?!
Nicht unbedingt ?
Tastatur und Monitor geht natürlich auch ! face-wink
Aber bei einem headless RasPi hat ja nun jeder Dummie immer den SSH Server aktiv um remote per SSH und PuTTY oder TeraTerm auf ihn zuzugreifen.
Klicki Bunti Knechte installieren den xrdp um mit Winblows RDP aufs GUI zuzugreifen.
Oder Browser mit Shellinabox.
Machst du das denn nur mit Hand auflegen ???
Guckst du hier:
Netzwerk Management Server mit Raspberry Pi
Member: Visucius
Visucius Mar 21, 2020 updated at 17:17:00 (UTC)
Goto Top
Ich nutze den bösen Blick um ihn zu züchtigen 😏

Das ist ja das komische, ssh findet keinen Route to Horst und die Fritze sieht ihn auch nicht im LAN. Direkverbindung per LAN am Adapter des MacBooks mit (entsprechenden) fixen IPs geht auch nicht. Ebenso das pihole Interface. Sowohl der alte Adressraum in dem die HW lief als auch den der Speicherkarte. An der anderen Location habe ich den neu aufgesetzt, diesmal wollte ich der Sache auf den Grund gehen

Ich hatte nen 3er mit Pihole und fliegend nen 4er, mit dem ich bei der Freundin mit pihole und wireguard experimentierte. Und dann sollte der 4er wieder in meiner Obhut sein. Das wäre bei ihr leistungsmässig Perlen vor ... 😉

Ich gehe da nachher nochmal strukturierter dran
Member: aqui
Solution aqui Mar 21, 2020 updated at 17:22:10 (UTC)
Goto Top
Das ist ja das komische, ssh findet keinen Route to Horst
Ist der RasPi denn in einem anderen IP Segment oder hängt er im lokalen LAN der FritzBüx ?
Im lokalen LAN sollte die FB in jedem Falle den RasPi "sehen".
Solltest du allein schon im FB DHCP Server anhand der Mac Adresse sehen. ifconfig zeigt dir die LAN (eth0) Mac Adresse des RasPis an.
So sähe eine dhcpcd Konfig mit dynmaischer DHCP IP aus:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0 ## 

So mit einer statischen:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
interface eth0
static ip_address=192.168.178.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.178.1
static domain_name_servers=192.168.178.1 

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0 ## 
Man achte auf die entkommentierten "#" !

Und so eine mit einem statischen Fallback auf die IP 192.168.1.222/24 (DNS weiter FritzBox IP) wenn kein DHCP Server im Netz gefunden wird wie z.B. an deinem MacBook Port:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
define static profile
profile static_eth0
static ip_address=192.168.1.222/24
static routers=192.168.1.1
static domain_name_servers=192.168.178.1

# fallback to static profile on eth0
interface eth0
fallback static_eth0 ## 
Eigentlich doch ganz einfach, oder ?! face-wink
Member: Visucius
Visucius Mar 24, 2020 at 15:43:36 (UTC)
Goto Top
Eigentlich doch ganz einfach, oder ?! face-wink
Jupp ... eigentlich face-wink

Vielen Dank, die Option mit dem Fallback war mir gar nicht bekannt. Das ist ja prima, gerade bei wechselnden Setups.
Member: aqui
Solution aqui Mar 24, 2020 at 16:07:02 (UTC)
Goto Top
Ist ja auch ein RasPi bzw. Linux ! face-wink

Case closed !