As with the Sunderland, the countermeasure would be to fly near sea level.The H6K had an Achilles Heel like most flying boats - no lower turrets because of the hull.
The best attack solution would be a climbing attack from astern (rear gunner can't depress the cannon far enough).
Also, like most flying boats, the bulk of their fuel is stored in the hull.