module Vagrant::Util::IPv4Interfaces

Public Instance Methods

ipv4_interfaces() click to toggle source
# File lib/vagrant/util/ipv4_interfaces.rb, line 4
def ipv4_interfaces
  Socket.getifaddrs.select do |ifaddr|
    ifaddr.addr && ifaddr.addr.ipv4?
  end.map do |ifaddr|
    [ifaddr.name, ifaddr.addr.ip_address]
  end
end