OPNsense Forum

English Forums => General Discussion => Topic started by: vividou on December 04, 2024, 06:32:53 PM

Title: [Solved] Randomize ipv6 WAN address
Post by: vividou on December 04, 2024, 06:32:53 PM
Hello,

My opnsense is configured for ipv6 as follow:

GUI:
Interfaces > WAN >  IPv6 Configuration Type = DHCPv6
                    Prefix delegation size = 56


But the WAN ipv6 contains the MAC address.

Shell:
# ifconfig
wan:
    inet6 xxxx::xxff:fexx:xxxx prefixlen 64 autoconf pltime 7200 vltime 21600


Is there a way to make it more random, without the MAC address?

Thanks
Title: Re: Randomize ipv6 WAN address
Post by: meyergru on December 04, 2024, 08:44:06 PM
You can set another MAC on the WAN interface.

Or, you can use the "request prefix only" setting, together with an "Optional prefix ID" unequal to any other track interface prefix ID and then set "Optional interface ID" to your liking.

That way, the WAN IPv6 will be taken from the IPv6 delegated prefix range (IA_PD) instead of IA_NA.
Title: Re: Randomize ipv6 WAN address
Post by: mooh on December 05, 2024, 01:22:09 PM
I think what you're looking for is IPv6 privacy extensions. See https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface (https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface)

Not sure if that still correct as the article is quite old by now.
Title: Re: Randomize ipv6 WAN address
Post by: vividou on December 05, 2024, 05:42:44 PM
Hello,

Thanks for the information.

Defining "Optional prefix ID" and "Optional interface ID" allows creating a second ipv6 but unfortunately the one with the MAC is still used on internet.


Configuring in System -> Settings -> Tunables:

net.inet6.ip6.use_tempaddr = 1
net.inet6.ip6.prefer_tempaddr = 1


effectively creates a random ipv6 used on internet.

Thanks

Title: Re: [Solved] Randomize ipv6 WAN address
Post by: meyergru on December 05, 2024, 06:05:19 PM
I do not see that. For me, there is no second MAC-based IPv6, just the one with the interface ID.

Maybe you were seeing that because you already had the first IPv6 before you changed the settings. That should be cleared up by a reboot.

On the other hand, the IPv6 privacy settings do not work for me, maybe either because I use the specified settings or maybe because my WAN is pppoe.

BTW: These IPv6 privacy extensions only affect outgoing connections from OpnSense itself, not from your clients. You would have to enable privacy extensions on all of them to hide their identities.
Title: Re: [Solved] Randomize ipv6 WAN address
Post by: mooh on December 05, 2024, 07:03:19 PM
Quote from: meyergru on December 05, 2024, 06:05:19 PM
BTW: These IPv6 privacy extensions only affect outgoing connections from OpnSense itself, not from your clients. You would have to enable privacy extensions on all of them to hide their identities.

That's an important point. From my experience, most devices do use privacy extensions by default. Then again, I avoid windows wherever possible. Privacy extensions where developed to make tracking of devices across networks harder. That's why I don't mind too much that my router has a mac in its public address.
Title: Re: [Solved] Randomize ipv6 WAN address
Post by: schnipp on December 22, 2024, 11:09:38 AM
Quote from: mooh on December 05, 2024, 01:22:09 PMI think what you're looking for is IPv6 privacy extensions. See https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface (https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface)

Not sure if that still correct as the article is quite old by now.

It still works like a charme :-)
Title: Re: [Solved] Randomize ipv6 WAN address
Post by: schnipp on December 22, 2024, 11:11:51 AM
Quote from: meyergru on December 05, 2024, 06:05:19 PM[...]
On the other hand, the IPv6 privacy settings do not work for me, maybe either because I use the specified settings or maybe because my WAN is pppoe.

In the past (before switching away from DSL) I did not encounter any problems using IPv6 privacy extensions together with PPPoE
Title: Re: [Solved] Randomize ipv6 WAN address
Post by: schnipp on January 06, 2025, 10:57:11 AM
Quote from: schnipp on December 22, 2024, 11:09:38 AM
Quote from: mooh on December 05, 2024, 01:22:09 PMI think what you're looking for is IPv6 privacy extensions. See https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface (https://forum.opnsense.org/English_Forums/General_Discussion/IPv6_privacy_extensions_for_WAN_interface)

Not sure if that still correct as the article is quite old by now.

It still works like a charme :-)

I have restructured my network (Fritzbox acted as the WAN Gateway in front of the Opnsense and now moved behind the Opnsense in a dedicated VLAN). This is the first time the IPv6 privacy extensions do not work anymore.