Sunan an-Nasa'i, Book 42, Hadith 16 (Nasa'i 4288)

Salim bin 'Abdullah narrated that his father said:

"I heard the Messenger of Allah raise his voice with the command to kill dogs. All dogs were to be killed except dogs used for hunting or herding livestock."