I have set up a 350 bridge and a 12 db omni antenna on a tug. There is a 13.5 db yagi on the roof of the port admin building at the bottom of the inlet. I get good copy out to about 15KM, when he is not behind a ship. Id think about something similar in your case, yagis on both terminals with the omni and root on the ferry. At 5KM depending on the topology, it will probably see both sides and bridge them together. With the other link between the two terminals, spanning tree on that network will permit finding the ferry even if it only sees one terminal. When the ferry sees both terminals, spanning tree will block the point-to-point link. You might want to tune the spanning tree parameters for faster convergence times.
Don