import ipaddress

def ipv4_to_ipv6_mapped(ipv4_cidr):
    # Parse the IPv4 CIDR
    ipv4_network = ipaddress.IPv4Network(ipv4_cidr)
    
    # Convert the network address to IPv6-mapped format
    ipv6_network_address = ipaddress.IPv6Address(f"::ffff:{ipv4_network.network_address}")
    
    # Calculate the new subnet mask length for the IPv6 range
    ipv4_prefixlen = ipv4_network.prefixlen
    ipv6_prefixlen = ipv4_prefixlen + 96
    
    # Create the IPv6 network range
    ipv6_network = ipaddress.IPv6Network(f"{ipv6_network_address}/{ipv6_prefixlen}")
    
    return ipv6_network

# Example usage
ipv4_cidr = '127.0.0.0/8'
ipv6_mapped_range = ipv4_to_ipv6_mapped(ipv4_cidr)
print(ipv6_mapped_range)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: