You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Hetzner服务器Netplan配置执行netplan apply后断连的诊断方法咨询

Hetzner服务器Netplan配置执行netplan apply后断连的诊断方法咨询

Hey there, let's walk through how to diagnose the connection loss you're seeing after running netplan apply on your Hetzner server. First, let's recap the config you shared (I've fixed the indentation to match YAML's strict requirements, since indentation breaks things easily here):

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
  bridges:
    br0:
      interfaces: [eno1]
      addresses:
        - IP/32
      routes:
        - on-link: true
          to: 0.0.0.0/0
          via: Gateway
      nameservers:
        addresses:
          - 1.1.1.1
          - 1.0.0.1

Now let's go through the key diagnostic steps:

  • First, validate your Netplan config syntax
    YAML is super picky about indentation and formatting, so run sudo netplan generate to check for errors. This command parses your config and spits out issues like missing indentation, typos in field names, or invalid values before you apply it—catching these early saves you from unexpected disconnections.

  • Check if your physical NIC needs promiscuous mode
    Hetzner's network environment requires the physical ethernet port (eno1 in your case) to have promiscuous mode enabled for bridging to work properly. Add this line to your eno1 config:

    ethernets:
      eno1:
        dhcp4: no
        promiscuous: true
    

    Without this, the bridge might not forward traffic correctly, leading to lost connectivity.

  • Verify your IP and gateway settings
    Double-check that the IP/32 set for br0 is your server's actual main IP from Hetzner, and that the Gateway is the correct one listed in your Hetzner Robot dashboard (usually the first IP in your subnet). For /32 addresses, the on-link: true flag in your routes is correct, but a wrong gateway will block all internet access.

  • Inspect system logs for networkd errors
    If you can access the server via Hetzner's KVM console or Rescue System, run journalctl -u systemd-networkd to see detailed logs from the networkd renderer. Look for lines like "failed to bring up br0" or "eno1 cannot be added to bridge"—these point directly to what's failing.

  • Temporarily restore connectivity to debug
    If you're stuck disconnected, manually bring back the eno1 interface to regain access:

    1. Bring down the bridge: sudo ip link set br0 down
    2. Bring up eno1: sudo ip link set eno1 up
    3. Assign your IP manually: sudo ip addr add IP/24 dev eno1
    4. Set the default route: sudo ip route add default via Gateway dev eno1
      This lets you reconnect remotely so you can tweak the Netplan config safely.
  • Test bridge connectivity locally first
    Once you apply the config (and can access via KVM), run these commands to check the network state:

    • ip addr to confirm br0 has the correct IP and eno1 is part of the bridge
    • ip route to verify the default route points to your gateway via br0
    • ping Gateway to check if you can reach the gateway directly
    • ping 1.1.1.1 to test DNS and internet connectivity

备注:内容来源于stack exchange,提问作者Mads Iversen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 07:58:11