Class: MKIt::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/mkit/mkit_interface.rb

Class Method Summary collapse

Class Method Details

.downObject



23
24
25
26
27
28
29
# File 'lib/mkit/mkit_interface.rb', line 23

def self.down
  main_pool = Pool.find_by_name(MKIt::Utils.me)
  interface_name = "#{main_pool.name}0"
  interface_type = "tap"
  MKIt::InterfaceHelper.down(name: interface_name)
  MKIt::InterfaceHelper.remove(name: interface_name, ctype: interface_type)
end

.ipObject



8
9
10
11
# File 'lib/mkit/mkit_interface.rb', line 8

def self.ip
  main_pool = Pool.find_by_name(MKIt::Utils.me)
  main_pool.ip
end

.upObject



13
14
15
16
17
18
19
20
21
# File 'lib/mkit/mkit_interface.rb', line 13

def self.up
  main_pool = Pool.find_by_name(MKIt::Utils.me)
  interface_name = "#{main_pool.name}0"
  interface_type = "tap"
  ip = main_pool.ip
  mask = main_pool.netmask
  MKIt::InterfaceHelper.create(name: interface_name, ctype: interface_type)
  MKIt::InterfaceHelper.up(name: interface_name, ip: ip, mask: mask)
end