Forum Discussion

AngryCat_52750's avatar
AngryCat_52750
Icon for Nimbostratus rankNimbostratus
Oct 28, 2014

FTP irule to resolve hostname

i have a request to build an FTP LTM VIP that will need to resolve a hostname to an IP address. i have a working example for http transaction and i need help with the ftp variables.

essentially, the server will call the VIP by an internal DNS entry, the irule was look up the end point name and resolve an IP and send it to that address.

Can someone help with the FTP portion?

when CLIENT_ACCEPTED {
     set address [RESOLV::lookup @/Common/VS_DNS -a "example.company.com"]
     log local0. "DNS lookup for example.company.com returned $address"
}
when HTTP_REQUEST {
     set host_used [HTTP::host]
     set uri_used [HTTP::uri]
     set node_used [lindex $address 0]
     HTTP::header replace Host "example.company.com"
     log local0. "[IP::client_addr] sent request $host_used $uri_used to $node_used $uri_used"
}

4 Replies

  • R_Eastman_13667's avatar
    R_Eastman_13667
    Historic F5 Account

    Try adding the "node"command to send traffic to the node in the $address variable.

    when HTTP_REQUEST {
         set host_used [HTTP::host]
         set uri_used [HTTP::uri]
         set node_used [lindex $address 0]
         HTTP::header replace Host "example.company.com"
         node ${node_used} 21
         log local0. "[IP::client_addr] sent request $host_used $uri_used to $node_used $uri_used"
    }
    
    • AngryCat_52750's avatar
      AngryCat_52750
      Icon for Nimbostratus rankNimbostratus
      so in my example, i am using a HTTP_Request event.. would it also work with FTP??
  • R_Eastman_13667's avatar
    R_Eastman_13667
    Historic F5 Account

    You could try:

    when CLIENT_ACCEPTED {
         set address [RESOLV::lookup @/Common/VS_DNS -a "example.company.com"]
         set node_used [lindex $address 0]
         node ${node_used} 21
         log local0. "DNS lookup for example.company.com returned $address"
    }