OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 18.1 Legacy Series »
  • IPv6 Prefix Delegation: routes missing
« previous next »
  • Print
Pages: [1]

Author Topic: IPv6 Prefix Delegation: routes missing  (Read 11821 times)

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
IPv6 Prefix Delegation: routes missing
« on: March 25, 2018, 08:34:13 pm »
This is not about requesting a prefix from an upstream router / ISP, but about delegating prefixes to downstream routers in the LAN.

I have a static /48 from my ISP. OPNsense is used as a distribution router and should delegate /56 prefixes to other routers connected to its LAN interface.

Prefix Delegation Range and Prefix Delegation Size are properly configured in Services / DHCPv6 / LAN and downstream routers successfully request prefixes (visible in Services / DHCPv6 / Leases / Delegated Prefixes).
However, OPNsense doesn't seem to add routes for the delegated prefixes to its routing table. So clients connected to the downstream routers can't access the Internet.

Is this working for someone? If so, am I missing something? Or could this be a bug?
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 13655
  • Karma: 1174
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #1 on: March 25, 2018, 08:38:11 pm »
Hi Maurice,

It used to be a bug, but it was supposed to be fixed in 18.1. Which version are you using?

https://github.com/opnsense/core/pull/2077


Cheers,
Franco
Logged

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #2 on: March 25, 2018, 10:05:39 pm »
Hi Franco,

Thanks for helping out so quickly. I'm on OPNsense 18.1.5-amd64.

These are my OPNsense IPv6 LAN settings:
Static IPv6 address: 2001:db8:feed::1/64
DHCPv6 Prefix Delegation Range: 2001:db8:feed:8000:: to 2001:db8:feed:bf00::
DHCPv6 Prefix Delegation Size: /56

I can see a downstream router getting delegated the prefix 2001:db8:feed:bf00::/56. I expected to find an auto-added route to this prefix in System / Routes / Status, but it's not there.

How could I troubleshoot this?

