Forum Discussion

patrickmosca_12's avatar
patrickmosca_12
Historic F5 Account
Mar 23, 2006

Bastion Host/L3 L4 Proxy - Rewriting IP Address and Port

I am trying to write an iRule that rewrites the destination IP address and port. Is it possible to use the built-in [IP::local_addr] to do this, or will I have to actually search the IP and TCP headers and substitute there? Thanks.

 

 

3 Replies

  • patrickmosca_12's avatar
    patrickmosca_12
    Historic F5 Account
    I am trying to dynamically rewrite IP and port for all requests that go through a forwarding wildcard VIP.

     

     

    Here is the flow:

     

     

    1. Internal server sends a request out to a client.

     

    2. Bigip intercepts requests and dynamically strips out dest ip and dest port and replaces with a new ip and port.

     

    3.bigip gets the new ip and port by doing a lookup in an internal static table.

     

     

    I am writing this from a blackberry so I can't give as much info in this post.
  • patrickmosca_12's avatar
    patrickmosca_12
    Historic F5 Account
    Yes, this might work, depending on the customer's requirements.

     

     

    I could just predefine all the possible node (ip/port) permutations and then base the decision on the destination port.

     

     

    Thanks!

     

     

    By the way, is it possible to actually rewrite the IP address and port without using predefined nodes? I created a URI rewrite that works great:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] == "/" } {

     

    HTTP::uri "/dir1/dir2"

     

    }

     

    }

     

     

    Here, HTTP::uri is used to rewrite the uri. I tried to do the same thing with IP::client_addr and I received error messages in the ltm log.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    HTTP::uri allows you to both read and write the URI information, not all commands function this way. IP::client_addr is a read only command, which is why you were having problems.

     

     

    -Colin