Created
May 6, 2017 04:16
-
-
Save thorr18/9c5c88b9590c8794f681e85328d65fdb to your computer and use it in GitHub Desktop.
OSX route metrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is for when there are two routes of the same specificity in the table. | |
netstat -nrv -f inet | |
Routing tables | |
Internet: | |
Destination Gateway Flags Refs Use Netif Expire | |
default 192.168.43.1 UGSc 4 102 en0 | |
default 172.17.2.1 UGScI 0 0 en4 | |
127 127.0.0.1 UCS 0 0 lo0 | |
127.0.0.1 127.0.0.1 UH 11 222826 lo0 | |
...et al | |
What witchcraft is used to always send traffic to the interface you don't want? |
sudo networksetup -ordernetworkservices "Thunderbolt Ethernet" "Wi-Fi" "Pixel 2 XL" "USB 10/100/1000 LAN" "USB Ethernet" "Bluetooth PAN" "AirCard 791L" "MiFi 7730L" "FT231X USB UART"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does not work is changing various metrics on the route or deleting re-adding routes:
sudo route change 0.0.0.0/0 172.17.2.1 -hopcount=4
Also it does not work to change metrics on the interface:
sudo ifconfig en4 metric 13
What does work is reordering your network services.
View current order:
networksetup -listnetworkserviceorder
Set a new order:
sudo networksetup -ordernetworkservices "Wi-Fi" "MiFi 7730L" "Bluetooth PAN"
Verify the interface being used for default routes has successfully changed!:
route get 8.8.8.8