Mac OSX Route Mapping: Use LAN for specific Server and Wifi for other

When working with internal services through LAN, we have some problem that we cannot connect to the outside world which we normally connect by Wifi.

Scenario — Expect Result

When going to internal server e.g. the ip use LAN

en0 Wifi
en5 LAN

Removing LAN default Gateway

Open System Preference > Network

  1. Remove the default gateway in Green

Adding gateway

sudo route -n add -host <target_host_ip> <gateway_ip>// Example
sudo route -n add -host

Add interface

sudo route add -host -interface en5

Seeing route

OSX version of route miss the command to see route.

netstat -nr
... UGHS en5
default         UGSc           en0


For those with ip range, we can avoid tedious one by one adding with CIDR block range /16 , /24 etc.

sudo route -n add -net