How I fixed high latency and laggy SSH after getting a new router. Steps on how to SSH into Raspberry Pi over Ethernet with direct connection on Mac devices.
Problem: High Latency and Lag on SSH
My little Raspberry Pi 4B homelab server has always been headless and accessed via SSH on my Mac. After upgrading the home router to the GL.iNet Flint2 last month, the SSH connection has been super flaky with severe lag.
Wi-Fi packet loss was high with 21.6%, with high jitter (up to 130ms) as seen in a ping test:
137 packets transmitted, 29 packets received, 21.6% packet loss
2round-trip min/avg/max/stddev = 4.565/24.382/130.340/31.171 msAs a network noob, I guess the cause is because of the WPA2/WPA3 mixed mode? The previous router only had WPA2 and SSH was snappy with zero issues.
I tried turning off WiFi power-saving mode off on the Pi, toggling “Boot Wait for Network”, reinstalling network drivers firmware-brcm80211; but nothing helped.
Direct Ethernet Connection Between Mac and Pi
I was staring at the included Ethernet cable that came with the Flint2 and suddenly had this brilliant idea (I don’t know why I didn’t think of this earlier) of connecting the Pi directly to my Mac Mini and using the Internet connection from the Mac directly. Wasn’t sure if it could be done this way, but it seems to work great after some research and testing!
Note that my Mac Mini is running Sequoia v15.7.5 and the Raspberry Pi 4B runs DietPi OS. And I assume you already have SSH set up between your devices.
DISCLAIMER: I am a home networking newbie. This may not be the correct way to do things. It is mainly a log of my experience, please do your own research!
Ethernet Connection Setup
On the Mac, System Settings > General > Accessories & Internet > Internet Sharing, click on the “i”, set your Internet source “Share your connection from” (mine is Wi-Fi) > under “To devices using” I selected “Ethernet” only for it to work (if the options are greyed out, turn the Internet Sharing toggle off first then click the “i” again)
Connect the Pi to the Mac using an Ethernet cable
Turn on the Pi and access the shell
Run
cat /sys/class/net/eth0/addressand note down Pi’sMACaddress (it’s the one that looks like12:34:56:12:34:56)Mac Internet Sharing gives connected clients usually an IP address like
192.168.2.xIdentify the IP address the Pi has been assigned by running
arp -aon the Mac and search for theMACaddress in step 5The IP address assigned is the one in the brackets:
1? (192.168.2.2) at 12:34:56:12:34:56 on bridge100 ifscope [bridge]On the Pi >
dietpi-config> “7. Network Options: Adapters” > ensure Ethernet adapter is turned on, I switched the mode toSTATICwith “Copy current address to Static” > go back one page and “Run a connection test” > if it works, you could turn off Wi-Fi (if that is no longer required) > Apply changes and restart networkingOn the Mac, SSH into the Pi with the new IP address,
ssh username@192.168.2.2
Latent-Free and Zero Lag SSH Achieved
It works so well now with super low latency and no more dropped packets! This SSH fix comes at a perfect time because I really need to restart my self-hosting game. Relying on third-party online services gives me no sense of security these days (e.g. DDoS or whatnot).
Resources
- Stack Overflow: What are en0, en1, p2p…
- CoolAJ86: Get the IP address of devices using Internet Sharing
- The Raspberry Pi Guide: Direct connection with Mac
- Raspberry Pi Forums: Sharing internet from MAC to RPI3

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.