(BTW, I don't use OPNsense's DHCPv6 server for assigning addresses, so no address range is specified. Downstream routers get their WAN addresses via SLAAC. No idea whether that's relevant, but I better mention it.)

Thanks,

Maurice
« Last Edit: March 25, 2018, 10:12:18 pm by Maurice »
Logged

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #3 on: March 26, 2018, 10:55:08 pm »
I did some lab testing today with two freshly installed OPNsense VMs. Router A is delegating prefixes via its LAN interface, router B is requesting a prefix via its WAN interface (connected to A's LAN interface). B gets a prefix from A easily, but A only adds a route to the delegated prefix under very specific conditions: An address range must be specified in A's DHCPv6 server AND B's DHCPv6 client must be configured to actually request a WAN address.

If A's DHCPv6 server is used for PD only (no address range specified) OR B's DHCPv6 client is configured to only request a prefix (not an address), then A will still delegate a prefix, but won't add a route pointing to it.

I consider this to be a bug. Prefix Delegation should work independently of assigning addresses via DHCPv6. It is quite common to use a router's DHCPv6 server for Prefix Delegation only and to use a separate machine (e. g. Active Directory integrated Windows Server) for assigning IPv6 addresses (or to simply use SLAAC only).

Should I create a bug report on GitHub?
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #4 on: March 27, 2018, 08:20:03 am »
IMHO it is working the way it should...

If you request a prefix, and this is given you using dhcpv6, then the allocating router needs to know the route to the prefix. If the requesting router does not request a stateful address then the allocating router is not going to know where to send packets destined for the prefix subnet.

https://thenetworkway.wordpress.com/2015/06/23/ipv6-prefix-delegation-what-is-it-and-how-does-it-going-to-help-openstack/
« Last Edit: March 27, 2018, 08:25:31 am by marjohn56 »
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #5 on: March 27, 2018, 12:23:33 pm »
I respectfully disagree. The delegating router always knows where to send packets destined for the delegated subnet to: The address where the PD request came from.

  • This issue is specific to OPNsense. Other delegating routers handle PD-only just fine. They route the delegated prefix to the requesting router's link-local WAN address.
  • OPNsense's DHCPv6 client has an option to only request a prefix, not an address. This currently only works if the delegating router is a third-party box, but not if it's an OPNsense router, too.
  • The current behavior makes it impossible to deploy PD in networks which already run a third-party DHCPv6 server for address assignment. A Windows Server running DHCP with Active Directory integration is a real world scenario found in many places. So it must be possible to use separate DHCPv6 servers for address assignment and PD.
  • RFC 3633 says: "Prefix delegation with DHCP is independent of address assignment with DHCP.  A requesting router can use DHCP for just prefix delegation or for prefix delegation along with address assignment and other configuration information."
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #6 on: March 27, 2018, 07:54:39 pm »
OK, well there's a manual route command in FreeBSD, if you can get it to work with Link-local addresses then let me know how and I'll make it work. I've tried this afternoon and spent some time going through the man pages and I cannot see how it can be done...

I've created a routine that pulls the requesting link local address from the dhcpd log and ties that to the allocated prefix.... all that's needed now is someway of adding a route.

Franco?
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #7 on: March 27, 2018, 08:53:52 pm »
Thanks, great work!

Here is what I just tried on the delegating router (via Web GUI):
  • Add a new gateway: Interface LAN, Address Family IPv6, Name Test_PD, Gateway fe80::215:5dff:fe12:3456%hn0 (the requesting router's link-local WAN address)
  • Add a new route: Network Address 2001:db8:feed:bf00::/56, Gateway Test_PD
  • The route now properly shows up in the routing table. I have yet to test whether it actually works. It works! A test client connected to the requesting router's LAN interface has IPv6 Internet access.
It is important to specify the correct zone identifier (%hn0 for the first LAN) when creating the gateway. Without it the created route won't show up in the routing table.

So manually adding a route using a link-local address as gateway works. Now this "only" needs to be done automatically using the routine you created. I'm not exactly sure how the steps in the Web GUI translate into using FreeBSD's manual route command, but maybe it helps?
« Last Edit: March 27, 2018, 10:06:58 pm by Maurice »
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #8 on: March 28, 2018, 09:56:46 am »
So which has a routing issue, Primary or Secondary... I would have thought it should be the primary, but after reading your message I'm not sure.
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #9 on: March 28, 2018, 10:43:28 am »
Correct, primary, which is the delegating router (router A in my example). That's where I manually created the route (which should be created automatically).

No issue on the requesting router (router B in my example).
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #10 on: March 28, 2018, 06:44:40 pm »
I'm confused as to why you needed to add a LAN gateway?

.... after reading what you wrote again...

No I'm not, just being obtuse... :)
« Last Edit: March 28, 2018, 06:59:40 pm by marjohn56 »
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

marjohn56

  • Hero Member
  • *****
  • Posts: 1676
  • Karma: 168
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #11 on: March 28, 2018, 07:41:22 pm »
And it appears this is where the issue is...

When a V4 request comes it, dhcpd tells us which interface it came in on, when it gets a v6 requst it does not..

Here for example is a v4 request ...

Code: [Select]
Mar 28 18:25:37 dhcpd: DHCPACK on 192.168.1.115 to 00:0c:29:b3:b0:d4 (OPNsense) via bridge0
Mar 28 18:25:37 dhcpd: DHCPREQUEST for 192.168.1.115 from 00:0c:29:b3:b0:d4 (OPNsense) via bridge0

And here is the V6 request from my test VM to my primary router...
Code: [Select]
Mar 28 18:25:41 dhcpd: Sending Reply to fe80::20c:29ff:feb3:b0d4 port 546
Mar 28 18:25:41 dhcpd: Reply PD: address 2a02:****:****:2::/64 to client with duid 00:01:00:01:21:da:2b:6d:00:0c:29:d2:7e:2f iaid = 0 valid for 7200 seconds
Mar 28 18:25:41 dhcpd: Request message from fe80::20c:29ff:feb3:b0d4 port 546, transaction ID 0x3FE76000
Mar 28 18:25:40 dhcpd: Sending Advertise to fe80::20c:29ff:feb3:b0d4 port 546
Mar 28 18:25:40 dhcpd: Advertise PD: address 2a02:****:****:2::/64 to client with duid 00:01:00:01:21:da:2b:6d:00:0c:29:d2:7e:2f iaid = 0 valid for 7200 seconds
Mar 28 18:25:40 dhcpd: Solicit message from fe80::20c:29ff:feb3:b0d4 port 546, transaction ID 0xE039DD00

It's fine if you only have one LAN interface, if you have more than that it's an issue, so I'm not sure how we can get around this.
Logged
OPNsense 21.7 - Qotom Q355G4 - ISP - Community Fibre 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

Maurice

  • Sr. Member
  • ****
  • Posts: 497
  • Karma: 52
    • View Profile
Re: IPv6 Prefix Delegation: routes missing
« Reply #12 on: April 04, 2018, 09:33:36 pm »
Sorry for the delay.

You're right, a simple workaround (reading the dhcpd output) most likely won't work.
It seems that routes for delegated prefixes are currently created by parsing the DHCPv6 lease file and matching address assignments (IA_NA) to prefix delegations (IA_PD). I think this was implemented pre-OPNsense, probably as some kind of "quick fix to get it working somehow". This seems fundamentally broken to me since it relies on the requesting router also requesting an address. Also, it is considered best practice to use link-local addresses as next-hop on links between routers, not Global Unicast addresses.

Others solved this by patching the ISC DHCP server so it makes link-local addresses of requesting routers available to custom hooks:
https://github.com/mpalmer/isc-dhcp

See also this very interesting discussion:
http://bird.network.cz/pipermail/bird-users/2017-April/011152.html

Unfortunately porting this to OPNsense is beyond my capabilities, but I think it should be put on the roadmap. Having reliable Prefix Delegation is becoming more and more important.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 18.1 Legacy Series »
  • IPv6 Prefix Delegation: routes missing
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2023 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2