It's very difficult to train them against their natural protective instincts. Barking at the door knock or door bell is one of the more difficult things to train, and we are still working on our 5 year old aussie shepherd.
If we know someone is coming we announce it, and she will patiently wait on her stool by the front window. I will know by the frantic tail wagging that Uncle J has arrived, or the grandchildren, etc. However, when the doorbell is rung unannounced, she does go into a frantic barking mode. I usually will get a treat, tell her to sit, and then answer the door, hoping that whoever is outside is patient.
we are still working on her.