Forum Discussion
dragonflymr
Cirrostratus
Dec 07, 2015Parsing IP to extract subnet
Hi,
I wonder if there is more elegant and fastest way to extract specific part of IP - like get only part of IP up to second dot, third dot.
I know that I can use scan to separate IP in fou...
StephanManthey
Nacreous
Dec 07, 2015Perhaps I got your question wrong. Following Vernons solution you can check the following if you already know the relevant networks:
when CLIENT_ACCEPTED {
switch [IP::addr [IP::client_addr]] {
"10.131.131.0/26" { log local0. "client [IP::client_addr] in 10.131.131.0/25 detected"
"10.131.131.64/26" { log local0. "client [IP::client_addr] in 10.131.131.64/25 detected"
"10.131.131.128/26" { log local0. "client [IP::client_addr] in 10.131.131.128/25 detected"
"10.131.131.192/26" { log local0. "client [IP::client_addr] in 10.131.131.192/25 detected"
}
}
Thanks, Stephan
PS: I am pretty sure I wrote a subnet calculator iRule a while ago and will post it if you think it would be helpful to solve your requirements.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