It depends on the state, for the most part.
I do not see a generic federal law forbidding carry in national forests.
The Army Corps of Engineers - has restrictions on some of the lands they administer, but there have been court cases which ruled against them. Some of them appear to be ongoing. They mostly cover levees, dams, and waterway infrastructures.
I live in Utah, which has Constitutional Carry (which every state should have). Most of the national monuments in the state say that carry is legal but you need to have rifles cased and pistols need to stay holstered. Fine. If they want to prosecute me for shooting an animal that is attacking me, fine. To me, being alive takes priority.
OK, I’m not going to shoot a bug or a small bird that gets after me but people don’t realize that rabid foxes, skunks, and other small critters can be a significant threat. I saw video of a rabid fox attacking a woman and that little 20-lb thing got downright nasty, shooting it with your 9mm pistol is totally appropriate. That thing latched onto her wrist. Not only was the bite itself fairly serious, she also had to get rabies shots.