object-group
To define object groups that you can use to optimize your configuration, use the object-group command in global configuration mode. Use the no form of this command to remove object groups from the configuration.
object-group { protocol | network | icmp-type | security | user | network-service } grp_name
object-group service grp_name [ tcp | udp | tcp-udp ]
Syntax Description
|
grp_name |
Identifies the object group (one to 64 characters) and can be any combination of letters, digits, and the “_”, “-”, “.” characters. |
||
|
icmp-type |
(Not recommended, use service instead.) Defines a group of ICMP types such as echo and echo-reply. After entering the object-group icmp-type command, use the icmp-object and the group-object commands to add ICMP objects. |
||
|
network |
Defines a group of hosts or subnet IP addresses. After entering the object-group network command, use the network-object and the group-object commands to add network objects. You can create a group with a mix of IPv4 and IPv6 addresses.
|
||
|
network-service |
Defines a group of subnets or domain names with optional service specifications. After entering this command, use the network-service-member command to add network-service objects, or the domain and subnet commands to add members directly. In the show object-group network-service output, the object-group network-service command might include the dynamic keyword. This means that the object is not saved to the running configuration, but is created dynamically by the Application Visibility and Control feature (avc command). |
||
|
protocol |
(Not recommended, use service instead.) Defines a group of protocols such as TCP and UDP. After entering the object-group protocol command, use the protocol-object and the group-object commands to add protocol objects. |
||
|
security |
Defines a security group object for use with Cisco TrustSec. After entering the object-group protocol command, use the security-group and the group-object commands to add security group objects. |
||
|
service [tcp | udp | tcp-udp |
Defines a service based on protocol, ICMP types, and TCP/UDP/SCTP ports. To define a mixed group of services, or SCTP ports, do not specify the protocol type for the object-group. After entering the object-group service command, add service objects to the service group with the service-object and the group-object commands. This is the preferred method, even if the object is meant to include only lists of TCP or UDP (or both) ports. Using the tcp , udp , and tcp-udp keywords directly on the object-group service command is not recommended. Instead, leave these keywords off the command and configure TCP and UDP ports on the service-object command. If you do include one of these keywords, use the port-object and the group-object commands to add port groups. |
||
|
user |
Defines users and user groups that you can use to control access with the identity firewall. After entering the object-group protocol command, use the user , user-group , and the group-object commands to add user and user group objects. |
Command Default
No default behavior or values.
Command Modes
The following table shows the modes in which you can enter the command:
|
Command Mode |
Firewall Mode |
Security Context |
|||
|---|---|---|---|---|---|
|
Routed |
Transparent |
Single |
Multiple |
||
|
Context |
System |
||||
|
Global Configuration |
|
|
|
|
— |
Command History
|
Release |
Modification |
|---|---|
|
7.0(1) |
This command was added. |
|
8.4(2) |
Support for the user keyword was added to support identity firewall. |
|
9.0(1) |
You can now create network object groups that can support a mix of both IPv4 and IPv6 addresses. Support for the security keyword was added to support Cisco TrustSec. |
|
9.14 |
The icmp-type keyword was deprecated. Use the service keyword, and specify service icmp in the object instead. |
|
9.17(1) |
The network-service keyword was added. |
Usage Guidelines
Objects such as hosts or services can be grouped, and then you can use the object group in features such as ACLs (access-list ) and NAT (nat ). This example shows the use of a network object group in an ACL:
ciscoasa(config)# access-list access_list_name extended permit tcp any object-group NWgroup1
You can group commands hierarchically; an object group can be a member of another object group.
Examples
The following example shows how to use the object-group network command to create a network object group:
ciscoasa(config)# object-group network sjc_eng_ftp_servers
ciscoasa(config-network-object-group)# network-object host sjc.eng.ftp.servcers
ciscoasa(config-network-object-group)# network-object host 172.23.56.194
ciscoasa(config-network-object-group)# network-object 192.1.1.0 255.255.255.224
ciscoasa(config-network-object-group)# exit
The following example shows how to use the object-group network command to create a network object group that includes an existing object-group:
ciscoasa(config)# object-group network sjc_ftp_servers
ciscoasa(config-network-object-group)# network-object host sjc.ftp.servers
ciscoasa(config-network-object-group)# network-object host 172.23.56.195
ciscoasa(config-network-object-group)# network-object 193.1.1.0 255.255.255.224
ciscoasa(config-network-object-group)# group-object sjc_eng_ftp_servers
ciscoasa(config-network-object-group)# exit
The following example shows how to use the group-object mode to create a new object group that consists of previously defined objects, and then how to use these objects in an ACL:
ciscoasa(config)# object-group network host_grp_1
ciscoasa(config-network-object-group)# network-object host 192.168.1.1
ciscoasa(config-network-object-group)# network-object host 192.168.1.2
ciscoasa(config-network-object-group)# exit
ciscoasa(config)# object-group network host_grp_2
ciscoasa(config-network-object-group)# network-object host 172.23.56.1
ciscoasa(config-network-object-group)# network-object host 172.23.56.2
ciscoasa(config-network-object-group)# exit
ciscoasa(config)# object-group network all_hosts
ciscoasa(config-network-object-group)# group-object host_grp_1
ciscoasa(config-network-object-group)# group-object host_grp_2
ciscoasa(config-network-object-group)# exit
ciscoasa(config)# access-list grp_1 permit tcp object-group host_grp_1 any eq ftp
ciscoasa(config)#access-list grp_2 permit tcp object-group host_grp_2 any eq smtp
ciscoasa(config)#access-list all permit tcp object-group all_hosts any eq www
Without the group-object command, you need to define the all_hosts group to include all the IP addresses that have already been defined in host_grp_1 and host_grp_2 . With the group-object command, the duplicated definitions of the hosts are eliminated.
The following example shows how to add both TCP and UDP services to a service object group:
ciscoasa(config)# object-group service CommonApps
ciscoasa(config-service-object-group)# service-object tcp destination eq ftp
ciscoasa(config-service-object-group)# service-object tcp-udp destination eq www
ciscoasa(config-service-object-group)# service-object tcp destination eq h323
ciscoasa(config-service-object-group)# service-object tcp destination eq https
ciscoasa(config-service-object-group)# service-object udp destination eq ntp
The following example shows how to add multiple service objects to a service object group:
ciscoasa(config)# object-group service SSH
ciscoasa(config-service-object)# service tcp destination eq ssh
ciscoasa(config)# object-group service EIGRP
ciscoasa(config-service-object)# service eigrp
ciscoasa(config)# object-group service HTTPS
ciscoasa(config-service-object)# service tcp source range 0 1024 destination eq https
ciscoasa(config)# object-group service Group1
ciscoasa(config-service-object-group)# group-object SSH
ciscoasa(config-service-object-group)# group-object EIGRP
ciscoasa(config-service-object-group)# group-object HTTPS
The following example shows how to add a mix of protocol, port, and ICMP specifications in a service object group:
ciscoasa(config)# object-group service mixed
ciscoasa(config-service-object-group)# service-object tcp destination eq ftp
ciscoasa(config-service-object-group)# service-object tcp-udp destination eq www
ciscoasa(config-service-object-group)# service-object ipsec
ciscoasa(config-service-object-group)# service-object tcp destination eq domain
ciscoasa(config-service-object-group)# service-object icmp echo
The following example shows how to use the service-object subcommand, which is useful for grouping TCP and UDP services:
ciscoasa(config)# object-group network remote
ciscoasa(config-network-object-group)# network-object host kqk.suu.dri.ixx
ciscoasa(config-network-object-group)# network-object host kqk.suu.pyl.gnl
ciscoasa(config)# object-group network locals
ciscoasa(config-network-object-group)# network-object host 209.165.200.225
ciscoasa(config-network-object-group)# network-object host 209.165.200.230
ciscoasa(config-network-object-group)# network-object host 209.165.200.235
ciscoasa(config-network-object-group)# network-object host 209.165.200.240
ciscoasa(config)# object-group service usr_svc
ciscoasa(config-service-object-group)# service-object tcp destination eq www
ciscoasa(config-service-object-group)# service-object tcp destination eq https
ciscoasa(config-service-object-group)# service-object tcp destination eq pop3
ciscoasa(config-service-object-group)# service-object udp destination eq ntp
ciscoasa(config-service-object-group)# service-object udp destination eq domain
ciscoasa(config)# access-list acl extended permit object-group usr_svc object-group locals object-group remote
The following example shows how to use the object-group user command to create user group objects:
ciscoasa(config)# object-group user sampleuser1-group
ciscoasa(config-object-group user)# description group members of sampleuser1-group
ciscoasa(config-object-group user)# user-group EXAMPLE\\group.sampleusers-all
ciscoasa(config-object-group user)# user EXAMPLE\user2
ciscoasa(config-object-group user)# exit
ciscoasa(config)# object-group user sampleuser2-group
ciscoasa(config-object-group user)# description group members of sampleuser2-group
ciscoasa(config-object-group user)# group-object sampleuser1-group
ciscoasa(config-object-group user)# user-group EXAMPLE\\group.sampleusers-marketing
ciscoasa(config-object-group user)# user EXAMPLE\user3
(Not recommended, use service objects instead.) The following example shows how to use the object-group icmp-type mode to create a ICMP object group:
ciscoasa(config)# object-group icmp-type icmp-allowed
ciscoasa(config-icmp-object-group)# icmp-object echo
ciscoasa(config-icmp-object-group)# icmp-object time-exceeded
ciscoasa(config-icmp-object-group)# exit
(Not recommended, use service objects instead.) The following example shows how to use the object-group protocol mode to create a protocol object group:
ciscoasa(config)# object-group protocol proto_grp_1
ciscoasa(config-protocol-object-group)# protocol-object udp
ciscoasa(config-protocol-object-group)# protocol-object ipsec
ciscoasa(config-protocol-object-group)# exit
ciscoasa(config)# object-group protocol proto_grp_2
ciscoasa(config-protocol-object-group)# protocol-object tcp
ciscoasa(config-protocol-object-group)# group-object proto_grp_1
ciscoasa(config-protocol-object-group)# exit
(Not recommended, leave off the tcp keyword and define the port with the service-object command instead.) The following example shows how to use the object-group service mode to create a TCP port object group:
ciscoasa(config)# object-group service eng_service tcp
ciscoasa(config-service-object-group)# group-object eng_www_service
ciscoasa(config-service-object-group)# port-object eq ftp
ciscoasa(config-service-object-group)# port-object range 2000 2005
ciscoasa(config-service-object-group)# exit
The following examples show how to use object groups to simplify the access list configuration. This grouping enables the access list to be configured in 1 line instead of 24 lines, which would be needed if no grouping is used.
ciscoasa(config)# object-group network remote
ciscoasa(config-network-object-group)# network-object host 10.1.1.15
ciscoasa(config-network-object-group)# network-object host 10.1.1.16
ciscoasa(config)# object-group network locals
ciscoasa(config-network-object-group)# network-object host
209.165.200.225
ciscoasa(config-network-object-group)# network-object host
209.165.200.230
ciscoasa(config-network-object-group)# network-object host
209.165.200.235
ciscoasa(config-network-object-group)# network-object host
209.165.200.240
ciscoasa(config)# object-group service eng_svc tcp
ciscoasa(config-service-object-group)# port-object eq www
ciscoasa(config-service-object-group)# port-object eq smtp
ciscoasa(config-service-object-group)# port-object range 25000 25100
ciscoasa(config)# access-list acl extended permit tcp object-group remote object-group locals object-group eng_svc
![]() Note |
The show running-config access-list command displays the access list as configured with the object group names. The show access-list command displays this information plus the access list entries that use groups expanded out into individual entries without their object groupings. |
The following example configures a set of SaaS applications using previously-defined network-service objects.
object-group network-service SaaS_Applications
description This group includes relevant 'Software as a Service' applications
network-service-member "outlook 365"
network-service-member webex
network-service-member box

Feedback