Arduino Ethernet shields can be very temperamental. Sometimes they will only work when plugged directly into the router, other times only when plugged into a switch. Sometimes they won’t work at all!
You could try this sketch, and provide all the connection details including an IP address for the shield, your Gateway and DNS server details etc.
I persisted with Ethernet shields for a while before eventually seeing the light and choosing better hardware…