Hallo,
ich versuche verzweifelt, eine feste IP einzustellen.
Hab das nach dieser Anleitung gemacht: https://edv-loesungen.info/blog/78-setzen-einer-statischen-ip-adresse-unter-linux-debian (https://edv-loesungen.info/blog/78-setzen-einer-statischen-ip-adresse-unter-linux-debian)
Jedoch führte das immer dazu, dass mein Raspberry irgendwie 2 IP-Adressen hat und nach einem Neustart unerreichbar ist, so das mir nichts anderes übrig bleibt, als alles neu aufzusetzten.
pi@smarthome:~ $ ip -c addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP gr oup default qlen 1000
link/ether b8:27:eb:f0:41:64 brd ff:ff:ff:ff:ff:ff
inet 192.168.178.42/24 brd 192.168.178.255 scope global dynamic noprefixrout e eth0
valid_lft 863391sec preferred_lft 755391sec
inet 192.168.178.151/24 brd 192.168.178.255 scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 2003:d5:6f14:6000:c50e:8cce:779d:c977/64 scope global dynamic mngtmpad dr noprefixroute
valid_lft 6747sec preferred_lft 1347sec
inet6 fe80::77de:5a8d:8625:b56e/64 scope link
valid_lft forever preferred_lft forever
Wie macht ihr das?
LG
Marlen
Ich bin ja nicht sicher aber /etc/network/interfaces ist doch schon alt/outdated?
Bzw. mache ich das seit Stretch, auf jeden Fall seit Buster so:
sudo nano /etc/dhcpcd.conf
Dort ist ganz unten ein auskommentiertes Beispiel drin.
Einfach einkommentieren und anpassen...
Hier mal mein Eintrag:
profile static_eth0
static ip_address=192.168.1.123/24
static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
static domain_name_servers=192.168.1.125 8.8.8.8
interface eth0
fallback static_eth0
fallback->wenn keine DHCP-Antwort, dann statisch. Wenn du NUR statisch willst, dann ohne diesen Eintrag...
EDIT: der auskommentierte domain_name_servers Eintrag war "früher" mal, jetzt läuft das über mein piHole (und zur Not über 8.8.8.8 )...
Gruß, Joachim
Super! Danke, hat geklappt. :-*
Was spricht denn gegen eine statische Zuweisung über den DHCP-Server?
Edith meint, man sollte
inform bevorzugen:
Zitatstatic value
Configures a static value. If you set ip_address then dhcpcd
will not attempt to obtain a lease and will just use the value
for the address with an infinite lease time. If you set
ip6_address, dhcpcd will continue auto-configuration as normal.
Here is an example which configures two static address,
overriding the default IPv4 broadcast address, an IPv4 router,
DNS and disables IPv6 auto-configuration. You could also use the
inform6 command here if you wished to obtain more information via
DHCPv6. For IPv4, you should use the inform ipaddress option
instead of setting a static address.
interface eth0
noipv6rs
static ip_address=192.168.0.10/24
static broadcast_address=192.168.0.63
static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
fd51:42f8:caae:d92e::1
request [address]
Request the address in the DHCP DISCOVER message. There is no
guarantee this is the address the DHCP server will actually give.
If no address is given then the first address currently assigned
to the interface is used.
inform [address[/cidr[/broadcast_address]]]
Behaves like request as above, but sends a DHCP INFORM instead of
DISCOVER/REQUEST. This does not get a lease as such, just
notifies the DHCP server of the address in use. You should also
include the optional cidr network number in case the address is
not already configured on the interface. dhcpcd remains running
and pretends it has an infinite lease. dhcpcd will not de-
configure the interface when it exits. If dhcpcd fails to
contact a DHCP server then it returns a failure instead of
falling back on IPv4LL.
https://www.daemon-systems.org/man/dhcpcd.conf.5.html (https://www.daemon-systems.org/man/dhcpcd.conf.5.html)
[OT]
Zitat von: MadMax-FHEM am 07 Dezember 2021, 09:11:38EDIT: der auskommentierte domain_name_servers Eintrag war "früher" mal, jetzt läuft das über mein piHole (und zur Not über 8.8.8.8 )...
Niemals! Lieber was Freies wählen (https://www.privacy-handbuch.de/handbuch_93d.htm).
Hier eine Liste von öffentlichen DNS: https://dnscrypt.info/public-servers (https://dnscrypt.info/public-servers)
[/OT]
Zitat von: yersinia am 07 Dezember 2021, 09:55:38
Was spricht denn gegen eine statische Zuweisung über den DHCP-Server?
Habe ich ja...
...aber für den Fall der Fälle (keine Antwort vom DHCP) -> fallback.
Zitat von: yersinia am 07 Dezember 2021, 09:55:38
[OT]Niemals! Lieber was Freies wählen (https://www.privacy-handbuch.de/handbuch_93d.htm).
Hier eine Liste von öffentlichen DNS: https://dnscrypt.info/public-servers (https://dnscrypt.info/public-servers)
[/OT]
Naja: niemals ist ja etwas "hart" ;)
Muss ja jeder selber entscheiden (dürfen) 8)
Auf piHole habe ich auch nur "vertrauenswürdige" eingetragen...
...warum das (noch) in der dhcpcd.conf steht: ;)
Gruß, Joachim
Zitat von: MadMax-FHEM am 07 Dezember 2021, 09:11:38
Ich bin ja nicht sicher aber /etc/network/interfaces ist doch schon alt/outdated?
Solange kein NetworkManager/netplan.io oder ähnliches am Start ist funktioniert das immer noch tadellos!
Gruß aus L.E.
Uwe