Forum Discussion

mfkk531_168091's avatar
mfkk531_168091
Icon for Nimbostratus rankNimbostratus
Apr 13, 2016
Solved

Have to do reverse dns lookup on client IP, and insert the name into http header, and send to server. Help!

I'm currently doing XFF in http profile

 

I have a requirement to do reverse dns lookup on client IP, and insert the resolved name into http header, which the backend server can pick up.

 

Thanks in advance

 

 

  • Maybe this?

     

    when CLIENT_ACCEPTED {

     

    set reverseDns [RESOLV::lookup @8.8.8.8 -ptr [IP::clientaddr]]

     

    }

     

    when HTTP_REQUEST {

     

    HTTP::header insert YOUR_HEADER_NAME $reverseDns

     

    }

     

9 Replies

  • Maybe this?

     

    when CLIENT_ACCEPTED {

     

    set reverseDns [RESOLV::lookup @8.8.8.8 -ptr [IP::clientaddr]]

     

    }

     

    when HTTP_REQUEST {

     

    HTTP::header insert YOUR_HEADER_NAME $reverseDns

     

    }

     

    • mfkk531_168091's avatar
      mfkk531_168091
      Icon for Nimbostratus rankNimbostratus
      Thanks for the quick answer. 1. I'm running v11.5.2 - Do i have to include the dnd server IP ? or the default tmm dns servers will work ? 2. Where it says "YOUR_HEADER_NAME" , should i be having a specific name? I just want to kee everything same - just have the dns name inserted instead of IP Thanks
    • ekaleido_26616's avatar
      ekaleido_26616
      Icon for Cirrocumulus rankCirrocumulus
      YOUR_HEADER_NAME would be whatever you name the header that the servers will be parsing out. As far as specifying the DNS server, I found this stating you don't have to specify one assuming your local resolver has been setup properly: "By default RESOLV::lookup queries the BIG-IP's local caching nameserver (bind) which you must configure in advance. If your RESOLV::lookup queries don't seem to work you should adjust your BIG-IP configuration as explained in f5 Solution Note SOL12224" I hope this helps and I hope it works for you.
  • Maybe this?

     

    when CLIENT_ACCEPTED {

     

    set reverseDns [RESOLV::lookup @8.8.8.8 -ptr [IP::clientaddr]]

     

    }

     

    when HTTP_REQUEST {

     

    HTTP::header insert YOUR_HEADER_NAME $reverseDns

     

    }

     

    • mfkk531_168091's avatar
      mfkk531_168091
      Icon for Nimbostratus rankNimbostratus
      Thanks for the quick answer. 1. I'm running v11.5.2 - Do i have to include the dnd server IP ? or the default tmm dns servers will work ? 2. Where it says "YOUR_HEADER_NAME" , should i be having a specific name? I just want to kee everything same - just have the dns name inserted instead of IP Thanks
    • ekaleido's avatar
      ekaleido
      Icon for Cirrus rankCirrus
      YOUR_HEADER_NAME would be whatever you name the header that the servers will be parsing out. As far as specifying the DNS server, I found this stating you don't have to specify one assuming your local resolver has been setup properly: "By default RESOLV::lookup queries the BIG-IP's local caching nameserver (bind) which you must configure in advance. If your RESOLV::lookup queries don't seem to work you should adjust your BIG-IP configuration as explained in f5 Solution Note SOL12224" I hope this helps and I hope it works for you.