Before I retired, I spent 28 years in Sam's Navy. During those years I owned firearms and I lived in Navy quarters on a couple of posts and in several off-post military housing areas. I never got hassled by the military police or the local cops either...but I was very careful to check out the regs for that base first.
The real risk to you will be getting stopped at the gate on many military installations for a random auto search for drugs, contraband and weapons. If you want to see some gate guards freak out...just have a firearm in your car...anywhere in your car...loaded or unloaded. Much of this depends on where you are. California bases? Don't ever THINK about it. I remember that we had a spate of these a few years ago. The silliest was what happened to a chief petty officer several years ago at a naval station in California. He was coming in from the east, no doubt where gun ownership didn't carry with it a stigma, even possibly where concealed carry was permitted. When he arrived at the naval station, in his car, with his family and baggage to check in, he was stopped in a random search. When the guards found his pistol, they almost had a collective heart attack. This guy was eating pavement real fast. He was arrested, tossed in the brig for a couple of hours and totally degraded while the security police tried to contact his [new] command. Those former military members in the reading audience will recognize what a CF that would have been...not checked in yet...but in the hoosegow...with Mom and the kids sobbing at the gate...and nowhere to go! All but ruined this poor guy's career...and he was clueless as to what he had done...at least for a while.
Bottom line, get the book[s] on the state laws in which you might be serving/stationed. Those laws DO affect the station/base/installation standing orders and regulations. I know it sounds weird, but its true. Contact the MPs/Sergeant of the Guard/Master at Arms, etc. at the post[s] in question and be very careful. Those security personnel are careful anyway...and especially now. I recently had cause to enter a Navy base last month after the war started. They made me exit my rental car and went through it with a fine tooth comb...in the car, under the hood, in the trunk and underneath with the mirrors. Had they found a firearm...I suspect I'd still be on the inside looking out.
[soapbox]