Your dog loves everyone; he or she would as soon go away with a burglar as bite one. You ask people in the street not to pet him, but his beautiful eyes and plush coat make him a target for general affection.
Is there a way to teach dogs to ignore strangers?
Probably not, if you got all friends to scold him and smack him as he approaches them. He would simply become shy and nervous, a horrible trait in any dog. Youngsters are nearly all friendly, so if he is 12 months or under, you shouldn’t worry. But if he is nearer two years old, you should start a fixed course of training and enter him for obedience tests. This would make him far more attentive to you, and he would live for your commands and praise.
This is what most dogs lack, and therefore they seek other people’s love as well as that of their owners. Keep him with you all the time; don’t turn him out in the garden to play but take him for walks. You yourself must be his “be all and end-all.” Ask a few friends to send him back to you if he approaches them in too friendly a manner.