Forum Discussion

Mudassar_64773's avatar
Mudassar_64773
Icon for Nimbostratus rankNimbostratus
Apr 28, 2016

iRule for redirecting all traffic to a perticular on LTM

Hi guys,

 

Need a help in a writing a iRule. Requirement is to redirect all traffic coming from one specific public IP to one specific node. If anyone aware of doing this with or without iRule and share with me will be a much appreciated.

 

Thanks

 

2 Replies

  • No iRule is needed. Virtual Servers have a source discriminator, which, by default is 0.0.0.0/0. You can leave the existing Virtual Server with this source matcher in place, then create a second Virtual Server with the same destination IP+port+proto, but with a specific Source Address configured. Something like this:

    tmsh create ltm pool pool-http-general members replace-all-with { 10.10.10.1:80 { } 10.10.10.2:80 { } 10.10.10.3:80 { } }
    
    tmsh create ltm pool pool-http-specific members replace-all-with { 10.10.10.3:80 { } }
    
    tmsh create ltm virtual vs-http-general destination 203.0.113.1:80 profiles replace-all-with { tcp {} } ip-protocol tcp pool pool-http-general
    
    tmsh create ltm virtual vs-http-specific source 198.51.100.1/32 destination 203.0.113.1:80 profiles replace-all-with { tcp {} } ip-protocol tcp pool pool-http-specific
    

    This would send traffic from most sources to a pool with three IPs, but send 198.51.100.1 to only one of those pool members (specifically, 10.10.10.3:80, in my example).

    This is more performant than an iRule, but quickly becomes unwieldy if you are doing it for more than one IP or one netblock.