The Wikipedia article on keelhauling says:
The sailor was tied to a line that looped beneath the vessel, thrown overboard on one side of the ship, and dragged under the ship's keel, either from one side of the ship to the other, or the length of the ship (from bow to stern).
What I can't figure out is, how did the sailors manage to run a line under the ship? Having a diver swim it across seems prohibitively dangerous, especially on big ships, and even more so for lines running bow to stern. And I can't think of any other way to get a rope from one side to the other without getting snagged.
Is there any historical record of how this was accomplished? If not, I would also welcome reasonable speculation.