Open diekgait opened 6 years ago
This issue has been automatically timed-out (after 180 days of inactivity).
For more information about the policies for this repository, please read https://github.com/opnsense/core/blob/master/CONTRIBUTING.md for further details.
If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.
This would be very useful, at least Telia in Finland won't publish the necessary parameters and so it's a big PITA to try to configure 6rd.
@ZeiP uh, I remember this... let me try to revisit if you are able to help test... :)
Awesome! I'm glad to help any way I can :)
I came to this topic because I finally learned that my provider also transmits the IPv6 information in option 212. Since I did not find any further information, I wrote a script which extracts the IPv6 information from Option 212 of the DHCP lease of the WAN interface and output it in the format used by OPNSense web interface:
#!/bin/bash
WAN_IF="re0"
OPTION212=( $(cat /var/db/dhclient.leases.${WAN_IF} | grep 'option option-212' | tail -n 1 | awk '{print $3}' | sed -e 's/[\:\;]/ /g') )
MASKLEN=$(printf "%d" $((16#${OPTION212[0]})))
PREFIXLEN=$(printf "%d" $((16#${OPTION212[1]})))
PREFIX="$(printf "%02s%02s:%02s%02s:%02s%02s:%02s%02s:%02s%02s:%02s%02s:%02s%02s:%02s%02s" ${OPTION212[@]:2:16} | sed -E s/\(:0\*\)/:/g | sed -E 's/::*$/::/')"
IP=$(printf "%d.%d.%d.%d" $((16#${OPTION212[18]})) $((16#${OPTION212[19]})) $((16#${OPTION212[20]})) $((16#${OPTION212[21]})))
echo ""
echo "IPv6 configuration for WAN interface '${WAN_IF}':"
echo ""
echo " 6RD Prefix: ${PREFIX}/${PREFIXLEN}"
echo " 6RD Border Relay: ${IP}"
echo " 6RD IPv4 Prefix length: ${MASKLEN}"
echo ""
Change the value of WAN_IF
to the WAN interface to use it.
But I hope, someone can make that OPNsense support this dynamically from DHCP lease option 212.
@atl285 Thanks for this, very helpful. Would you mind sharing your dhclient.leases privately via franco@opnsense.org — ideally I would like to extract this information in PHP or Python. Bash isn’t supported by default either so I would like to verify this rewrite with proper data if possible to avoid a number of test iterations.
Also I’m not 100% sure how to transport these settings into GUI, either automatically stored in config.xml or run some type of guided configuration that avoids hard coding these settings (either by hand or through semi-automatic means).
Thanks, Franco
@fichtner, sure. I will send you a copy of my leases file - maybe within the next days. First I want to check, if I have some older dhcp.lease files too with different IPv6 information.
Regarding the transport into the GUI: My current plan is, to implement a cronjob based on the Bash script (but Python sounds also reasonable), which compares the current Option 212 with previous and if changed, sent me a message with the new 6RD values (via mail). So if it's not possible to activate the extracted 6RD information, maybe it would be okay to have a copy&paste place within the GUI.
I've reimplemented the BASH script in Python and also in PHP. It's available here: opnsense6rd
The implementation brings me to a question: Is it possible to get the WAN interface automatically via python from the configuration?
The scripts can now retrieve the Option 212 string from the environment variables, which are set by dhclient. So calling it in a dhclient exit hook, would be a way to retrieved the 6RD configuration. But at the moment I don't know, how I can configure the IPv6 6RD WAN interface with this info?
@ZeiP uh, I remember this... let me try to revisit if you are able to help test... :)
If you need another tester I can help you out too. :)
The RFC for 6RD provides an option to configure 6RD automaticly based on information provided using DHCPv4. A capture of such a dhcp packet looks like this:
It would be nice to have this feature implemented. A way to do this could be to add an "Auto Configuration" option under the 6RD configuration. Enabeling that option would then: -configure the DHCP client on the 6rd enabled interface to request option 212 -configure 6RD with the parameters from the dhcp offer/ack.
A thing to keep in mind here is that the parameters need to be re-evaluated with every offer/ack.