This process can be repeated outdoors as well if you want your dog to bark when someone enters your fence or driveway. Rather than knocking or ringing the bell, simply teach your dog to bark when they see or hear a person.
If you are having trouble training your dog to bark at stranger, consider enlisting the help of a professional dog trainer. Though it is possible to train adult dogs, this training works best when the dog is in the puppy stage.
Be consistent with your dog by using the same words or hand signals.
Barking, an inherited trait for dogs, is their method of communication with other animals and people. While dogs will bark for a number of different reasons, many owners find it helpful to teach their dog to bark at strangers as this notifies the owner that someone unfamiliar to the dog is at the door. Teaching your dog to bark at a stranger requires patient and consistent training.
Teach your dog to speak. Before you can direct your dog when to bark, it’s important that he learns the "speak" command. When your dog gets excited, encourage him to bark by saying the word "speak" or another word of your choice. Praise him for barking and give him a treat. Soon he will understand that when you say speak, he should bark.
Train the dog to stop barking. Just as you have a word to initiate barking, you also need a word that will stop the barking. Use a word like "quiet," "silence" or "hush" to instruct the dog to stop barking. Give treats and praise when he stops.
Enlist the help of family and friends. Once your dog has barking commands that he can consistently follow, invite over a family member or friend to help you. This can be a person that is a stranger to your dog or someone he is comfortable around.
Ring the doorbell or knock on the door. Have the person helping you approach outside your door while you and the dog are inside. Have the person ring the doorbell or knock on the door. If your dog doesn't automatically bark at the noise, go to the door with him and give the "speak" command. Provide a treat when he does so, then repeat a few times until he knows to bark at the sound of the doorbell or a knock on the door.
Teach the difference between a stranger and a friend. After your dog has mastered the doorbell and knock, open the door and invite the person in. Establish a cue for your dog to let him know that this person is welcome in the home, and he can stop barking. The cue may be something you say, or it can be a reward, such as a treat or a few strokes on his head, back or chest. Repeat this process a few times with this person as well as other family and friends until your dog learns the difference between a stranger and a friend based on the signal you give.