Forum Discussion

rababa74_74439's avatar
rababa74_74439
Icon for Nimbostratus rankNimbostratus
Jul 10, 2008

SNAT base on Source IP and TCP Port

Hello.

 

 

I need some help in figuring out an iRule that can be applied on my outbound virtual server where if it sees that the source IP and TCP port is coming from A.A.A.A:ZZ, it will snat to B.B.B.B:YY. All other should forward without SNAT by default.

 

 

What should my iRule looks like with the above condition? I did an iRule with basic IP to IP SNAT but without port consideration before.

 

 

Appreciate your help.

 

 

 

-Rey

 

 

 

 

3 Replies

  • The sample is actually for IP to IP translation w/out considering the port. I need the combination of both.

     

     

    Thanks.

     

     

    -Rey
  • Hi,

    If you checked the wiki you'll have found this link for TCP port:Click here

    So to check the ip AND port it would looks like this:

     
     when CLIENT_ACCEPTED { 
       if { ([IP::addr [IP::local_addr] equals 10.10.10.0/24]) AND ([TCP::client_port] equals "80" }{ 
       snat 192.168.20.10 
      } 
     } 
      
     

    HTH

    N.