diff --git a/plugins/guests/freebsd/cap/configure_networks.rb b/plugins/guests/freebsd/cap/configure_networks.rb index 36b11d1ed..5020eebe8 100644 --- a/plugins/guests/freebsd/cap/configure_networks.rb +++ b/plugins/guests/freebsd/cap/configure_networks.rb @@ -18,8 +18,8 @@ module VagrantPlugins # Remove any previous network additions to the configuration file. commands << "sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf" - comm.sudo("ifconfig -a | grep -o '^[0-9a-z]*' | grep -v '^lo'", options) do |_, stdout| - interfaces = stdout.split("\n") + comm.sudo("ifconfig -l ether", options) do |_, stdout| + interfaces = stdout.split end networks.each.with_index do |network, i| diff --git a/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb b/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb index 0d2be59b3..372311bae 100644 --- a/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb +++ b/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb @@ -13,8 +13,7 @@ describe "VagrantPlugins::GuestFreeBSD::Cap::ConfigureNetworks" do before do allow(machine).to receive(:communicate).and_return(comm) - comm.stub_command("ifconfig -a | grep -o '^[0-9a-z]*' | grep -v '^lo'", - stdout: "em1\nem2") + comm.stub_command("ifconfig -l ether", stdout: "em1 em2") end after do