Herd dogs are working dogs. Their job is to protect the herd from potential attacks. When you come close to a herd, dogs may see you as a potential threat. As a result, they are alarmed and start to bark and approach walkers.
See below for the right attitude to adopt to ensure things go smoothly in the presence of herd dogs.