Pi ağ geçidi: ifup eth0 üzerinde "RTNETLINK answers: File exists" ve açılıştan sonra keepalive kopmaları
Yapay zekâ tarafından English dilinden çevrildi ·
İlk gönderim, bir süredir burayı okuyorum.Küçük bir trafo merkezi için Raspberry Pi 3B+ (Raspberry Pi OS Bullseye) üzerinde kendi ağ geçidimizi kurduk: üç adet Modbus RTU sayacını okuyup v1/gw/telemetry üzerinden yayınlıyor. Trafo merkezi LAN’ında DHCP yok, bu yüzden eth0’a sabit bir adres vermek gerekiyor. /etc/network/interfaces dosyasına şunu ekledim:
auto eth0
iface eth0 inet static
address 10.40.2.20
netmask 255.255.255.0
gateway 10.40.2.1
dns-nameservers 10.40.2.1
Yeniden başlattıktan sonra bazen çalışıyor, bazen çalışmıyor. Çalışmadığında sudo ifup eth0 şunu söylüyor:
RTNETLINK answers: File exists
ifup: failed to bring up eth0
Hermetry’de ağ geçidinin Log sekmesi her açılışta yaklaşık bir keepalive_timeout bağlantı kopmasını gösteriyor; ardından birkaç dakika sonra yeniden bağlanıyor ya da ben sahaya gidip oturum açana kadar hiç bağlanmıyor. ip addr bazen eth0 üzerinde iki adres gösteriyor: sabit olan ve bir 169.254 adresi.
First post, I have been reading here for a while.
We built our own gateway on a Raspberry Pi 3B+ (Raspberry Pi OS Bullseye) for a small substation: it reads three Modbus RTU meters and publishes them on v1/gw/telemetry. The substation LAN has no DHCP, so eth0 needs a static address. I added this to /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 10.40.2.20
netmask 255.255.255.0
gateway 10.40.2.1
dns-nameservers 10.40.2.1
After a reboot it sometimes works and sometimes not. When it does not, sudo ifup eth0 says:
RTNETLINK answers: File exists
ifup: failed to bring up eth0
In Hermetry the gateway’s Log tab shows a keepalive_timeout disconnect around every boot and then it reconnects some minutes later, or not at all until I log in on site. ip addr sometimes shows two addresses on eth0, the static one and a 169.254 one.
Yapay zekâ tarafından English dilinden çevrildi ·
Önce ifdown, sonra ifup denediniz mi?
Did you try ifdown first and then ifup?
Yapay zekâ tarafından English dilinden çevrildi ·
Evet, ifdown interface eth0 not configured çıktısı veriyor ve ardından ifup da aynı şekilde başarısız oluyor.
Yes, ifdown says interface eth0 not configured and ifup fails the same way afterwards.
Yapay zekâ tarafından English dilinden çevrildi ·
Bullseye ağ yapılandırması için dhcpcd kullanır. /etc/network/interfaces eski yöntemdir, ikisini karıştırmamanızı öneririm.
Bullseye uses dhcpcd for networking. /etc/network/interfaces is the old way, I would not mix them.
Yapay zekâ tarafından English dilinden çevrildi ·
Daniel haklı. Geçen yıl bir pompa istasyonundaki Pi’de tam olarak bunu yaşadım. eth0’ı yapılandıran iki şey var: dhcpcd önyüklemede başlıyor, DHCP sunucusu bulamayınca porta 169.254 link-local adresi ve rotalar veriyor, ardından ifup kendi adresini ve varsayılan rotasını eklemeye çalışıyor. Rota zaten var olduğu için çekirdek “File exists” yanıtını veriyor ve ifup pes ediyor. Önyüklemede hangisinin yarışı kazanmasına bağlı olarak ağ geçidiniz çıkabiliyor ya da çıkamıyor.Birini seçin. Bullseye’da bu dhcpcd demek. /etc/network/interfaces dosyasından eth0 bloğunu kaldırın (dosyada yalnızca source satırı kalsın) ve statik ayarı /etc/dhcpcd.conf dosyasına koyun:
interface eth0
static ip_address=10.40.2.20/24
static routers=10.40.2.1
static domain_name_servers=10.40.2.1
noipv4ll
Ardından yeniden başlatmadan temizleyin:
sudo ip addr flush dev eth0
sudo systemctl restart dhcpcd
ip addr show eth0
noipv4ll 169.254 adresini durdurur. Daha sonra Bookworm’a geçerseniz dhcpcd kaldırılmış olur ve aynısını nmcli ile yaparsınız, bunu not edin.
Daniel has it. I hit exactly this on a pumping station Pi last year. Two things are configuring eth0: dhcpcd starts at boot, finds no DHCP server and gives the port a 169.254 link-local address plus routes, and then ifup tries to add its own address and default route. The route is already there, so the kernel answers “File exists” and ifup gives up. Depending on which one wins the race at boot, your gateway gets out or not.
Pick one. On Bullseye that means dhcpcd. Remove the eth0 block from /etc/network/interfaces (leave the file with only the source line) and put the static setup in /etc/dhcpcd.conf:
interface eth0
static ip_address=10.40.2.20/24
static routers=10.40.2.1
static domain_name_servers=10.40.2.1
noipv4ll
Then clean up without a reboot:
sudo ip addr flush dev eth0
sudo systemctl restart dhcpcd
ip addr show eth0
noipv4ll stops the 169.254 address. If you move to Bookworm later, dhcpcd is gone and you do the same with nmcli, so keep a note of that.
Yapay zekâ tarafından English dilinden çevrildi ·
Pi OS sürümlerinin bunu değiştirdiğini bilmiyordum, bilmek güzel.
Didn’t know the Pi OS versions changed this, good to know.
Yapay zekâ tarafından English dilinden çevrildi ·
Çözüldü. Interfaces dosyası temizlendi, dhcpcd.conf içinde noipv4ll ile statik yapılandırma yapıldı. Bu sabah Pi’yi arka arkaya on kez yeniden başlattım ve gateway her seferinde birkaç saniye içinde bağlandı. Log sekmesinde artık her açılışta tek ve temiz bir bağlantı görünüyor.
Fixed. Interfaces file cleaned, static config in dhcpcd.conf with noipv4ll, rebooted the Pi ten times in a row this morning and the gateway connected within a few seconds every time. The Log tab now shows one clean connect per boot.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

