DEV Community

IPYE
IPYE

Posted on

One Address per Service: A Design Pattern for Your Free /48

Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.

IPv4 scarcity trained a generation of operators to pack services onto as few addresses as possible: name-based virtual hosts, many ports on one address, and reverse proxies multiplexing everything. With a /48 there is no reason to do that. Each /64 holds more addresses than you will ever use, so every service can have its own. That small change makes moves, firewalls, logs and incident response simpler. This article describes the pattern for a network numbered from a free IPv6 /48 from IPYE, with examples in 2001:db8:100::/48.

The pattern

  1. Each service gets a dedicated /128 from a services /64, such as 2001:db8:100:10::/64.
  2. The address lives on a dummy or loopback interface on whichever host currently runs the service, never on a physical NIC.
  3. DNS names point at the service address, not at a host address.
  4. The service binds only to its own address.
  5. Hosts keep their own separate addresses for management.

Choosing addresses

Make addresses memorable, because people will read them in logs and packet captures:

Service Address
Public website 2001:db8:100:10::443
API 2001:db8:100:10::8443
Authoritative DNS 2001:db8:100:10::53
Mail relay 2001:db8:100:10::25
Git 2001:db8:100:10::22

These look like port numbers but are written in hexadecimal groups, so ::443 is not literally port 443. It is simply an easy mnemonic. Keep a table like this in your address plan.

Configure the address

On Linux with systemd-networkd:

# /etc/systemd/network/20-svc.netdev
[NetDev]
Name=svc0
Kind=dummy

# /etc/systemd/network/20-svc.network
[Match]
Name=svc0

[Network]
Address=2001:db8:100:10::443/128
IPv6DuplicateAddressDetection=0
Enter fullscreen mode Exit fullscreen mode

Then bind the service to it:

server {
    listen [2001:db8:100:10::443]:443 ssl;
    server_name www.example.net;
}
Enter fullscreen mode Exit fullscreen mode

Routing to the service address

A /128 on a dummy interface is not on any LAN, so the router needs a route to it. There are three common ways:

  • Static routes on the router, such as 2001:db8:100:10::443/128 via the host's address. This is simple, but you must change the route when the service moves.
  • A routing protocol from the host. FRR or BIRD on the host announces the /128 to the router over BGP or OSPFv3. Moving the service then means moving the address and letting routing follow.
  • A health-checked announcement. The host announces the /128 only while the service passes a local health check, which gives you automatic failover between hosts.

Whatever you choose, the router announces only the /48 to the Internet. The /128s stay internal.

What you gain

Moves without DNS changes. Move the address to a new host and update the route. DNS does not change, so there is no TTL wait.

Firewall rules that describe intent. allow tcp 443 to 2001:db8:100:10::443 says exactly what it means. There is no shared address where opening a port for one service accidentally opens it for another.

Clean logs. Destination addresses in flow logs and firewall logs identify the service directly. An abuse report naming one address points at one service.

Simple certificates and TLS. Each service terminates its own TLS on its own address. SNI is still used, but you are not relying on one front end to route everything.

Containment during attacks. If one service is attacked, you can blackhole or filter its /128 without touching others.

Outbound traffic

Outbound connections from a host normally use the host's address, not the service address. If a service must send from its own address, for example a mail relay whose address appears in SPF records, configure it explicitly. Postfix uses smtp_bind_address6, and many clients have a bind or source address setting. Alternatively, use a source-specific route: ip -6 route add default via 2001:db8:100:1::1 src 2001:db8:100:10::25 table 25 with a matching rule.

Watch out for

  • Services that bind to ::. They listen on every address on the host, including other services' addresses. Check with ss -tlnp after deploying.
  • Duplicate address detection. Disable it on dummy interfaces, as shown above, so the address is usable immediately at boot.
  • The same address on two hosts. That is fine for anycast through routing, but not on a shared LAN.

Announcing the /48

All of these service addresses sit inside one announced /48. Upstreams will need the LOA from the IPYE portal, and the ROA takes care of itself, since IPYE creates it on the ARIN or APNIC account that holds the prefix.

Do this next

Claim your free /48, pick a services /64, and move one service to its own /128 on a dummy interface as a first trial. Questions: ipye@turnel.com.

About IPYE

IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: ipye@turnel.com.

Disclosure: I run IPYE

Top comments (0)