Forum Discussion

Greg__33907's avatar
Greg__33907
Icon for Nimbostratus rankNimbostratus
Jul 31, 2008

iRule to SNAT dependant on source address

Hey all,

 

 

I'd like to configure and iRule and apply it to a VIP whereby it checks the source and if it is one of a list of IP addresses (or perhaps within a specific subnet). If it is I'd like it to apply and automapped (optional if not possible) SNAT.

 

 

Is this possible? If it is, any advice would be appreciated.

 

 

Cheers

 

 

Greg
  • Hi,

    You can do this with a network range or a class, it is up to you:

    you must use this command: IP::addr Click here

    should look like this

     
     when CLIENT_ACCEPTED { 
         if {[IP::addr [IP::client_addr]/8 equals 10.0.0.0]} { 
             snat automap 
          } 
     } 
      
     with a class:  
     when CLIENT_ACCEPTED { 
         if {[matchclass [IP::client_addr] equals $::myIPs]} { 
             snat automap 
          } 
     } 
     where you created a datagroup myIPS which contains the list of IPs that should be snatted 
     
  • Thanks very much. I wasn't expecting the full script. I'll give it a shot tomorrow.

     

     

    I'll let you know how I get on.

     

     

    Greg