Jessica Brown Posted 9 hours ago Posted 9 hours ago Today, I think it will be an easy one. Write a program that validates IPv4 and IPv6 addresses. Basic Requirements: Accept a string input from the user. Check if the input is a valid IPv4 address (e.g., 192.168.1.1). Check if the input is a valid IPv6 address (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). Print whether the address is valid, and if so, specify the type (IPv4 or IPv6). Bonus Features: Detect private IP ranges for IPv4. Handle CIDR notation (e.g., 192.168.1.0/24). Identify loopback addresses (e.g., 127.0.0.1 for IPv4, ::1 for IPv6). Example Output: Enter an IP address: 192.168.1.1 Valid IPv4 address (Private) Enter an IP address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Valid IPv6 address Enter an IP address: 256.256.256.256 Invalid IP address CodeName: Jessica 💻 Linux Enthusiast | 🌍 Adventurer | 🦄 Unicorn 🌐 My Site | 📢 Join the Forum
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now