Cathodic protection is one option for preventing the corrosion of a metal surface. It involves making that metal the cathode of an electrochemical cell, which often means connecting the metal to be protected to a sacrificial anode, which corrodes instead.
Cathodic protection is an old method of corrosion prevention, but it's still used in a wide array of environments, from steel pipelines to home water heaters. This quick video from CorrConnect provides a compact explanation of how cathodic protection works.
For a more in-depth look at how cathodic protection works, check out The Basics of Cathodic Protection.