When a Mac can reach some things on the network but not others, the first question is often boring: what address, subnet and router does it actually have, and did it get them automatically?
networksetup answers that per network service, using the names you see in System Settings:
networksetup -getinfo Wi-Fi
networksetup -getinfo "USB 10/100/1000 LAN"
I’d look at the first line of the output first. “DHCP Configuration” means the router handed out the settings. “Manual Configuration” means someone typed them in, and a manual address that was right at the office is a classic reason a laptop half works at home. Below it you get the IP address, subnet mask and router, plus the IPv6 state and the hardware address.
Two hints in that output are worth knowing. An address starting with 169.254 means the Mac asked for DHCP and nobody answered. And if the router line points at a device that isn’t your router, you’ve found your problem.
The service name has to match exactly, quotes included when it has spaces. networksetup -listallnetworkservices prints the names your Mac uses; an adapter in a dock often has a long name like the one above. The man page lists a whole family of -set commands next to -getinfo. Those change the configuration and need admin rights, so I’d keep this one as a read-only check.
Further reading: networksetup.8 man page