diff --git a/lib/puppet/parser/functions/resolve_ipnets.rb b/lib/puppet/parser/functions/resolve_ipnets.rb
index 3405867c5020af922b20991fa09ae555bddb15e0..1658879ce0b2a19408641e0ab1ffc478899ed41a 100644
--- a/lib/puppet/parser/functions/resolve_ipnets.rb
+++ b/lib/puppet/parser/functions/resolve_ipnets.rb
@@ -103,7 +103,11 @@ module Puppet::Parser::Functions
 		    ips[info[4]] = []
 		    found_families << info[4]
 		end
-		ips.fetch(info[4]) << info[3]
+		# Canonicalize address using IPAddr so the same representation
+		# is returned regardless of interpreter.
+		# JRuby's Socket.getaddrinfo returns IPv6 addresses without
+		# compressed zeros, while CRuby's does compress zeros.
+		ips.fetch(info[4]) << IPAddr.new(info[3]).to_s
 	    end
 	end
 	ipaddrs = [ ]