Porting Linux routing rule to macOS

greg.jdf

Registered
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
0.0.0.0 129.194.168.1 0.0.0.0 UG 100 0 0 enx9cebe825f74a
10.194.168.45 0.0.0.0 255.255.255.255 UH 0 0 0 enx9cebe825f74a
192.168.168.0 10.194.168.45 255.255.255.0 UG 0 0 0 enx9cebe825f74a

And the 2 commands to achieve this result
route add 10.194.168.45/32 dev enx9cebe825f74
ip route add 192.168.168.0/24 via 10.194.168.45

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

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

On MacOS this is quite painful...

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

but this is not working here is the result:

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

traceroute 192.168.168.2
traceroute to 192.168.168.2 (192.168.168.2), 64 hops max, 52 byte packets
traceroute: sendto: Network is unreachable
1 traceroute: wrote 192.168.168.2 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:
Learn the Mac OS network setup command! So run this in modern Mac:
Code:
man networksetup
 
Back
Top