The Best Defense
Seal up all openings in your attic that a squirrel or rat might use as an entry point. While some openings might be obvious -- such as a gaping hole in the wall -- other entry points may be more subtle.
Attic vents provide enough space for either a rat or squirrel to pass through. Since you need vents to circulate air within an attic, sealing it up entirely would be counterproductive.
Instead, apply heavy gauge wire over the entire vent so that air can still pass through, but pests cannot. Vents can also be covered with a heavy steel mesh to prevent unwanted intruders.
The Squirrel Trap
A one-way door trap in your attic can relieve a squirrel problem. Squirrels must leave your attic at some point to obtain food and water.
Attach the one-way trap so that it covers the squirrels entry and exit point from the outside. The one-way trap has a door which the squirrel can walk through from the attic that automatically locks behind him.
Once the squirrel is inside, remove the trap and release the squirrel back into the wild. After this, seal up the opening to prevent reentry.
The Rat Solution
Making sure your attic doesn't contain any entry points for a rat is your best defense against them. However, if you already have a rat problem, invest in either glue or snap rat traps.
Never use poison for a rat problem as poison will not kill every rat within the attic according to 24/7wildlifecom. To reduce a rat problem, trim back any heavy vegetation that resides near your attic, such as a highly grown citrus tree.
Rats can climb these trees to gain access to your attic.
Purpose And Prevention
Rats and squirrels running freely in your attic are dangerous because they can chew on electrical wires and start a fire, or bring diseases into your home. Keeping your attic clean can help reduce a rat or squirrel problem.
Like most pests, squirrels and rats seek shelter and food. While your attic can provide shelter, it doesn't need to provide food, so make sure to never leave food lying around.
Rats leave an odor behind which forms in their fur grease or urine, alerting other rats about their location. Deodorize the entire attic to eliminate any lingering smells once you conquer your rat problem.