Depending on where you are walking, choose a way to protect yourself. You may choose to carry a large stick, a dog whistle, dog deterrent spray, or a stun gun.  You can purchase commercial products that are proven to deter dog attacks.  Look for a whistle that irritates dogs. You can blow the whistle and most dogs will run away from you. A traditional whistle can also work by startling the dog.  In addition to the traditional stun gun, you can find stun batons that not only work on dogs but may frighten them away before you have to use it. The dog will see the baton and hear its electric charge, frightening it. Don't make eye contact because the dog could see it as a challenge. Instead, watch the dog in your peripheral vision. Baring teeth is a sign of aggression for dogs, so smiling or having your mouth open can signal to the dog that you are a threat. Instead, press your lips together to hide your teeth. While commands might not work as well for stray dogs, yelling a firm, one-word command can get a dog to back off. Try commands such as “Stop”, “No,” and “Back”. Don't use a friendly voice when speaking to the dog, and avoid screaming or shrieking. Carry a spray bottle or a water bottle that has a nozzle. If you are approached by an aggressive dog, spraying it with water can get it to run off.
Carry protection. Avoid looking the dog in the eye. Keep your mouth closed. Shout firm commands to the dog. Spray water on the dog.