Bacterial and/ or yeast infection. The vet should be able to spray something in his ears or give him a shot. Unless you are good at giving medicine to a dog whose ears hurt do not opt for the medicine you have to give in the ears. I can pop a pill down an animal in no time flat; but ears are the worst.
You might want to keep boittle of Epi-Otic around the house. You can squirt that in his ears to keep them clean. Dogs just get these infections; some more than others.
Sorry about the double post.