gtm rule
gtm rule(1) BIG-IP TMSH Manual gtm rule(1)
NAME
rule - Opens an editor in which you can configure iRules(r) for traffic
management system configuration.
MODULE
gtm
SYNTAX
Configure the rule component within the gtm module using the syntax
shown in the following sections.
CREATE/MODIFY
create rule [name]
modify rule [name]
option:
metadata
[add | delete | modify] {
[metadata_name] {
value [ "value content" ]
persist [ true | false ]
}
}
edit rule [ [ [name] | [glob] | [regex] ] ... ]
DISPLAY
list rule
list rule [ [ [name] | [glob] | [regex] ] ... ]
show running-config rule
show running-config rule [ [ [name] | [glob] | [regex] ] ... ]
options:
all-properties
non-default-properties
show rule
show rule [ [ [name] | [glob] | [regex] ] ... ]
options:
(default | exa | gig | kil | meg | peta | raw | tera | yotta | zetta)
field-fmt
DELETE
delete rule [name]
Note: You can also delete metadata associated with an iRule. See the
example section for detail.
DESCRIPTION
You can use iRules to direct traffic not only to specific pools, but
also to individual pool members, including port numbers and URI paths,
either to implement persistence or to meet specific load balancing
requirements. The syntax that you use to write iRules is based on the
Tools Command Language (TcL) programming standard. Thus, you can use
many of the standard TcL commands, plus a robust set of extensions that
the BIG-IP(r) local traffic management system provides to help you
further increase load balancing efficiency.
For information about standard TcL syntax, see
http://tmml.sourceforge.net/doc/tcl/index.html. For a list of TcL
commands that have been disabled within the traffic management system
and therefore cannot be used in the traffic management system, see the
Configuration Guide for BIG-IP(r) Local Traffic Management(r). This
guide is available at https://support.f5.com.
EXAMPLES
edit rule my_irule
Opens the vi editor in which you can edit the iRule named my_irule.
Note that after you close the editor, you must run the command sequence
save config to save the configuration changes to the stored
configuration files.
The following are example iRules for the Global Traffic Manager(tm).
when DNS_REQUEST {
if {[IP::addr [IP::remote_addr]/24 equals 10.10.1.0/24] }
{cname cname.siterequest.com } else { host 10.20.20.20}}
Specifies that requests from 10.10.1.0/24 be directed to
cname.siterequest.com, and all other requests be directed to
10.20.20.20.
when DNS_REQUEST {
if {[whereis [IP::remote_addr]] contains "Asia"}
{pool asia_pool} else {pool general_pool}}
Specifies that requests that originate in Asia be directed to the
pool named asia_pool, and that all other requests be directed to
the pool named general_pool.
metadata is the user defined key/value pair
Adds new metadata to named my_meta and modifies existing metadata
named my_meta2 for the iRule named my_irule.
modify rule my_irule {
when DNS_REQUEST {}
metadata replace-all-with {
my_meta { persist false value "hello"
}
my_meta2 { persist false value "hello
2" }
} }
Deletes metadata named my_meta from the iRule named my_irule.
modify rule my_irule {
when RULE_INIT {}
definition-checksum 7c0dba9aa53e8959042c6cfe041d3d11
metadata delete { my_meta } }
OPTIONS
glob Displays the items that match the glob expression. See help glob
for a description of glob expression syntax.
metadata
Specifies a user-defined key/value pair.
name Specifies a unique name for the component. This option is
required.
regex
Displays the items that match the regular expression. The regular
expression must be preceded by an at sign (@[regular expression])
to indicate that the identifier is a regular expression. See help
regex for a description of regular expression syntax.
SEE ALSO
edit, glob, list, regex, show, tmsh
COPYRIGHT
No part of this program may be reproduced or transmitted in any form or
by any means, electronic or mechanical, including photocopying,
recording, or information storage and retrieval systems, for any
purpose other than the purchaser's personal use, without the express
written permission of F5 Networks, Inc.
F5 Networks and BIG-IP (c) Copyright 2008-2012. All rights reserved.
BIG-IP 2012-12-21 gtm rule(1)