Obtaining 3D information about ice features, like icebergs, are of interest to researchers and offshore operators moving into the Arctic. Icebergs are affected by wind, and ocean currents, and can have unpredictable drift patterns, causing challenges when it comes to mapping objectives. Autonomous underwater vehicles (AUVs) equipped with multibeam echosounders are suitable for obtaining measurements of the underwater geometry of icebergs, but advances in autonomy are needed to map drifting icebergs reliably. This paper details a guidance algorithm for detecting and circumnavigating an iceberg -following the iceberg edge. The guidance scheme is implemented as a state machine, starting in an iceberg detection-mode.Once an iceberg is detected, the AUV will enter a mapping-mode. An edge detection algorithm will determine the position of the edge, and a line-of-sight approach will be used for edgefollowing. A six degree-of-freedom AUV simulator is used to perform a simulation study, to show how AUV dynamics affect the results. The simulation study presented shows the algorithm's effectiveness, both when the iceberg is assumed stationary, and when the iceberg is drifting and rotating with constant velocity.