In order to prevent from leaving the monitoring area due to the water flow and have restricted mobility, the underwater sensor nodes are usually connected with anchors fixed in the bottom. However, most of previous studies do not consider about this important property. In this paper, a restricted floating localization (RFL) algorithm was proposed based on the mobile characteristics of underwater nodes. A restricted floating node model was firstly established according to the activity law of the underwater nodes under the action of gravity, buoyancy, water impulse, and cable tension. Then, a mobile beacon was used to assist localization. It moves along a straight trajectory in the deployment area, changes its direction and broadcasts its position information over a period of time. The mobile beacon's position information and the underwater node's moving rule were used by RFL makes to deduce the position of anchor. In order to reduce the estimation error, the median value was taken by multiple calculations. Then, the node localization process with the assist of anchor and mobile beacon's position information was completed. The anchor position error, the influence of anchor on node localization and node localization error in RFL algorithm were analyzed by simulation, and the RFL algorithm was compared with the existing algorithms (such as TL, MFLA and LSLS). Simulation results showed the average localization error of RFL was 49.6% of TL, 44.8% of MFLA and 32.1% of LSLS, and the maximum error and minimum error were smaller than TL, MFLA and LSLS. In conclusion, RFL has higher accuracy and stability than the existing algorithms. It is simple, feasible and highly practical.