Forum Discussion

Glenn_32974's avatar
Glenn_32974
Icon for Nimbostratus rankNimbostratus
Oct 06, 2010

Source Routing with IP::local_addr

Hello Friends

 

 

I have the following scenario

 

 

Link Controller v 10.2

 

 

Router A: 190.144.x.x

 

Router B: 201.234.x.x

 

 

Pool A :

 

1 member: Router A

 

Pool B:

 

1 member: Router B

 

 

Snatpool: MySmtpSNAT

 

 

14 Members: 201.234.x.x

 

190.216.x.x

 

200.74.x.x

 

190.144.x.x

 

10 more to go....

 

 

 

 

VIP: SMTP_OUT: 0.0.0.0:25

 

 

 

 

What I'm trying to accomplish is to have internal subnet 192.168.17.0 /24 get SNAT'ED to any of the 4 IP address on my snatpool

 

 

After the source address gets SNAT'ED I need to route the packet out the proper pool so if source address changed to any of the 200.74.x.x. or 190.144.x.x addresses use Pool A BUT if source address got changed to any of the 201.234.x.x. or 190.216.x.x addresses then use Pool B

 

 

I have written the following irule trying to accomplish what I just described

 

 

 

Can some one tell me if I'm going the right direction here? That would be very much appreciated!

 

 

When CLIENT_ACCEPTED {

 

 

If { [IP::client_addr] eq "192.168.17.0/24"} {

 

 

snatpool MySmtpSnat

 

 

if {([IP::addr [serverside {IP::local_addr}] eq 201.234.x.x/28"] or ([ip::addr [serverside {IP::local_addr}] eq 190.216.x.x/28]))} {

 

 

pool Pool_B

 

log local0. " Client IP: [serverside {IP::local_addr}] - Hostname"

 

 

} elseif {([IP::addr [serverside {IP::local_addr}] eq "200.74.x.x/27"] or ([IP::addr [serverside {IP::local_adddr}] eq "190.44.x.x/27"]))}{

 

 

 

 

 

pool Pool_A

 

log local0. " Client IP: [serverside {IP::local_addr}] - Hostname"

 

}

 

}

 

 

thx

 

 

G

 

 

1 Reply

  • Thanks Stefan!

     

     

    The workflow will be

     

     

    1. SNAT the source ip address (182.168.17.0/24)

     

    2. Choose a Pool depending of the SNAT'ed ip address

     

     

    isn't the workflow dictated by the order the arguments appear in the irule? Because right after validating the CLIENT ip address I'm throwing the SNAT pool statement

     

     

    thx!