Solved by adding saving the last position:
private Vector2 lastPos;
private void FixedUpdate()
{
Vector2 v = rb.linearVelocity;
Vector2 pos = rb.position;
if (fixation.up && v.y > 0)
{
v.y = 0;
pos.y = lastPos.y;
}
if (fixation.down && v.y < 0)
{
v.y = 0;
pos.y = lastPos.y;
}
if (fixation.left && v.x < 0)
{
v.x = 0;
pos.x = lastPos.x;
}
if (fixation.right && v.x > 0)
{
v.x = 0;
pos.x = lastPos.x;
}
rb.linearVelocity = v;
rb.position = pos;
lastPos = rb.position;
}