the application I am developing needs to support both IPv4 and IPv6 page. The application exposes a web page for user to configure the server details as follows. This is perfect for IPv4 address.
As the IPv6 address embeds the subnet within the IP Address itself, it’s a bit confusing how to accept the subnet information.

I can take the following approaches
- User has an IPv6 address which contains information including subnet mask. Let the user enters the whole stuffs on screen and we will disable IPv4 subnet mask text box.
- User has an IPv6 address without the subnet information. we will allow user to enter the subnet information in the subnet textbox and later merge the information together to prepare the full IPv6 address.
The second method methods seems not elegant. In my understanding, simply taking ipconfig from the console, the IPv6 address it displays contains the subnet information as well. So that user can easily enter this information in the input page. What’s the standard way of doing this?
The prefix length (subnet mask) is never part of the address. Just like you can write address+prefixlen as 192.0.2.0/24 in IPv4 you write 2001:db8:0:2::/64 in IPv6. Much easier than the old 255.255.255.0 subnet mask notation.
I would use the more convenient (CIDR) notation for both IPv4 and IPv6, and in one textbox. Much easier when copy&pasteing 🙂