The best way to keep rats away is to not feed them! For most of the livestock, put out just enough fermented grain that they can clean their plates in 10 or 15 minutes. The rest of the day should be free-range pasture and foraging.
Meat birds, on the other hand (we raise Cornish Cross), need to be on continuous feed in order to maximize weight gain in 8 weeks. Still, even though they have the access to high protein feed during the day, when the rats come out, the feeders are empty.
To rid yourself of existing rats try traps, or better yet a “mouser” cat for your barnyard. Our resident nocturnal rodent hunter is “Princess Kitty Brown”. Princess is 16 and all the animals look up to her…well, down actually, since she is very small. She has survived a run-in with a bobcat, right here in the backyard. And while she is fiercely protective of the feed supplies against rats, she is secretly afraid of the chickens!
In summary…keep your grain larder and henyard neat and clean, employ a rodent-hunter, and if all else fails … try the “p” word.
Happy Homesteading,
T.