def add_static_ip(n_ip=0)
      begin
        # required metadata values
        ipaddr = ENV["RS_IP#{n_ip}_ADDR"]
        netmask = ENV["RS_IP#{n_ip}_NETMASK"]
        # optional
        gateway = ENV["RS_IP#{n_ip}_GATEWAY"]
        device = shell_escape_if_necessary(device_name_from_mac(ENV["RS_IP#{n_ip}_MAC"]))

        if ipaddr
          # configure network adaptor
          attached_nameservers = nameservers_for_device(n_ip)

          logger.info "Setting up static IP address '#{ipaddr}' for '#{device}'"
          logger.debug "Netmask: '#{netmask}' ; Gateway: '#{gateway}'"
          logger.debug "Nameservers: '#{attached_nameservers.join(' ')}'" if attached_nameservers
          raise "FATAL: RS_IP#{n_ip}_NETMASK not defined ; Cannot configure static IP address" unless netmask

          ip = configure_network_adaptor(device, ipaddr, netmask, gateway, attached_nameservers)
        end
      rescue Exception => e
        logger.error "Detected an error while configuring static IP#{n_ip}: #{e.message}"
        raise e
      end
    end
def add_static_ip(n_ip=0)
      begin
        # required metadata values
        ipaddr = ENV["RS_IP#{n_ip}_ADDR"]
        netmask = ENV["RS_IP#{n_ip}_NETMASK"]
        # optional
        gateway = ENV["RS_IP#{n_ip}_GATEWAY"]
        device = shell_escape_if_necessary(device_name_from_mac(ENV["RS_IP#{n_ip}_MAC"]))

        if ipaddr
          # configure network adaptor
          attached_nameservers = nameservers_for_device(n_ip)

          logger.info "Setting up static IP address '#{ipaddr}' for '#{device}'"
          logger.debug "Netmask: '#{netmask}' ; Gateway: '#{gateway}'"
          logger.debug "Nameservers: '#{attached_nameservers.join(' ')}'" if attached_nameservers
          raise "FATAL: RS_IP#{n_ip}_NETMASK not defined ; Cannot configure static IP address" unless netmask

          ip = configure_network_adaptor(device, ipaddr, netmask, gateway, attached_nameservers)
        end
      rescue Exception => e
        logger.error "Detected an error while configuring static IP#{n_ip}: #{e.message}"
        raise e
      end
    end
Sets single network adapter static IP addresse and nameservers

 Parameters
 n_ip(Fixnum):: network adapter index