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.
Alpine Linux can run entirely from RAM, loading its configuration from a small overlay file at boot. That makes it a good fit for a minimal edge router: the system image is read-only, the running state is small, and a reboot returns the box to exactly the configuration you last committed. This guide builds such a router for a free IPv6 /48 from IPYE, with 2001:db8:100::/48 as the prefix, AS64496 as our ASN and an upstream AS64511 reachable at 2001:db8:0:1::1.
The one Alpine habit to learn: lbu
In diskless mode, changes to /etc live in memory until you save them with the Local Backup Utility:
lbu status
lbu commit -d
lbu status lists files changed since the last commit, and lbu commit writes them to the overlay archive on the boot media. Forget to commit and a reboot discards your work. The habit of running lbu status before walking away from the console will save you a lot of confusion.
Interfaces
Alpine uses ifupdown-ng with the familiar /etc/network/interfaces format:
auto lo
iface lo inet loopback
address 2001:db8:100::1/128
auto eth0
iface eth0 inet6 static
address 2001:db8:0:1::2/64
gateway 2001:db8:0:1::1
auto eth1
iface eth1 inet6 static
address 2001:db8:100:10::1/64
eth1 faces your servers with the first /64 of the /48. Enable forwarding in /etc/sysctl.d/90-router.conf:
net.ipv6.conf.all.forwarding = 1
Then rc-service networking restart and sysctl -p /etc/sysctl.d/90-router.conf.
Packages
apk add bird nftables
rc-update add bird default
rc-update add nftables default
The bird package in current Alpine releases is BIRD 2. In diskless mode, installed packages are recorded in /etc/apk/world and reinstalled from the local cache or repository at boot, so set up a package cache with setup-apkcache if the router has no network access during early boot.
BIRD
router id 192.0.2.10;
protocol device { }
protocol direct { ipv6; interface "eth1"; }
protocol static origin6 {
ipv6;
route 2001:db8:100::/48 blackhole;
}
filter only_free48 {
if net = 2001:db8:100::/48 then accept;
reject;
}
protocol bgp transit {
local 2001:db8:0:1::2 as 64496;
neighbor 2001:db8:0:1::1 as 64511;
ipv6 { import none; export filter only_free48; };
}
Save this as /etc/bird.conf. The direct protocol brings the server subnet into BIRD's table, which is handy for monitoring with birdc show route, while the filter still exports only the aggregate /48. Validate it with bird -p -c /etc/bird.conf and start it with rc-service bird start.
nftables
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
iif "lo" accept
meta l4proto ipv6-icmp accept
ip6 saddr 2001:db8:0:1::1 tcp dport 179 accept
iifname "eth1" tcp dport 22 accept
}
chain forward {
type filter hook forward priority 0; policy drop;
ct state established,related accept
meta l4proto ipv6-icmp accept
iifname "eth1" oifname "eth0" accept
oifname "eth1" tcp dport { 80, 443 } accept
}
}
Alpine's nftables service loads /etc/nftables.nft by default. The ruleset allows BGP only from the upstream, SSH only from the inside, and inbound web traffic to the server subnet. Check it with nft -c -f /etc/nftables.nft before restarting the service.
Commit and reboot once
lbu status
lbu commit -d
reboot
After the reboot, confirm everything came back: birdc show protocols should list transit as Established, birdc show route export transit should show only the /48, and nft list ruleset should match the file. Doing one deliberate reboot now is the only way to be sure the overlay contains everything the router needs.
Upgrades
Upgrading a diskless box means updating the boot media and the package cache, then rebooting. Because the running system is rebuilt from the overlay each time, there is no drift between what you committed and what runs. Keep a copy of the overlay archive off the router as a backup.
Before the session goes live
Upstreams need an LOA for the /48; download it from the IPYE customer portal. IPYE creates the ROA automatically, so validators should mark the announcement valid once it propagates.
Next step
Claim a free IPv6 /48 for your Alpine router, build the configuration above in RAM, and run lbu commit only once bird -p and nft -c both pass. 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)