interfaces
Rewrite
/etc/network/interfacesfor Proxmox with a bridge (vmbr0) on the server's public IP, and optionally build DHCP reservations for VM IPs
- Command:
/go/interfaces - Category: Network
- Required arguments: None
- Output: None (silent)
- Last updated: 2026-11-19
On this page: Overview · Quick start · Requirements · Syntax · Output · The generated file · VM addresses · Examples · Troubleshooting · Details · See also
Overview
/go/interfaces prepares a Debian server's network configuration for Proxmox VE. Proxmox VMs need a bridge, so the command moves the server's IP address from the physical network card onto a bridge named vmbr0. It:
- saves the original
/etc/network/interfacesonce as/etc/network/interfaces.bak - writes a new
/etc/network/interfaceswith the card as a bridge port andvmbr0holding the IP address, gateway, and (if present) IPv6 address - adds a route for every VM address listed in
/etc/vm - builds an ISC DHCP server configuration with a fixed address for each of those VM addresses
The command only writes files. It doesn't apply them, so nothing changes on the running network until you reload the network settings or reboot.
[!WARNING] This command rewrites the server's network configuration, and it checks almost nothing. A wrong file can leave the server unreachable after the next reboot. Keep access to the provider's console or rescue mode, and read the result before you apply it.
Quick start
# Generate the new file
/go/interfaces
# Check it, and compare it with the original
cat /etc/network/interfaces
diff /etc/network/interfaces.bak /etc/network/interfaces
Requirements
- Debian with
ifupdownorifupdown2managing the network through/etc/network/interfaces. Netplan, NetworkManager, andsystemd-networkdsetups aren't supported. - The server's public IPv4 address must be configured directly on its network card, not translated by the provider (NAT).
- Outbound internet access. The command asks
icanhazip.comfor the server's addresses. curl, andifconfig(fromnet-tools) for the fallback netmask lookup.- For VM reservations:
/etc/vmand the folder/etc/dhcp/.
Syntax
/go/interfaces
The command has no arguments or options. Any arguments are logged and ignored.
Output
The command prints nothing and exits with code 0, even if the file it wrote is wrong. Always read the result.
Logging
Every run is appended to /var/log/go/interfaces.log.
Backup
The first run copies /etc/network/interfaces to /etc/network/interfaces.bak. Later runs do not replace the copy, and always read the old settings from it: the address length, the gateway, the netmask, the subnet route, and the name of the network card. Keep the original backup. If you delete it and run the command again, the settings are read from the file that the command wrote last, which doesn't contain all of them.
The generated file
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface lo inet6 loopback # only with IPv6
iface <card> inet manual
auto vmbr0
iface vmbr0 inet static
address <public-ip>/<prefix>
gateway <gateway>
dns-nameservers 8.8.8.8
bridge_ports <card>
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up echo 1 > /proc/sys/net/ipv4/conf/<card>/proxy_arp
up ip route add <vm-ip>/32 dev vmbr0 # one per address in /etc/vm
iface vmbr0 inet6 static # only with IPv6
address <ipv6>
netmask 64
gateway <ipv6-gateway>
| Part | Where the value comes from |
|---|---|
address |
The server's public IPv4 address from icanhazip.com. The prefix length comes from the original file. If the original has none, only the address is written. |
gateway |
The original file, or the current default route if the original has none. |
<card> |
The last network card (ignoring lo, vmbr0, and names with _ or -) whose name appears in the original file. |
dns-nameservers |
Always 8.8.8.8. |
| IPv6 address and gateway | The IPv6 address from icanhazip.com and the current IPv6 default route. They are used only if both exist. The prefix is always 64. |
IP forwarding and proxy ARP are switched on at post-up, so the server routes traffic for the VM addresses.
VM addresses
If /etc/vm exists, the command also writes /etc/dhcp/dhcpd.conf, replacing the existing file.
/etc/vm lists one VM address or subnet per line. Only lines that start with a digit are used.
203.0.113.21
203.0.113.32/29
For each line the command:
- adds
up ip route add <address>/32 dev vmbr0(or the subnet as written) to thevmbr0block - adds a DHCP
hostentry namedVM101,VM102, and so on, with a random MAC address, the gateway, the netmask, and the fixed address
The subnet block at the top of dhcpd.conf uses the subnet from the original file's up route add -net line, and lease times of 21,600,000 and 432,000,000 seconds.
Examples
# Generate the Proxmox network file
/go/interfaces
# Review the result
cat /etc/network/interfaces
cat /etc/dhcp/dhcpd.conf
# Go back to the original network file
cp /etc/network/interfaces.bak /etc/network/interfaces
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| The server is unreachable after a reboot | The generated file is wrong: an empty address, gateway, or card name, or an address that isn't on the card. |
Use the provider's console or rescue mode, and restore /etc/network/interfaces.bak. |
address has no value |
The curl lookup failed. |
Check the internet access, then run the command again. |
iface inet manual and bridge_ports are empty |
No card name was found in the original file. | Write the card name by hand. |
| The wrong address was written | The server is behind NAT, so the public address isn't the one on the card. | Write the address from ip -4 addr by hand. |
| The address has no prefix length and the netmask is missing | The original file used a separate netmask line, and the new file never writes one. |
Add /<prefix> to the address line. |
dhcpd.conf has the netmask 25255.255.255.128 |
A typo in the /25 case of the script. | Correct the value by hand. |
dhcpd doesn't start |
The subnet line is empty, because the original file has no up route add -net line. |
Fill in the subnet. |
| VMs lost their addresses after a second run | The command generates new random MAC addresses every time. | Give the VMs the new MAC addresses, or avoid running it again. |
| Changes don't take effect | The command only writes files. | Apply them (for example with ifreload -a on ifupdown2) or reboot, and restart the DHCP server. |
| IPv6 doesn't work | The prefix is always 64, or the lookup returned a temporary address. |
Edit the IPv6 block. |
| DNS answers come from Google | 8.8.8.8 is fixed. |
Edit the dns-nameservers line. |
Details
What it does
- Logs the call, and saves
/etc/network/interfacesas/etc/network/interfaces.bakif that copy doesn't exist. - Asks
icanhazip.comfor the public IPv4 and IPv6 addresses. - From the backup, reads the prefix length, the gateway, the netmask, and the subnet route. If the gateway or netmask isn't a valid IPv4 address, it uses the current default route and
ifconfig. For prefix lengths from/24to/30it replaces the netmask with the matching value. - Reads the default IPv6 gateway.
- Finds the network card: the last name in
/sys/class/netthat appears in the backup. - Overwrites
/etc/network/interfacesas shown above. - If
/etc/vmexists: overwrites/etc/dhcp/dhcpd.conf, and adds routes and DHCP reservations for each address. - If an IPv6 address and gateway exist: adds the IPv6 block at the end.
flowchart TD
A["interfaces"] --> B["Back up interfaces once"]
B --> C["Look up public IPv4 and IPv6"]
C --> D["Read prefix, gateway, netmask, subnet, card from the backup"]
D --> E["Write new interfaces file with vmbr0"]
E --> F{"/etc/vm exists?"}
F -- "Yes" --> G["Write dhcpd.conf, add routes and reservations"]
F -- "No" --> H["Skip"]
G --> I["Add IPv6 block if available"]
H --> I
Notes for maintainers
| Issue | Why it matters | Suggested fix |
|---|---|---|
| Nothing is checked before writing | An empty address, gateway, or card writes a broken file. | Stop with an error unless every value is valid. Write to a temporary file and test it before replacing the real one. |
| The IPv4 address comes from a public web service | It is wrong behind NAT, the lookup can fail, and an outside service decides the server's network configuration. | Read the address from the card with ip -4 addr. |
The /25 case sets 25255.255.255.128 |
Invalid netmask in dhcpd.conf for /25 networks. |
Compute the netmask from the prefix length for every value. |
| The netmask is never written to the interfaces file | If the original had no /prefix, the interface has no mask. |
Always write the prefix, taken from the card. |
| Random MAC addresses on every run | Existing VMs lose their reservations. | Save the MACs, or derive them from the IP address. |
| The network card is found by substring and the last match wins | May pick the wrong card, or none. | Use the card of the default route (ip route show default). |
| Only one card, no bonds or VLANs | Servers with these setups are broken by the rewrite. | Detect and copy such settings. |
dns-nameservers is fixed to 8.8.8.8 |
Ignores the provider's resolvers. | Keep the existing nameservers, or make it a setting. |
IPv6 uses a fixed /64 and the address seen from outside |
Wrong for other prefixes, and the address can be a temporary one. | Read the address and prefix from the card. |
dhcpd.conf is overwritten, with extreme lease times, and dhcpd isn't reloaded |
Local DHCP changes are lost, and leases last about 250 days. | Merge instead of overwrite, set sensible leases, and reload the service. |
| The settings are read from the first backup forever | An outdated backup misleads later runs, and a backup made from an already modified file is wrong. | Check the backup, and explain how to refresh it. |
curl has no time limit |
A broken IPv6 route can make the command wait. | Add --max-time. |
ifconfig is needed for the fallback |
net-tools is not installed by default on recent Debian. |
Use ip. |
| Nothing is applied or tested | No dry run and no way to apply. | Add an option that runs ifup --no-act or ifreload -a -n, and one that applies the file. |
Many separate echo | sudo tee -a calls |
Slow and hard to read. | Write the file with one here-document. |
See also
| Command | Description |
|---|---|
proxmox |
Install Proxmox VE |
ipv6 |
Enable, disable, or configure IPv6 on the server |
resolver |
Change the DNS resolver in GoAdmio |
hostname |
Change the hostname in GoAdmio |
checkfirewall |
Verify that important required ports are open on your server |
reversedns |
Check reverse DNS (rDNS) in GoAdmio |