DEV Community

IPYE
IPYE

Posted on

Route a /56 from Your Free /48 to an OpenWrt Router

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.

A /48 is big enough to hand whole /56 blocks to downstream routers: a branch office, a lab rack, or a home network reached over a tunnel. OpenWrt handles this neatly. Give its WAN side a static address, tell it which prefix has been routed to it, and odhcpd automatically carves /64s out of that prefix for each LAN and announces them with router advertisements. This guide does exactly that with a free IPv6 /48 from IPYE.

The layout used here:

  • the /48 is 2001:db8:100::/48, announced by your edge router
  • the transfer network between the edge and OpenWrt is 2001:db8:100:ff::/64, with the edge at ::1 and OpenWrt at ::2
  • OpenWrt receives 2001:db8:100:100::/56 for everything behind it

On the edge router

Route the /56 toward OpenWrt's transfer address. On a Linux edge:

ip -6 addr add 2001:db8:100:ff::1/64 dev eth1
ip -6 route add 2001:db8:100:100::/56 via 2001:db8:100:ff::2 dev eth1
Enter fullscreen mode Exit fullscreen mode

In FRR the same route is ipv6 route 2001:db8:100:100::/56 2001:db8:100:ff::2. Do not redistribute it into BGP toward your upstream. The upstream only needs the /48; the /56 is an internal detail, and the /48 announcement already covers it.

A routed prefix like this is cleaner than bridging a /64 to OpenWrt and relying on DHCPv6 prefix delegation from the edge, because nothing depends on a lease. The routing is static and survives reboots on either side.

On OpenWrt: the WAN interface

Edit /etc/config/network and define the IPv6 side of the WAN as a static interface:

config interface 'wan6'
    option device 'eth1'
    option proto 'static'
    list ip6addr '2001:db8:100:ff::2/64'
    option ip6gw '2001:db8:100:ff::1'
    list ip6prefix '2001:db8:100:100::/56'
Enter fullscreen mode Exit fullscreen mode

ip6prefix is the important line. It tells OpenWrt that this prefix is routed to the router and available for assignment downstream. Without it OpenWrt treats the WAN as a plain host connection and has nothing to give to the LANs.

On OpenWrt: the LANs

Each downstream interface asks for a slice with ip6assign:

config interface 'lan'
    option device 'br-lan'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '64'
    option ip6hint '10'

config interface 'iot'
    option device 'br-iot'
    option proto 'static'
    option ip6assign '64'
    option ip6hint '20'
Enter fullscreen mode Exit fullscreen mode

ip6assign '64' requests a /64 from the available prefixes. ip6hint selects which /64 it should be, so the main LAN becomes 2001:db8:100:110::/64 and the IoT network 2001:db8:100:120::/64. Hints make addresses predictable, which is useful when you write firewall rules or documentation. Without hints OpenWrt still assigns non-overlapping subnets, but the choice can change if you add interfaces.

Apply the changes with service network reload. Then check:

ifstatus wan6
ip -6 addr show br-lan
ip -6 route
Enter fullscreen mode Exit fullscreen mode

br-lan should now carry an address such as 2001:db8:100:110::1/64, and odhcpd will start advertising that prefix. Clients on the LAN pick up addresses by SLAAC, and DHCPv6 if you enable it in /etc/config/dhcp.

Firewall behaviour

The default OpenWrt firewall forwards traffic from lan to wan and drops unsolicited inbound connections from wan. That is a reasonable default for a home or office network: devices get public addresses, but nothing from outside can reach them until you add a rule. To publish one service, add a traffic rule in /etc/config/firewall that accepts the specific port to the specific address, rather than opening the whole /64.

Make sure the wan6 interface is a member of the wan zone. If you create it by hand and forget this step, OpenWrt will treat it as unzoned and the forwarding rules will not apply as you expect.

Test from outside

From a host on the Internet, ping a LAN address and trace the path:

ping -6 2001:db8:100:110::1
traceroute -6 2001:db8:100:110::1
Enter fullscreen mode Exit fullscreen mode

The trace should pass your edge router and then the OpenWrt transfer address. If it stops at the edge, check the static route there. If OpenWrt replies but the LAN host does not, the firewall is doing its job; open a rule if the host should be reachable.

Keep the plan written down

Note the /56 in your address plan alongside the transfer /64. Once several routers each hold a /56, it is easy to lose track, and the outcome of a duplicate is two sites with overlapping LANs. The same structure scales: the edge routes one /56 per site, and each site router carves its own /64s.

The upstream that carries the /48 never needs to hear about any of this. It only needs the LOA from the IPYE customer portal for the /48 itself, and the ROA that IPYE creates covers everything inside it.

Next step

Claim your free /48 and route a /56 to your first OpenWrt site, then add ip6prefix on the WAN and ip6assign on each LAN. 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)