Reproducing the entropy structure in galaxy groups