Class: Dcmgr::VNet::Tasks::TranslateMetadataAddress
- Inherits:
-
Dcmgr::VNet::Task
- Object
- Dcmgr::VNet::Task
- Dcmgr::VNet::Tasks::TranslateMetadataAddress
- Includes:
- Netfilter
- Defined in:
- lib/dcmgr/vnet/tasks/translate_metadata_address.rb
Instance Attribute Summary collapse
-
#metadata_fake_ip ⇒ Object
readonly
Returns the value of attribute metadata_fake_ip.
-
#metadata_fake_port ⇒ Object
readonly
Returns the value of attribute metadata_fake_port.
-
#metadata_ip ⇒ Object
readonly
TODO: allow ARP traffic to metadata server.
-
#metadata_port ⇒ Object
readonly
Returns the value of attribute metadata_port.
Attributes inherited from Dcmgr::VNet::Task
Instance Method Summary collapse
-
#initialize(vnic_id, metadata_ip, metadata_port, metadata_fake_ip = "169.254.169.254", metadata_fake_port = "80") ⇒ TranslateMetadataAddress
constructor
A new instance of TranslateMetadataAddress.
Constructor Details
#initialize(vnic_id, metadata_ip, metadata_port, metadata_fake_ip = "169.254.169.254", metadata_fake_port = "80") ⇒ TranslateMetadataAddress
Returns a new instance of TranslateMetadataAddress.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dcmgr/vnet/tasks/translate_metadata_address.rb', line 15 def initialize(vnic_id,,, = "169.254.169.254", = "80") super() @metadata_ip = @metadata_port = @metadata_fake_ip = @metadata_fake_port = # Translate requests to the metadata server self.rules << IptablesRule.new(:nat,:prerouting,:tcp,:outgoing,"-m physdev --physdev-in #{vnic_id} -d #{self.} -p tcp --dport #{self.} -j DNAT --to-destination #{self.}:#{self.}") # Accept tcp traffic to the metadata server self.rules << IptablesRule.new(:filter,:forward,:tcp,:outgoing,"-p tcp -d #{self.} --dport #{self.} -j ACCEPT") end |
Instance Attribute Details
#metadata_fake_ip ⇒ Object (readonly)
Returns the value of attribute metadata_fake_ip.
12 13 14 |
# File 'lib/dcmgr/vnet/tasks/translate_metadata_address.rb', line 12 def @metadata_fake_ip end |
#metadata_fake_port ⇒ Object (readonly)
Returns the value of attribute metadata_fake_port.
13 14 15 |
# File 'lib/dcmgr/vnet/tasks/translate_metadata_address.rb', line 13 def @metadata_fake_port end |
#metadata_ip ⇒ Object (readonly)
TODO: allow ARP traffic to metadata server
10 11 12 |
# File 'lib/dcmgr/vnet/tasks/translate_metadata_address.rb', line 10 def @metadata_ip end |
#metadata_port ⇒ Object (readonly)
Returns the value of attribute metadata_port.
11 12 13 |
# File 'lib/dcmgr/vnet/tasks/translate_metadata_address.rb', line 11 def @metadata_port end |