Internet over Wi-Fi working but not over Ethernet (LAN)
I have run into a curious problem. When I connect my MacBook via LAN cable, the Internet doesn't work, but I can still ping other devices in my network (including the router) and also can access my network hard disk.
When I connect via Wi-Fi to the same router, the Internet works, so does anything else as it's supposed to.
I prefer using the LAN cable as it's faster and more reliable, so I really would like to solve this issue.
Please, note that I cannot restart my computer, because I'm running a very important operation, which cannot be interrupted and will take several weeks.
I hope someone will point me to the right direction as to investigating this issue.
MacBook:
- macOS Catalina Version 10.15.7
- MacBook Pro (15-inch, 2018)
- Processor 2,6 GHz 6-Core Intel Core i7
- Memory 32 GB 2400 MHz DDR4
- Startup Disk Macintosh HD
- Graphics Radeon Pro 560X 4 GB
Intel UHD Graphics 630 1536 MB
Router: AirPort Time Capsule 802.11ac
UPDATE # 2 as per Allan's question: Yes, I turn off Wi-Fi when I try to connect via Ethernet and yes, I can ping 8.8.8.8 and I also can ping other websites if I use their IP address but I cannot connect to a university VPN.
UPDATE # 2 as per Allan's question:
output of ipconfig getpacket en0 | grep "domain_name_server"
with Wi-Fi turned off => nothing. en0 is my Wi-Fi interface by the way and en8 is my Ethernet, so just in case I issued the command also with en8 instead of en0:
output of ipconfig getpacket en8 | grep "domain_name_server"
with Wi-Fi turned off => domain_name_server (ip_mult): {192.168.1.1}
Output of both commands with Wi-Fi on is the same => domain_name_server (ip_mult): {192.168.1.1}
UPDATE # 3 as per Allan's suggestion:
output of nslookup apple.com 192.168.1.1
:
;; connection timed out; no servers could be reached
UPDATE # 4 as per Allan's comments:
I am able to successfully ping my router with ping 192.168.1.1
I am still unable to ping www.apple.com or www.google.com nor am I able to access the Internet after setting the DNS manually with networksetup -setdnsservers Ethernet 8.8.8.8
, wherein I replaced Ethernet with my the name of my LAN netowork service (found out using networksetup -listallnetworkservices
).
With networksetup -getdnsservers Ethernet
I get 8.8.8.8
UPDATE # 5 as per jksoegaard's suggestion: I tried manually configuring my IPv4 settings under my Ethernet connection in Network preferences, without success:
I also tried changing the default gateway through Terminal:
% sudo route add default 192.168.1.1
route: writing to routing socket: File exists
add net default: gateway 192.168.1.1: File exists
%
The internet is still not working properly (cannot browse), though.
Just for note, I am able to successfully ping Google, but not by its web address, but rather using its IP address:
I had to use nslookup
with my Wi-Fi on because otherwise (with only my Ethernet on) it wouldn't work. en0 is my Wi-Fi interface.
% nslookup www.google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: www.google.com
Address: 172.217.19.100
% sudo ifconfig en0 down %
ping 172.217.19.10
PING 172.217.19.10 (172.217.19.10): 56 data bytes
64 bytes from 172.217.19.10: icmp_seq=0 ttl=113 time=127.881 ms
64 bytes from 172.217.19.10: icmp_seq=l ttl=113 time=129.241 ms
64 bytes from 172.217.19.10: icmp_seq=2 ttl=113 time=128.347 ms
64 bytes from 172.217.19.10: icmp_seq=3 ttl=113 time=128.451 ms
^C
— 172.217.19.10 ping statistics —
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 127.881/128.480/129.241/0.489 ms
%
UPDATE # 6 as per jksoegaard's update:
networksetup -setdnsservers Ethernet 1.1.1.1
didn't help. Here's the output of the other 2 commands:
% dig @1.1.1.1 www.google.com
; <<>> DiG 9.10.6 <<>> @1.1.1.1 www.google.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
% nslookup www.google.com
;; connection timed out; no servers could be reached
%
UPDATE # 7: Eventually, I was forced to restart the computer, which solved the problem. I have no idea what it might have been nor how to replicate the issue. I really would like to know what it caused.
According to your question you can access local network devices when on cabled LAN. You have set your DNS server to 8.8.8.8, but still cannot lookup names.
You're able to ping your router at 192.168.1.1 and other local devices, but not internet servers such as apple.com or google.com.
This suggests to me that your problem is that the default gateway is set incorrectly. Fix it this way:
-
Open System Preferences > Network
-
Choose the Ethernet port in the list on the left
-
Ensure the Router field is set to: 192.168.1.1
If it is setup to use DHCP, take a note of your IP address, subnet mask and router addresses, and then change the setting "Configure IPv4" to "Manually" and enter the same values - however note that router should be set to 192.168.1.1.
After applying, you should be able to access web sites and ping servers on the Internet.
You can also try changing this from the Terminal by running:
route add default 192.168.1.1
UPDATE:
Your new update indicates now that you can ping outside IPs successfully, but not when using domain names. This means this is a DNS issue, and not a routing issue.
Change the DNS server IP like this in the Terminal:
networksetup -setdnsservers Ethernet 1.1.1.1
Then check if web sites start working. If not, run these two commands in the Terminal:
dig @1.1.1.1 www.google.com
nslookup www.google.com
The output should tell if it is at all possible to lookup DNS via 1.1.1.1 (if not, you probably have some sort of firewall or filtering issue) - or it is due to the specified DNS server not actually being used at all.