Method: #broadcast_addr

Defined in:
lib/vagrant-subutai/packer/subutai_net.rb

#broadcast_addrObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/vagrant-subutai/packer/subutai_net.rb', line 45

def broadcast_addr
  octets = `route print 0.0.0.0 | findstr 0.0.0.0`.split(' ').map(&:strip)[2].split('.')    \
    if (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
  octets = `ip route show | grep default | awk '{print $3}'`.gsub(/\s+/, "").split(".")     \
    if (RbConfig::CONFIG['host_os'] =~ /linux/)
  octets = `route -n get default | grep gateway | awk '{print $2}'`.gsub(/\s+/, "").split(".") \
    if (RbConfig::CONFIG['host_os'] =~ /darwin/)
  octets[3] = 255
  octets.join('.')
end