Porting Linux routing rule to macOS


Hello all

I'am struggling to convert a working Linux routing rule to a MacOS routing rule. The two machines are on the same physical network.Note I'am not expert in routing but I tried a lot of different options to try to mimic the working routing rule.

So here is the Linux routing table
Destination Gateway Genmask Flags Metric Ref Use Iface UG 100 0 0 enx9cebe825f74a UH 0 0 0 enx9cebe825f74a UG 0 0 0 enx9cebe825f74a

And the 2 commands to achieve this result
route add dev enx9cebe825f74
ip route add via

With this routing table a traceroute to the ip forwarding machine is working and just use a 0 hop route (direct access to
And a traceroute to a private network host works perfectly:

traceroute to (, 64 hops max
1 0.509ms 0.510ms 0.501ms
2 0.604ms 0.601ms 0.653ms

On MacOS this is quite painful...

I tried many things like
route add -host default
and then
route add -net

but this is not working here is the result:

netstat -nrv
Destination Gateway Flags Refs Use Netif Expire
default UGSc 119 8 en4 UGHS 0 0 en4
129.194.168/23 link#5 UC 4 0 en4 0:8:e3:ff:fc:20 UHLWIir 26 0 en4 1200 9c:eb:e8:12:67:85 UHLWIi 1 22 en4 148 0:25:90:8:5:22 UHLWIi 2 331 en4 1193
192.168.168 UGSc 0 2 en4

traceroute to (, 64 hops max, 52 byte packets
traceroute: sendto: Network is unreachable
1 traceroute: wrote 52 chars, ret=-1

I confirm that I use en4 interface. I tried to force it in the above commands, it is the same result. I tried to use mac addresse, but then netstat display incorrect mad adress ...
Help !!! please
Last edited:


In Geostationary Orbit
Learn the Mac OS network setup command! So run this in modern Mac:
man networksetup