The expression "a man's home is his castle" is arguably spliced into the rounds of the Fourth and Second Amendments to the Constitution that protect against unlawful search and seizure and the right to bear arms. You can't really say the same in those circumstances where a man's home may alternatively be a tanker or a recreational boat. Carrying a gun aboard a vessel is fraught with treacherous legal waters.
Throw a handgun in the ice chest, putter out of your U.S. port of call and then around and about the coastal waters of the U.S., and you're likely subject to both federal gun laws and the gun laws of each of the states through which your vessel's keel passes. Crack a beer, put a leg up, and putter over the bending sea and into international waters and my understanding is you're likely subject to the laws of your boat's flag. Here, that would be the United States, where our hypothetical vessel is documented. Maybe you keep puttering and enter the coastal waters of a foreign country, say, Canada. Now you'll likely be subject to the laws of that country – even if you're flying the stars and stripes and hail from a U.S. port.
You no doubt see the problem – the playing field keeps shifting as you and your craft ply various waters. And like the lousy town in Connecticut that just popped me for using my cell phone when there wasn't a sign or warning otherwise, it won't matter whether you don't know what gun laws apply. That is, you'll likely be charged with knowing and complying with the gun laws of each jurisdiction through which you pass. A pisser of a burden!
What to do? Oh no, you won't have me writing a treatise about end-running this problem. I'm tempted to unfold the many ways I've heard of vessel owners preparing to defend their vessels, but none of them seemed particularly well thought out, and rarely did it seem legal. If you're bound and determined to set sail armed (and trust me, I don't blame you), the best advice I can offer is to plan ahead. Figure out what jurisdictions you'll pass through and how you can lawfully comply with their gun laws. Ask an admiralty attorney if need be, and don't forget the U.S. Customs and Border Patrol's requirements pertaining to entering and leaving the country with a gun.
Too much of headache? You could just spread a bunch of tacks across the deck like Joshua Slocum and lie in wait with a stout oar!
Underway and making way.