Ethernet 5100 + HCSR04 = working one time and freeze

What's going on?

To be blunt, you are an idiot.

int impuls = 12;
int sonar = 11;

Pins 10, 11, 12, and 13 are used for communication between the Arduino and the Ethernet board. You can NOT use them for your ping sensor, too.