How to Manually Add Hetzner Default Gateway for Private Network in Tech Support: A Step-by-Step Guide

Abstract: Add a static route for the Hetzner private subnet to prevent internet loss while keeping the default gateway on the public interface.

Created: 2026-10-02 by

To resolve connectivity issues on a Hetzner private network, you must ensure the default gateway remains bound to your public interface (typically eth0) while adding a specific route for the private subnet via the private interface (ens3, enpXsY, or similar). Modern Linux distributions use Netplan or systemd-networkd, making manual edits to /etc/network/interfaces obsolete and potentially dangerous if they overwrite the primary gateway configuration.

Understanding Network Interface Roles

Before applying any configuration changes, it is critical to distinguish between your public and private network interfaces. In Hetzner data centers, the public IP address is always assigned to the primary interface, which serves as the default gateway for all outbound traffic to the internet. This is typically named eth0 on older systems or follows the predictable naming convention of enpXsY (e.g., enp5s0) on newer kernels using systemd-udev. The private network interface, often referred to as the "Hetzner Robot" network, connects your server to other servers within the same data center. This interface does not have a default gateway. If you mistakenly set the private interface as the default gateway, your server will lose external internet access because it will attempt to route all traffic through the private VLAN, which has no path to the outside world. Therefore, the core rule is: the default gateway (0.0.0.0/0) must always point to the public interface's gateway IP, while the private subnet should be routed specifically through the private interface.

Verifying Current Network Configuration

Start by identifying your current network state. Run the following command to list all active routes:
ip route show
You should see a line that begins with default via. Note the IP address listed after "via" and the interface name at the end of that line. For example:
default via 213.133.98.1 dev eth0 proto dhcp src 178.XX.XX.XX metric 100
This confirms that eth0 is your public interface and its gateway is 213.133.98.1. Next, identify your private interface by checking its IP address range. Hetzner private networks typically use ranges like 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16. You can check this with:
ip addr show
Look for an interface that has an IP in one of these private ranges. Let’s assume for this guide that your private interface is named ens3 and your private subnet is 10.0.0.0/24 with a gateway of 10.0.0.1. Always verify these values from your Hetzner Robot console, as they vary per server.

Configuring Netplan (Ubuntu/Debian)

Most modern Hetzner Ubuntu images use Netplan for network management. The configuration files are located in /etc/netplan/. List the files in this directory to find the active YAML configuration:
ls /etc/netplan/
Open the relevant file (often named 50-cloud-init.yaml or 01-netcfg.yaml) using a text editor. It is crucial to edit this file carefully, as syntax errors can break networking. Do not remove the existing routes section for the default gateway. Instead, add a new entry for the private network. Your configuration should look something like this, ensuring the default gateway remains on the public interface:
network:
  version: 2
  ethernets:
    eth0: # Public interface
      dhcp4: true
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]
    ens3: # Private interface
      dhcp4: false
      addresses:
        - 10.0.0.2/24
      routes:
        - to: 10.0.0.0/24
          via: 10.0.0.1
          scope: link
      # Do NOT add a default gateway here
Key points: 1. The eth0 section retains dhcp4: true or static public IP settings. 2. The ens3 section defines the static private IP. 3. A routes block under ens3 specifies how to reach the private subnet. 4. No gateway4 or routes with to: 0.0.0.0/0 should exist under ens3. Apply the changes with:
sudo netplan apply
If the command fails, revert the file and check for YAML indentation errors.

Configuring systemd-networkd (Fedora/RHEL/CentOS)

For systems using systemd-networkd, configurations are stored in /etc/systemd/network/. You will likely have two files, such as 10-eth0.network and 20-ens3.network. Ensure the public interface file contains the default gateway:
[Network]
DHCP=yes

[Route]
Gateway=213.133.98.1
The private interface file should only define the address and a static route to the private subnet:
[Network]
Address=10.0.0.2/24

[Route]
Gateway=10.0.0.1
Destination=10.0.0.0/24
Restart the network service to apply changes:
sudo systemctl restart systemd-networkd

Testing Connectivity

After applying the configuration, test your connectivity. First, verify you can still reach the internet:
ping -c 4 google.com
Then, test connectivity to another server in the same private network:
ping -c 4 10.0.0.3
If the first ping fails, you may have accidentally overwritten the default gateway. Check your route table again with ip route show and ensure the default route still points to the public interface. If the second ping fails, verify that the firewall on the target server allows ICMP traffic and that the routing table on your server correctly lists the private subnet via the private interface.

Common Pitfalls

Avoid editing /etc/network/interfaces on Debian-based systems if Netplan is present, as Netplan generates the final configuration and may ignore manual edits. Similarly, do not use route add commands persistently without proper configuration files, as they will disappear on reboot. Always back up your network configuration files before making changes. For more complex setups involving multiple private subnets, consider reviewing related resources on managing network storage. See Unknown Issue in Setting up RAID 12 on Hetzner NVMe Drives for context on hardware-level configurations that might interact with network stability.

Frequently Asked Questions

Why did my internet connection drop after adding the private network?

You likely added a default gateway (0.0.0.0/0) to your private interface configuration. The system prioritizes the lowest metric route, so if both interfaces have a default gateway, the private one may take precedence, blocking external traffic. Remove the default gateway from the private interface config and keep it only on the public interface.

How do I find my Hetzner private network gateway IP?

Log into the Hetzner Robot web interface, select your server, and navigate to the "Network" tab. Under the "Private Network" section, you will see the IP address of the gateway for that specific VLAN. It is usually the first usable IP in the subnet provided.

Can I use DHCP for the private network interface?

Hetzner private networks generally do not support DHCP for client devices. You must assign a static IP address manually within the subnet range provided by Hetzner. Ensure the IP you choose is not already in use by another server in the same data center.

What if I am using Cloud-init and my config gets overwritten?

Netplan configurations generated by cloud-init are often stored in /run/netplan/ or merged with /etc/netplan/. To make persistent changes, edit the files in /etc/netplan/. If cloud-init regenerates the config, ensure your custom entries are preserved or merge them into the cloud-init template if you have access to modify it.

How do I troubleshoot if I can ping the gateway but not other private IPs?

This indicates a routing or firewall issue. Verify your routing table with ip route to ensure the private subnet is associated with the correct private interface. Then, check if the target server’s firewall (like UFW or iptables) is blocking ICMP or the specific port you are trying to reach. Ensure both servers are in the same private network VLAN.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More