Hello runbei,
Thanks for asking the Apple Support Communities about issues with the Mac mini and ethernet.
Start here please: Set up a connection to the internet on Mac - Apple Support
It leads you to one of these, most likely the first one. Also, check with multiple ports off the modem or router, and check with multiple ethernet cables, just in case that's the issue.
1 . Connect your Mac to the internet using Ethernet - Apple Support
2 . Connect your Mac to the internet using a cable modem - Apple Support
You will need to turn off Wi-Fi, and connect with the ethernet. Then, try setting up a new Network Location. System Settings > Network > then the dots and down arrow ...v Bottom right of the window.
Add a new ethernet location, and delete the other one: Change Network settings on Mac - Apple Support
If it still doesn't work, check what your ethernet card says in System Settings > Search for ethernet > ethernet ID > Hardware. We don't need the numbers, but we do need to know if it's connected, has a MAC address, is configured Automatically, is reading speeds, Duplex, and MTU. If anything is wrong or says service, has caution or alert symbols, we need to know so we can check if there is a hardware issue.
Since it's new out of the box, if there are hardware issues, you might want to make an appointment to the Apple Store near you to have it tested. But please ensure you try with multiple ethernet cables, as they can break easily, and also it's been known to have modem and router ports go bad, so try in different ports on those also prior to taking the computer in.
Thanks.