First let me recommend that the dog be examined by a veterinarian. If he has a ruptured ear drum from the infection you do not want to use the commercial ear cleaners, but should use saline solution to clean out the ear. The vet can look into the ear with an otoscope and see if the ear drum is intact. You can look on the bottles of earcleaners and make sure they say they are safe in case of ruptured ear drum. The dog may also need to have antibiotics in order for the infection to clear up.
Cleaning out the ear well is a very important part of managing ear problems. There are lots of commercial ear cleaners available (caution should be taken if dog has not been examined - use saline solution if in doubt.) You can fill the ear canal right up with the solution and then vigorously rub the base of the ear canal between your thumb and fingers. You should be able to hear the solution sloshing around. Then let the dog shake their head. They will help to bring a lot of debris up by shaking. Clean out all of the debris that you can see with a cotton ball or swab. Dog's ear canals are quite long and the go down the side of their head awhile before taking a 90 degree turn into the head. It is safe to clean anything that you can see. I would not recommend sticking a q-tip into the ear canal as you can pack more stuff further down the ear canal. Repeat this process several times until you no longer have much stuff coming up. You can clean the ears out several times a day or as needed. This can help to control and infection and is vital to do prior to putting any prescribed medication into the ear. If the debris in the ear is a dark brown color there is a good possibility that it is a yeast infection. It can help after cleaning the ear to soak a cotton ball in some 50/50 vinegar/water solution and wipe all of the crevices and the ear canal with this solution. If the debris is more yellowish or creXXXXX XXXXX it is possibly a bacterial infection. You can do the same with an alcohol/water solution. If your unsure you can make a solution of 1/3 each vinegar, alcohol, and water. This is not something you want to put a lot of in the ear - just wipe out with the cotton ball. Also, if the ear is very inflamed - this might not be recommended as it might be painful.
I hope that this was helpful. If you opt to clean the ear out at home, if there is not improvement within several days, I would once again recommend a trip to the vet for treatment.
____________If this was helpful, please click ACCEPT_______________