Forum Discussion
sb_2323_80570
Nimbostratus
Mar 06, 2009Newbie PAT question
Hi,
Im new to writing iRules so apologies in advance, Im looking to write an iRule that redirects a client based on the last octet of a vserver to a particular port.
Eg ...
hoolio
Cirrostratus
Mar 06, 2009I see. I haven't tested this, but I think you could use the default load balancing algorithm to choose the pool member IP address and then change the destination port based on the last octet of the requested IP address.
LB_SELECTED is an event triggered when a load balancing decision is made. You can get details on the other commands on the iRule wiki (Click here).
when LB_SELECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Request to VS [IP::local_addr]:[TCP::local_port]\
Default selection: [LB::server]"
Use the node command to change the destination port of the selected pool member
node [LB::server addr] [getfield [IP::local_addr] "." 4]
log local0. "[IP::client_addr]:[TCP::client_port]: Changing to node:\
[LB::server addr] [getfield [IP::local_addr] "." 4]"
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects