Class: Route

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

Overview

How to route answers to packets coming in over a particular provider, say Provider 1, back out again over that same provider

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.commandsObject (readonly)

Returns the value of attribute commands.



8
9
10
# File 'lib/route/route.rb', line 8

def commands
  @commands
end

Class Method Details

.build_commands(isps = []) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/route/route.rb', line 10

def build_commands(isps=[])
  @commands = []
  isps.each do |isp|
    @commands << "/sbin/ip route add #{isp.network} dev #{isp.interface} src #{isp.ip_address} table #{isp.name}"
    @commands << "/sbin/ip route add default via #{isp.gateway} table #{isp.name}"
  end
  @commands
end