How to Use a Routed Subnet

When you order RackGenius colocation or a dedicated server with an additional subnet, the server is delivered with a main IP and a routed subnet. A routed subnet directs all IPs within the subnet to the main IP. This removes the need for a separate gateway, and in most configurations lets you use every IP in the subnet.

For example, a /29 routed subnet gives you all 8 usable IPs. Because the block is routed to your main IP rather than placed on a shared LAN, there is no network, broadcast, or gateway address to reserve.

To configure this, connect to the server on its main IP and add the subnet inside the operating system using one of the guides below.

Need rDNS (PTR) records? Reverse DNS for any IP in your routed subnet can be set from your RackGenius dedicated server contol panel or in your client portal for colocation customers.

Example Setup

The OS guides below all use the following example addressing:

  • Main IP: 198.51.100.100/25
  • Routed Subnet: 203.0.113.8/29

Substitute your own main IP, gateway, and subnet wherever these appear.

Ubuntu 22.04 / 24.04 (Netplan)

Ubuntu manages networking with Netplan, which uses YAML configuration files.

Back up the current configuration:

cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak

Open the config file in a text editor:

nano /etc/netplan/00-installer-config.yaml

The default configuration looks similar to this:

network:
  ethernets:
    all_interfaces:
      addresses:
        - 198.51.100.100/25
      gateway4: 198.51.100.1
      match:
        macaddress: 4f:43:d6:f9:7d:67
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1
  version: 2

Add each IP from the routed subnet as an individual /32 address beneath the main IP. YAML is indentation-sensitive, so keep the alignment exact:

network:
  ethernets:
    all_interfaces:
      addresses:
        - 198.51.100.100/25
        - 203.0.113.8/32
        - 203.0.113.9/32
        - 203.0.113.10/32
        - 203.0.113.11/32
        - 203.0.113.12/32
        - 203.0.113.13/32
        - 203.0.113.14/32
        - 203.0.113.15/32
      gateway4: 198.51.100.1
      match:
        macaddress: 4f:43:d6:f9:7d:67
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1
  version: 2

Newer Netplan releases: the gateway4 key is deprecated and will log a warning on Ubuntu 24.04. It still works, but the modern equivalent is a routes block:

      routes:
        - to: default
          via: 198.51.100.1

Use it in place of the gateway4 line if you want a warning-free config.

Validate the syntax:

netplan generate

Apply the configuration with a safety timer:

netplan try

If your connection is still up, press Enter to commit. If something is wrong and you lose access, the configuration automatically reverts after 120 seconds.

Debian 11 / Debian 12 / Debian 13

Debian manages networking with ifupdown, which uses the /etc/network/interfaces file.

Back up the current configuration:

cp /etc/network/interfaces /etc/network/interfaces.bak

Open the config file:

nano /etc/network/interfaces

The default configuration looks similar to this. Note the interface name, which is enp1s0f0 in this example:

allow-hotplug enp1s0f0
iface enp1s0f0 inet static
    address 198.51.100.100/25
    gateway 198.51.100.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8
    dns-search unassigned-domain

Routed IPs are added by creating an interface alias for each IP in the range. Add the first one, appending :0 to the interface name:

auto enp1s0f0:0
iface enp1s0f0:0 inet static
    address 203.0.113.8
    netmask 255.255.255.255

Repeat for each additional IP, incrementing the alias number (:1, :2, and so on). The finished config looks similar to this:

allow-hotplug enp1s0f0
iface enp1s0f0 inet static
    address 198.51.100.100/25
    gateway 198.51.100.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8
    dns-search unassigned-domain

auto enp1s0f0:0
iface enp1s0f0:0 inet static
    address 203.0.113.8
    netmask 255.255.255.255

auto enp1s0f0:1
iface enp1s0f0:1 inet static
    address 203.0.113.9
    netmask 255.255.255.255

auto enp1s0f0:2
iface enp1s0f0:2 inet static
    address 203.0.113.10
    netmask 255.255.255.255
# etc...

Save the file and restart networking to apply:

systemctl restart networking

AlmaLinux 8 & 9 / Rocky Linux 8 & 9 (NetworkManager)

AlmaLinux and Rocky Linux use NetworkManager, managed from the command line with nmcli.

Find the interface holding your main IP:

ip addr

In this example the main IP is on enp1s0f0:

2: enp1s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 4f:43:d6:f9:7d:67 brd ff:ff:ff:ff:ff:ff
    altname ens18
    inet 198.51.100.100/25 scope global noprefixroute enp1s0f0
       valid_lft forever preferred_lft forever

Back up the connection profile. It lives in /etc/NetworkManager/system-connections/ and is prefixed with the interface name:

cp /etc/NetworkManager/system-connections/enp1s0f0.nmconnection /etc/NetworkManager/system-connections/enp1s0f0.nmconnection.bak

Add the first routed IP with nmcli:

nmcli connection modify "enp1s0f0" +ipv4.addresses "203.0.113.8/32"

Repeat for every IP in the subnet:

nmcli connection modify "enp1s0f0" +ipv4.addresses "203.0.113.9/32"
nmcli connection modify "enp1s0f0" +ipv4.addresses "203.0.113.10/32"
# etc...

Reload to apply the changes:

systemctl restart NetworkManager

Windows Server 2022

On Windows, using a routed subnet requires two steps: enable IP forwarding, then add each subnet IP to the adapter's IPv4 properties.

Open regedit and navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Right-click IPEnableRouter, choose Modify, and change the value data from 0 to 1.

Click OK, then reboot the server for the change to take effect.

After the reboot, open Network Connections (ncpa.cpl) and open the Properties of your network adapter. Open the properties of Internet Protocol Version 4 (TCP/IPv4), then click Advanced.

In the IP addresses section, click Add.

Enter the first IP of the routed subnet with a subnet mask of 255.255.255.255, then click Add.

Repeat for every IP in the subnet. When all IPs are added, click OK on each open dialog. On the final window the OK button changes to Close; click it to apply the new IPs.

Proxmox VE 8 and up

Proxmox VE 8 and up is based on Debian, so the host networking is configured the same way as a standard Debian install. In a typical setup the main IP is used for Proxmox host administration, and the routed subnet IPs are handed out to guest VMs.

Back up the current configuration:

cp /etc/network/interfaces /etc/network/interfaces.bak

Open the config file:

nano /etc/network/interfaces

The default configuration looks similar to this:

allow-hotplug enp1s0f0
iface enp1s0f0 inet static
    address 198.51.100.100/25
    gateway 198.51.100.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8
    dns-search unassigned-domain

At the bottom of the file, add a bridge. Pick one usable IP from the subnet as the bridge address; this becomes the gateway your VMs point to:

auto vmbr0
iface vmbr0 inet static
    address 203.0.113.9/29
    bridge-ports none
    bridge-stp off
    bridge-fd 0

Next, enable IP forwarding on the host. Edit /etc/sysctl.conf:

nano /etc/sysctl.conf

Find the following line and uncomment it:

net.ipv4.ip_forward=1

Restart networking to apply:

systemctl restart networking

vmbr0 now appears as a Linux Bridge under System > Network in the Proxmox node settings.

When creating a VM, select vmbr0 as the network bridge so the guest can use a public IP.

Proxmox Guest VM Examples

Configure each VM with an IP from the subnet as normal, using the bridge address you set on the host (203.0.113.9 in this example) as the gateway.

Ubuntu (Netplan):

network:
  ethernets:
    all_interfaces:
      addresses:
        - 203.0.113.10/29
      gateway4: 203.0.113.9
      match:
        macaddress: 4f:43:d6:f9:7d:67
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1
  version: 2

Debian (ifupdown):

allow-hotplug ens18
iface ens18 inet static
    address 203.0.113.10/29
    gateway 203.0.113.9
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8
    dns-search unassigned-domain

AlmaLinux / Rocky Linux: configure the IP during installation, or afterward with the nmtui text interface. Use the subnet IP as the address and the host bridge IP (203.0.113.9) as the gateway.

Windows: set the IP, subnet mask, and gateway under the adapter's IPv4 properties, using the host bridge IP (203.0.113.9) as the default gateway.

Need a Hand?

If a subnet is not routing as expected, open a ticket with your server hostname, the OS in use, and the exact configuration you applied. Our team can confirm the routing on our side and help you finish the setup.

آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)