Networking.

Configuring Networking

Your assigned IPs, gateway, and interface name can be found in your onboarding email, or by messaging us.
Throughout this guide:

  • YOUR_PUBLIC_IP refers to your routable 23.131.76.x address
  • YOUR_PRIVATE_IP refers to the native address used for internal routing on the host, typically acquired through DHCP.
  • GATEWAY_IP refers to the private gateway IP, typically acquired through DHCP. This gateway is responsible for routing both public and private traffic.

ifupdown2

Apply the configuration immediately so you don’t need a reboot:

ip addr add dev YOUR_INTERFACE YOUR_PUBLIC_IP/32
ip route replace default via GATEWAY_IP src YOUR_PUBLIC_IP

Persist it by adding the following to /etc/network/interfaces:

post-up ip addr add dev YOUR_INTERFACE YOUR_PUBLIC_IP/32
post-up ip route replace default via GATEWAY_IP src YOUR_PUBLIC_IP

NetworkManager

Create a script at /etc/NetworkManager/dispatcher.d/post-up.sh:

#!/usr/bin/env bash
interface=$1
event=$2

if [[ $interface != "YOUR_INTERFACE" ]] || [[ $event != "up" ]]; then
    exit 0
fi

ip addr add dev YOUR_INTERFACE YOUR_PUBLIC_IP/32
ip route replace default via GATEWAY_IP src YOUR_PUBLIC_IP

Make it executable:

chmod +x /etc/NetworkManager/dispatcher.d/post-up.sh

The script will run automatically when the interface comes up.


Netplan

First, remove cloud-init to prevent it from overwriting your network config on reboot:

sudo apt remove cloud-init

Then edit /etc/netplan/50-cloud-init.yaml:

network:
  version: 2
  ethernets:
    YOUR_INTERFACE:
      addresses:
        - YOUR_PRIVATE_IP/24
        - YOUR_PUBLIC_IP/32
      routes:
        - to: default
          via: GATEWAY_IP
          from: YOUR_PUBLIC_IP
      mtu: 1500
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

Apply with automatic rollback so if you lose connectivity, it reverts after 120 seconds:

sudo netplan try

Press Enter to confirm if everything looks good.


systemd-networkd

Create a .network file in /etc/systemd/network/, for example /etc/systemd/network/10-YOUR_INTERFACE.network:

[Match]
Name=YOUR_INTERFACE

[Network]
DHCP=ipv4
Address=YOUR_PUBLIC_IP/32

[DHCPv4]
RoutesToDNS=false
UseRoutes=false

[Route]
Destination=0.0.0.0/0
Gateway=GATEWAY_IP
PreferredSource=YOUR_PUBLIC_IP

[DHCP]
UseDomains=no
RouteMetric=200

[Link]
RequiredForOnline=routable

Reload the configuration:

networkctl reload