1

Is it possible to set route table priority or metric? On Ubuntu I can run following commands to achieve what I want, but I can't find alternative for OS X

sudo ip rule add from all lookup $ROUTE_TABLE_NAME prio 1000
sudo ip route add default via $ROUTER_IP dev $LOCAL_IFACE metric 0  table $ROUTE_TABLE_NAME
sudo ip route add default via $VPN_IP dev $VPN_IFACE metric 1  table $ROUTE_TABLE_NAME 

I would appreciate any guidance.

1
  • You're ignoring my comment on your other question. Please provide details of your VPN server configuration.
    – EEAA
    Dec 1 '15 at 20:49
2

The effect you are after can be had with the route command using the -hopcount value.

route add -net 1.2.3.0 123.123.123.123 0.0.0.0 -hopcount 4

The larger a hopcount, the lower the priority.

Hopcount is indicating the number of steps or routers that traffic must pass through to reach a destination. All unix systems will choose the lower hopcount by default.

You can also look at adding the -lock modifier to lock the hopcount in.

man route

for more information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.