Forum Discussion
msmith_64485
Nimbostratus
Jan 25, 2010IP to FQDN
Looking for an irule that will replace the IP address of outgoing traffic with the FQDN. Issue is external server does not have a valid PTR record to allow resolution. Owner of this server does not want to add PTR and communication with this server is required. If there is a better way to address this issue please direct me to it.
- hoolio
Cirrostratus
Do you want to check the Host header on all requests through the VIP and if it's one particular IP address, replace the value with a hardcoded value? If so, you can add an HTTP profile to the VIP and use a rule like this:when HTTP_REQUEST { Check if Host header matches 1.1.1.1. Use catch to handle non-IP Host values. If IP::addr matches 1.1.1.1, $result will be 1 if {not ([catch {IP::addr [HTTP::host] equals 1.1.1.1} result]) && $result==1}{ HTTP::header replace Host "www.example.com" } }
- Moe_Jartin
Cirrus
If by "outgoing: you mean response traffic then you would need to use HTTP::header replace Location "www.example.com" is hoolio's example as responses do not have a Host header. Also, if the IP address is embedded in the page you would need to use a stream profile to rewrite it. Since there seems to be only one host in question here a simple stream profile with the IP address in the Source field and the FQDN in the Target field should get it done. If there are multiple hosts in questions then you could do this with am irule: - hoolio
Cirrostratus
Hi Joe, - msmith_64485
Nimbostratus
Sorry for any confusion in my explanation, I will try again. - hoolio
Cirrostratus
So the client is a server in your network. That Apache "client" opens a connection to the VIP and is load balanced to an external host. Does that sound about right? - msmith_64485
Nimbostratus
Yes that is correct other than there is only one external host. I guess no one is doing a reverse lookup/ the LTM tries to connect to 1.1.1.1 and connection fails. If I go to 1.1.1.1 from a web browser connection fails but if I go to site.com connection works! I have nothing more than a VIP and Pool configured right now. - hoolio
Cirrostratus
Okay, so it sounds like the destination host might be filtering on the host header value in requests. You could try testing this from the LTM command line using curl to insert a host header: - msmith_64485
Nimbostratus
Here is what I received - msmith_64485
Nimbostratus
Aaron, - hoolio
Cirrostratus
Was the request successful? Was there anything in the curl output after the SSL handshake completed? For reference, below is a complete request to https://mail.google.com.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects