gtm ruleΒΆ

gtm rule(1)						BIG-IP TMSH Manual					       gtm rule(1)

       rule - Opens an editor in which you can configure iRules(r) for traffic management system configuration.


       Configure the rule component within the gtm module using the syntax shown in the following sections.

	create rule [name]
	modify rule [name]
	      [add | delete | modify] {
		[metadata_name] {
		  value [ "value content" ]
		  persist [ true | false ]
	edit rule [ [ [name] | [glob] | [regex] ] ... ]

	list rule
	list rule [ [ [name] | [glob] | [regex] ] ... ]
	show running-config rule
	show running-config rule [ [ [name] | [glob] | [regex] ] ... ]

	show rule
	show rule [ [ [name] | [glob] | [regex] ] ... ]
	    (default | exa | gig | kil | meg | peta | raw | tera | yotta | zetta)

	delete rule [name]

       Note: You can also delete metadata associated with an iRule. See the example section for detail.

       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 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

       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] }
		     {cname } else { host}}

	    Specifies that requests from be directed to, and all other requests be directed to

	    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 } }

       glob Displays the items that match the glob expression. See help glob for a description of glob expression syntax.

	    Specifies a user-defined key/value pair.

       name Specifies a unique name for the component. This option is required.

	    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.

       edit, glob, list, regex, show, tmsh

       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)