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.

endryha
  • 111
  • 2
  • 4
  • You're ignoring my comment on [your other question](http://serverfault.com/questions/739830/how-to-redirect-vpn-traffic-on-os-x). Please provide details of your VPN server configuration. – EEAA Dec 01 '15 at 20:49

1 Answers1

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

sweetfa
  • 447
  • 4
  • 8