Posted on 07-27-2015 05:30 AM
Hi all,
I'm facing an issue for the Macs of my company.
I need to set up the network service order for the different interfaces.
The main goal is to setup the interfaces as follow:
1- Ethernet (built in, Thunderbolt or USB)
2- Wifi
Basically I need to set up as primary interface any Eth connection detected and as secondary the Wifi. All the others can follow.
Does anyone has a solution/suggestion for this?
Thanks everybody.
Cheers,
Jack
Solved! Go to Solution.
Posted on 07-27-2015 05:35 AM
That should be the default for OS X.
Posted on 07-27-2015 10:59 AM
I concur, created a new location and added two ethernet interfaces and they have higher priority than the wifi does. I put my stuff in place back in 10.5 or 10.6 timeframe and have not checked it since. Good job getting that right.
Posted on 07-27-2015 05:35 AM
That should be the default for OS X.
Posted on 07-27-2015 06:36 AM
I have a perl function that does it like this... If we are using the internal VPN and have named a service with VPN in the name it will put VPN first, Ethernet second and Wi-Fi last. And I believe you are incorrect @jrwilcox on all of the new models that do not have a built in Ethernet, Wi-Fi is en0 and tends to get sorted to the top, but, as I do not build stock machines very often and I know my stuff is setting it I could be quite wrong as well.
sub setNetworkServiceOrder {
my $netcmd = "networksetup";
my $listarg = "-listnetworkserviceorder";
my $setarg = "-ordernetworkservices";
my @disabled;
my @hdw;
my @vpns;
open N, "$netcmd $listarg |", or die "$progname: list $!
";
while (<N>) {
chomp;
next if /^An asterisk/;
next if /^$/;
my $port =$_;
my ($num, $interface) = (split " ", $port, 2);
if ($interface =~ /s/) {
$interface = ""$interface"";
}
if ($num =~ /*/) {
push @disabled, $interface;
my $tmpline = <N>;
}
else {
my $tmpline = <N>;
if (($tmpline =~ /IPSec/) || ($tmpline =~ /L2TP/)) {
push @vpns, $interface;
}
else {
if ($interface =~ /Ethernet/) {
unshift @hdw, $interface;
}
else {
push @hdw, $interface;
}
}
}
}
close N;
my $serviceorder = join " ", @vpns, @hdw, @disabled;
syslog('notice', "Network Service Order: %s",$serviceorder);
system("$netcmd $setarg $serviceorder");
return;
}
Posted on 07-27-2015 09:47 AM
I think you should check when you plug in an ethernet adapter it will removed to the top of the list if there is link. I know it was designed this way and I don't think they have changed since I managed the Ethernet team at Apple.
Posted on 07-27-2015 10:04 AM
Thanks @jrwilcox .
Today I imaged a new machine and actually the Ethernet connection was above the Wifi.
If in the network service order the wifi is above the Eth, when I plug the cable the Eth remains below the Wifi.
Anyway, by default Eth is on top of Wifi therefore at the moment I'm fine with that.
Thanks again.
Cheers
Jack
Posted on 07-27-2015 10:15 AM
If it has not been changed by the user at some point and Ethernet gets a dhcp address it should have priority over wifi. You can actually check the default order System Preferences>Network Click on the gear in the lower right corner and select Set Service Order. That is the default service order if all devices have link and a dhcp address.
Posted on 07-27-2015 10:59 AM
I concur, created a new location and added two ethernet interfaces and they have higher priority than the wifi does. I put my stuff in place back in 10.5 or 10.6 timeframe and have not checked it since. Good job getting that right.