DeadEyeJ is correct about cathodic protection. But you are all jumping on the bandwagon thinking this will prevent rust. WRONG.
My experience is with boats, 20 to 125 feet, sail or power. I have a RYA 200 tonne licence. Every single boat I have captained has had some form of cathodic protection, usually in the form of sacrificial anodes. Most large boats have multiple anodes.
But these DO NOT prevent rust. The golden Gate bridge in SF has multiple sacrificial anodes, do you really think it cuts down on the rust?
Hate to disappoint you, but any boat in water is going to experience rust, no matter how many anodes you hang off it. The purpose of the sacrificial anodes is to prevent your propeller, or prop shaft, or rudder, or anchor, or any other valuable/expensive metal item from BECOMING a sacrificial anode.
Worst case would be an aluminum yacht in sea water. The variety of metals aboard a yacht, even a f/glass construction, and the stray electrical current aboard (from grounding to the motor or rigging), and the sea water MAY (almost always) result in the vessel having an electrical charge to it. (somewhat similar to the potato clock)usually no problem with most land vehicles it would seek ground and would not be a problem. A yacht cannot seek ground (unless grounded) because it is floating in water. The current discharging into water (especially sea water) causes a reaction and the result is that any metal under the waterline is subject to galvanic corrosion. So you add some zinc anodes, because zinc corrodes really easily and will save your expensive underwater attachments - like a prop. cheaper to spend a few $$ every year on new anodes than to replace a bronze prop.
The anodes must be connected in some form to the boat ground. You will also see anodes on prop shafts as these ground straight to the motor usually. If only these anodes stopped surface rust, most yacht crew would be out of a job. Sorry, it does not work like that, steel, AL and F/glass yachts will still show rust on metal surfaces no matter how many anodes you hang off the boat. That corrosion stops when you haul the boat out of the water, no more water, no more corrosion. given the logic on this thread so far, that would also mean that no boats in the boat yard would ever experience rust, NOT SO.
I think people are getting two seperate processes confused, galvanic action is different from the rust process. Someone who is sharper with electrons would probably explain it better. As I understand it, one process is galvanic action, one process is oxidation. They are seperate and different and often act simulataneously.
You know the best protection against rust right? Let it rust. Eventually the surface will rust and scale sufficiently that the underlying material can not be exposed to oxygen - no more rust. Same with AL.