Getting a SLAAC ipv6 address wtih static ipv4 address

I've searched a bit, and haven't figured this out.

First, I have a bit of an odd setup. The outside world connects directly to my main Linux box, and then my Linux box connects to my OpenWRT wrouter, and the rest of the house connects to the router. (It's slightly more complicated than that, but I don't think the additional complication is relevant, and I could turn all of that off and would still have the issue I'm having here.) I do this for a couple of reasons, but the primary one is that I have 10gb fiber to my house, and a 10gb ethernet card in the main Linux box. So, I run NAT (for ipv4), dhcp (only for ipv4), and firewalls on my Linux box.

In the router, I've bridged all the ethernet ports and wifi interfaces together, and put a few VLANs on them. Each VLAN interface has a static ip, so in the interface block of /etc/config/network I'm using option proto "static". All of that works.

For all my hosts, I use SLAAC (...OK, I'm new to ipv6, so I may be getting it wrong) to get addresses, and all of that works. However, the router ports themselves are not getting ipv6 addresses. For the most part, this isn't a big deal -- I can route ipv6 to my hosts through the router even though they only seem to have their own fe80: ipv6 addresses, not the ones on the public subnet I've got. I don't totally understand that, but, OK, whatever. However, the completionist in me wants the router VLAN ports also to have their own IPV6 addresses.

I can't just set up static ipv6 addresses because my provider doesn't give me static addresses. Every time I restart (which includes every time I reboot), both my assigned ipv4 and ipv6 addresses may update. (My provider gives me a :128 static address, but also a :56 prefix, and I have successfully received that prefix and delegated various :64 subnets out of the :56 prefix to the various VLAN interfaces on my linux box using dhcpcd. The other hosts on the net, which aren't my router, are getting ipv6 addresses out of the right :64 subnets based on which VLAN they're on. So, I'm pretty sure I've got SLAAC (with radvd) set up properly on my linux box.)

I know that if I set option proto "dhcp6" to work, I can get the desired addresses for the router's interfaces using option reqaddress "try". It seems to that option reqaddress "try" is ignored if proto is `static, however. However, I really want to give them static ipv4 addresses.

Is there a way for an interface to have both a static ipv4 address and a dynamically allocated ipv6 address?

For OpenWRT interfaces that is the default.

But you have to delegate a prefix (preferably e.g. /62) to the router .

On the router what is the output of

ifstatus wan6

That will show if there is a prefix delegated

Have you considered running OpenWrt on a VM on the Linux machine? You could put the VM on the "front end" of the network like a normal router setup that way. You'd probably pass through the 10Gb NIC and connect your desktop using a virtual nic whose other end would be in the LAN bridge on OpenWrt.

Each router in the chains just needs an link local address to know where and how to route a packet to the next hop.
This is totally ok and normal with IPv6. Even if each interface holds a global uniq address, the LLA could be used for next hop resolution on each router.

Is there a way to do this without delegating a prefix to the router? I just want the various vlans on the router to have an address (not a prefix), as the parent host gets the delegated prefixes.

If you use vlans and run the OpenWRT router as a bridged AP then yes in that case all work is done by your linux box e.g. DHCP and DNS, routing NAT for IPv4 etc.
Your linux box is then the router, in which case it makes more sense following @dlakelan's advice and run OpenWRT in a VM on your router.

What would be the advantage of running openwrt in a VM on the linux box as opposed to just letting the regular linux tools do the routing? (I've got it working with just the regular linux tools right now -- isc-dhcp-server (kea has issues), radvd, ufw.

Easier to setup but if the work is already done then you are good to go.
OpenWRT is also a linux based router but with all the tools and instructions already laid out for you but you can do everything your self of course :+1:

Just setup your OpenWRT router as a bridged AP with VLAN's:

There are several experts on the forum which can help you if you have any questions

Yeah, I've got all that working.

The one thing I'd like to have -- and, if I'm honest, I really don't need this, I'm just kinda being anal -- is for router VLAN interfaces to have an IPv6 address on the subnet associated with that vlan.

By default they do not have that, actually you do not even set an IPv4 address on the VLAN interfaces except for the management VLAN to connect to the openwrt router.
All other VLAN interfaces have no address as that is not needed :slight_smile:

What @egc says.
A dump ap is a better switch but a router routes packets from one network to another.

OK, I guess I just overdid it...!

The first router ("Linux box") should make more than a /64 available on the interface that goes to OpenWrt. DHCP should advertise it as a prefix. Then OpenWrt will automatically break it up further to have a unique /64 on each OpenWrt LAN. (option ip6assign 64) By default the OpenWrt LANs themselves will hold the ::1 address in their /64. This seems necessary for SLAAC to work, but you are right that router services can also be reached on the link-local address, so GUAs on the LAN interfaces themselves are kind of optional. OpenWrt has no provision to turn them off though.