how to only on y

how can i have a dinamic object only move up and down on the y

Set the object to rigid body then go to the advanced button and limit all the rotation and all motion except Y