Easy USB Internet Sharing for Mac

I had some problems with getting my PocketBeagle to talk back out to the internet having setup USB internet sharing on my Mac (Ventura), but now have a simple way to enable this:

  1. Connect the Beagle directly to the Mac rather than a USB hub. (to ensure enough power).

  2. Goto System Settings, Network and check that the BeagleBone entry has appeared.

  3. Goto Details for the BeagleBone and change the configuration to ‘Using DHCP with Manual Address’ and enter address 192.168.2.1

  4. The BeagleBone network should now show as connected.

  5. Goto System Settings, General, Sharing and click the ‘i’ button next to Internet Sharing. Set your wifi or ethernet connection to share to the Beagle. Enable Internet Sharing.

  6. Login into the Beagle using ssh debian@beaglebone.local

  7. Add a nameserver entry for DNS to /etc/resolv.conf eg nameserver 1.1.1.1

  8. Edit this file with making the changes for Address, Gateway and Network.

debian@BeagleBone:~$ cat/etc/systemd/network

[Match]
Name=usb1

[Link]
RequiredForOnline=no

[Network]
DHCP=no
Address=192.168.2.2/24
DHCPServer=on
Gateway=192.168.2.1
Network=192.168.0.0

[DHCPServer]
EmitDNS=no
EmitRouter=no
EmitTimezone=no
MaxLeaseTimeSec=20min
PoolSize=1
  1. Go back to Mac Network settings for Beagle and change from DHCP with manual address to DHCP.

  2. reboot the beagle.

  3. ssh into the beagle and test the outgoing internet connection:

debian@BeagleBone:~$ ping -c1 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=56 time=14.2 ms
--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 14.166/14.166/14.166/0.000 ms

debian@BeagleBone:~$ ping -c1 www.google.com
PING www.google.com (216.58.204.68) 56(84) bytes of data.
64 bytes from lhr48s49-in-f4.1e100.net (216.58.204.68): icmp_seq=1 ttl=56 time=17.8 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 17.824/17.824/17.824/0.000 ms

The default subnet for Beagle on Mac is 192.168.6.x but I had no end of problems because the Mac wants to give out 192.168.2.x instead. Instead of changing what the Mac was doing I found this process easier to do and to understand.