Linux network interface perference
May 20, 2014
Posted by on
Sometimes you have multiple nics on a Linux host and need to have one be a backup for anything other than its own subnet. Lets say both these nics have default routes and we need to go out of eth0 by default. There are multiple ways to do this.
One was is to modify the interface config and add a Metric. A lower metric is more preferable.
The command would be:
METRIC 1 (0 is highest, 1 would make it very prefreable)
save the file, then restart networking:
Another way is to use the command ifmetric command to set the metric of the route.
ifmetric INTERFACE [METRIC]
Using the ifmetric I do belive does not set it permenatly.