1. If the computer is connected through a switch to a cable or DSL modem, and the modem is not acting as a router, then only the first device to connect will get an address. You need to change the configuration of the modem so that it shares its Internet connection with all devices on the local network, or else connect a router.
2. If there are other devices on the same network, and none of them can get an address, then the problem is on the DHCP server (most likely, the router.)
3. If other devices are working normally, or if there are no others, the problem may be caused by a faulty cable or port on the hub. Switch connections with one of the working devices.
4. If Wi-Fi is on and connected to the same network, please turn it off.
5. If the Firewall is on, turn it off in the Security & Privacy pane of System Preferences. You'll first have to unlock the settings by clicking the padlock icon and entering your administrator password.
6. Open the Network preference pane. If the preference pane is locked, unlock it. Make a note of your settings for the Ethernet service. It may be helpful to take screenshots of the various tabs in the preference pane.
From the Location menu at the top of the window, select Edit Locations. A sheet will drop down. Click the plus-sign button to create a new location. Give it any name you want. In the new location, set up the Ethernet service with the same settings you used before. Click Apply and test.