Forum Discussion
patrick_osewal1
Dec 11, 2007Historic F5 Account
First attempt with address datagroup
Hello,
Below you will find my first attempt at using an address datagroup. My objective is to create a list of IP addresses in a class.
class1 and load balance them to pool1
class2 and load balance them to pool2
class3 and load balance them to pool3
Please let me know if there is a better way to achieve this goal and any advice is greatly appreciated.
iRule: source address parsing
when CLIENT_ACCEPTED {
if { [matchclass $my_client equals $::networks_class] } {
pool pool1
}
} elseif
if { [matchclass $my_client equals $::networks_class2] } {
pool pool2
}
} elseif
if { [matchclass $my_client equals $::networks_class3] } {
pool pool3
}
}
}
} else {
discard
}
}
class networks_class1 {
network 10.1.2.3 mask 255.255.255.0
network 10.1.2.4 mask 255.255.255.0
network 10.1.2.5 mask 255.255.255.0
}
class networks_class2 {
network 10.1.2.6 mask 255.255.255.0
network 10.1.2.7 mask 255.255.255.0
network 10.1.2.8 mask 255.255.255.0
}
class networks_class3 {
network 10.1.2.9 mask 255.255.255.0
network 10.1.2.10 mask 255.255.255.0
network 10.1.2.11 mask 255.255.255.0
}
- Youv'e got a lot of extra braces in there. Your iRule can be simplified to the following:
when CLIENT_ACCEPTED { if { [matchclass $my_client equals $::networks_class] } { pool pool1 } elseif { [matchclass $my_client equals $::networks_class2] } { pool pool2 } elseif { [matchclass $my_client equals $::networks_class3] } { pool pool3 } else { discard } }
- Ferdy_Chen_2917
Nimbostratus
Joe,
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