Forum Discussion
Need Assistance With Creating an iRule with different multiple ports for one VIP
I have a VIP that needs to respond to multiple ports. They are not in the same range so would my below iRule work?
when CLIENT_ACCEPTED { if {([TCP::local_port] = 799 ) && ([TCP::local_port] = 8914) || ([TCP::local_port] = 3000 ) && ([TCP::local_port] = 3050) } { pool Test_pool } else reject }
1 Reply
- PeteWhite
Employee
Hi, just to be clear you will need to create a VS with a single host and any port. Then add the iRule to control the connections to specific ports.
To be clear, your iRule is not correct partly because it checks whether the TCP::local_port is two different numbers, which it can't be.
This rule below also uses the switch statement which is more scalable than using if statements.
when CLIENT_ACCEPTED { switch [TCP::local_port] { 799 { pool Test_pool } 8914 { pool Test_pool } 3000 { pool Test_pool } 3050 { pool Test_pool } default { reject } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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