Answer
The source of ear pain upon ascending a mountain is caused by the air-containing cavities in your ears building pressure.
Work Step by Step
The atmospheric pressure drops as you increase in altitude, whereas the pressure inside your ear cavities remains the same. This imbalance in pressure causes the eardrum to bulge outward, causing pain.