Most dogs have a natural instinct to protect the members of his pack, which in this case happens to be you and your family. Often, a family dog will also protect members of your extended family and close friends. However, while this may be a natural instinct in some dogs, you may have to teach your pup to behave in accordance with these instincts. Of course, you should keep in mind that the intent here is to train your dog to protect you, not to become an attack dog, which may require special licensing or even be illegal in your town, county, or state.
The best age to start training your dog to protect you and your family is when he is still very young. This doesn't mean you can't teach an old dog to do the same. One thing to keep in mind, however, it will take longer to train an older dog than a younger one. Also worth noting is that the more loyal your pup is to you and your family, the more active his desire to protect will be; it will also make it easier for you to train him.
While your dog is already a very important member of your family, training him to protect you will on only increase this value. Once trained, your dog will always be on the alert, checking for strangers and threats to any member of your family. Bear in mind that your dog sees you and the rest of your family as part of his pack. As such, you should be seen as the Alpha leader and the rest of your family as part of the pack, one that it is his nature to protect from strangers and other forms of danger.
How well he will protect or how easy your dog is to train is in part dependent on his breed. Some, like Doberman Pinschers, German shepherds, and Rottweilers are natural protectors and require minimal training. The idea is to train your dog to bark and act in a slightly menacing manner towards strangers, you are not teaching him to attack. You are training him to be a protector, not a killer.
Before you start training your dog to protect you and your family, you must first ensure he is fully competent in the basic commands, including 'sit', 'stay', 'quiet', 'come', and 'down'. Along with this, you need to make sure your pup is fully socialized, or you will have to include this in the training. This means socialized with people and other animals. Of course, there a few things you need to go along with the training, including:
The most important thing to keep in mind is that by training your dog to protect, you are only enhancing what is a natural instinct. Take your time, be patient, and in time your efforts will pay off.