Courseiva
SystemGlobal Config

snmp-server location [text]

Sets a descriptive location string for the SNMP agent, used to identify the physical location of the device in network management systems.

Definition: snmp-server location [text] is a Cisco IOS global config command. Sets a descriptive location string for the SNMP agent, used to identify the physical location of the device in network management systems.

Overview

The `snmp-server location` command is a global configuration command on Cisco IOS devices that sets a descriptive text string identifying the physical location of the SNMP agent (the device). This location string is stored in the device's SNMP MIB-II system group (sysLocation.0) and is accessible via SNMP queries from network management systems (NMS) such as SolarWinds, PRTG, or Cisco Prime. The primary purpose is to provide human-readable context about where the device is deployed—e.g., a specific data center, floor, rack, or site—which aids in inventory management, troubleshooting, and automated discovery.

When an NMS polls the device, it retrieves the location string and can display it in dashboards or alerts, helping engineers quickly identify which device is reporting an issue without needing to log in. This command is part of the broader SNMP configuration workflow, which typically includes setting the SNMP community strings (read-only, read-write), contact information (`snmp-server contact`), and trap destinations. The location string is optional but highly recommended for operational clarity.

It does not affect device performance or security directly, but it can be used in access control lists (ACLs) or SNMP views to filter based on location. The command is available in all IOS privilege levels that allow global configuration (privilege level 15 by default). Once configured, the location string is saved in the running configuration and can be copied to startup configuration.

There is no buffered output or immediate effect; the change is only visible via SNMP or by viewing the running config. Alternatives include using the `snmp-server contact` command for administrative contact information, or using device hostnames to infer location, but the location command provides explicit, standardized metadata. In network troubleshooting, the location string helps correlate syslog messages or SNMP traps with physical devices, especially in large environments where multiple devices share similar hostnames.

It is also used by automated provisioning scripts to populate CMDB (Configuration Management Database) entries. The command syntax is straightforward: `snmp-server location <text>`, where `<text>` is a string up to 255 characters (some platforms may have lower limits). No special characters or quotes are required, but spaces are allowed.

To remove the location, use the `no snmp-server location` command. This command is supported across all Cisco IOS platforms, including routers, switches, and wireless controllers, and is consistent in IOS-XE, IOS-XR (with slight syntax differences), and NX-OS (where the command is `snmp-server location <text>` as well, but under the `snmp-server` context). Understanding this command is fundamental for CCNA and CCNP candidates because SNMP is a core network management protocol, and the ability to configure and verify SNMP parameters is a common exam topic and real-world task.

Syntax·Global Config
snmp-server location [text]

When to Use This Command

  • Assigning a location string like 'Building A, Floor 3, Rack 12' to a router for easy identification in SNMP management tools.
  • Updating the location field after moving a device to a new data center or rack.
  • Setting location information for compliance with network inventory standards.
  • Providing location context for automated monitoring systems that alert based on device location.

Parameters

ParameterSyntaxDescription
textSTRING (1-255 characters)A descriptive string identifying the physical location of the device. It can include spaces, letters, numbers, and punctuation. Common examples include 'Data Center A, Rack 12' or 'Floor 3, Wiring Closet B'. Avoid using special characters that might be misinterpreted by SNMP managers. The string is stored in the running configuration and can be viewed with `show running-config | include snmp-server location`. If the string contains spaces, it is entered as a single argument without quotes. To remove the location, use the `no` form of the command.

Command Examples

Setting a location string

Router(config)# snmp-server location Building A, Floor 3, Rack 12
Router(config)#

No output is displayed upon successful configuration. The command simply sets the location string in the running configuration.

Verifying the location setting

Router# show running-config | include snmp-server location
snmp-server location Building A, Floor 3, Rack 12

The output shows the configured location string. If no location is set, this line will not appear.

Understanding the Output

The command does not produce direct output. To verify the location, use 'show running-config | include snmp-server location'. The output shows the exact string configured.

If the line is missing, no location is set. In SNMP, the location is stored in the MIB variable sysLocation (OID 1.3.6.1.2.1.1.6.0). Network management tools can query this value to display device location.

A good value is a descriptive string; a bad value is empty or misleading.

Configuration Scenarios

Setting Location for a Core Switch in a Data Center

A network engineer needs to configure SNMP on a core switch (Cisco Catalyst 9300) to allow monitoring by a central NMS. The switch is located in Data Center A, Rack 10. The location string will help the NMS display the physical location in alerts.

Topology

NMS---Management Network---(Gi1/0/1)CoreSwitch

Steps

  1. 1.Step 1: Enter global configuration mode: CoreSwitch# configure terminal
  2. 2.Step 2: Set the SNMP location: CoreSwitch(config)# snmp-server location Data Center A, Rack 10
  3. 3.Step 3: (Optional) Set SNMP community string for read-only access: CoreSwitch(config)# snmp-server community public RO
  4. 4.Step 4: Exit configuration mode: CoreSwitch(config)# end
  5. 5.Step 5: Verify the configuration: CoreSwitch# show running-config | include snmp-server
Configuration
! Enter global config
configure terminal
! Set location
snmp-server location Data Center A, Rack 10
! Set read-only community
snmp-server community public RO
! Exit
end

Verify: Use `show running-config | include snmp-server location` to confirm the location string appears. Alternatively, from an NMS, perform an SNMP walk on .1.3.6.1.2.1.1.6.0 (sysLocation) to retrieve the string. Expected output: `SNMPv2-MIB::sysLocation.0 = STRING: Data Center A, Rack 10`.

Watch out: If the location string contains spaces, it is entered as a single argument without quotes. However, some older IOS versions may require quotes if the string includes special characters. Always verify with `show running-config`.

Configuring Location on a Branch Router for Remote Monitoring

A branch office router (Cisco ISR 4331) is deployed in a remote site. The engineer wants to set the location to 'Branch Office - Chicago, IL' so that the NMS can identify the router's physical location when sending traps or alerts.

Topology

BranchRouter(Gi0/0/0)---WAN---(Gi0/0/0)HQRouter

Steps

  1. 1.Step 1: Enter global configuration mode: BranchRouter# configure terminal
  2. 2.Step 2: Set the SNMP location: BranchRouter(config)# snmp-server location Branch Office - Chicago, IL
  3. 3.Step 3: (Optional) Set SNMP contact: BranchRouter(config)# snmp-server contact admin@company.com
  4. 4.Step 4: Exit and save configuration: BranchRouter(config)# end BranchRouter# copy running-config startup-config
  5. 5.Step 5: Verify using SNMP walk from the NMS: snmpwalk -v2c -c public BranchRouter 1.3.6.1.2.1.1.6.0
Configuration
! Enter global config
configure terminal
! Set location
snmp-server location Branch Office - Chicago, IL
! Set contact
snmp-server contact admin@company.com
! Exit and save
end
copy running-config startup-config

Verify: From the router CLI: `show snmp location` (if available) or `show running-config | include snmp-server location`. From NMS: `snmpget -v2c -c public BranchRouter 1.3.6.1.2.1.1.6.0` should return the location string.

Watch out: The location string is case-sensitive and should be consistent across devices for easy parsing. Avoid using commas or special characters that might be misinterpreted by SNMP managers. Also, ensure the SNMP community string is configured; otherwise, the NMS cannot retrieve the location.

Troubleshooting with This Command

The `snmp-server location` command itself is not typically used for troubleshooting network issues, but the location string it sets is critical for correlating SNMP events with physical devices. When troubleshooting SNMP-related problems, such as missing traps or failed polls, verifying the location configuration can help ensure the NMS is querying the correct device. Healthy output from an SNMP get on sysLocation (OID 1.3.6.1.2.1.1.6.0) should return a meaningful string.

If the NMS receives an empty string or 'N/A', it indicates the location was not configured. Common symptoms include: (1) NMS alerts showing 'Unknown location' for a device, which points to a missing or misconfigured location string. (2) Inconsistent location strings across devices, making it hard to filter or group devices by site. (3) SNMP walk failing to retrieve sysLocation due to community string mismatch or ACL blocking. To diagnose, first check the device configuration with `show running-config | include snmp-server location`.

If the string is missing, configure it. If it is present but the NMS cannot retrieve it, verify SNMP community strings and access lists: `show snmp community` and `show access-lists`. Also check if the SNMP agent is enabled: `show snmp status`.

If the NMS still fails, perform an SNMP walk from the device itself using `snmpwalk` (if available) or from a test host. For example: `snmpwalk -v2c -c public 192.168.1.1 1.3.6.1.2.1.1.6.0`. If this fails, there may be a network reachability issue or SNMP version mismatch.

Correlate with other show commands: `show ip interface brief` to verify management interface status, `show snmp` to see SNMP packet statistics (e.g., input/output errors, bad community names). If the location string appears in the running config but not in SNMP responses, the device may be running an IOS version where the location is not applied until a reload or SNMP restart—though this is rare. In such cases, try reloading the SNMP agent with `no snmp-server` followed by `snmp-server` (but this disrupts monitoring).

Another approach is to use `debug snmp packets` to see if the NMS request reaches the device and what response is sent. However, debug commands should be used cautiously in production. For NX-OS, the equivalent command is `snmp-server location <text>` under the `snmp-server` context, and verification is via `show snmp location`.

In IOS-XR, the command is `snmp-server location <text>` as well, but the configuration is committed differently. Overall, the location string is a small but vital part of SNMP configuration that aids in efficient network management and troubleshooting.

CCNA Exam Tips

1.

Remember that 'snmp-server location' is a global config command and does not require an SNMP community to be set first.

2.

The location string can be up to 255 characters; the exam may test that you know it's a text string, not an IP address.

3.

Be aware that 'show snmp location' is not a valid command; use 'show running-config' or 'show snmp' to verify.

4.

The location is part of SNMPv1/v2c MIB-II; it is read-only via SNMP but set via CLI.

Common Mistakes

Forgetting to enclose the location string in quotes if it contains spaces; actually quotes are not required, but spaces are allowed without quotes.

Using the command in interface configuration mode instead of global configuration mode.

Confusing 'snmp-server location' with 'snmp-server contact' which sets the contact person.

snmp-server location [text] vs snmp-server contact [text]

Both `snmp-server location` and `snmp-server contact` configure system-level SNMP MIB-II objects (sysLocation and sysContact, respectively) and are often confused because they both describe the device for network management. They are typically set together to provide complete administrative context, but serve distinct informational roles.

Aspectsnmp-server location [text]snmp-server contact [text]
PurposeIdentifies physical device locationIdentifies responsible party or team
Standard MIB ObjectsysLocation (RFC 1213)sysContact (RFC 1213)
Configuration ModeGlobal configurationGlobal configuration
PersistenceSaved to running-config and startup-configSaved to running-config and startup-config
Effect on SNMPDoes not enable or disable SNMP; informational onlyDoes not enable or disable SNMP; informational only
Typical UseDatacenter rack, floor, or site identifierEmail address or phone number of administrator

Use snmp-server location [text] when you need to provide a geographic or physical context for the device in network management systems.

Use snmp-server contact [text] when you need to specify the person or team responsible for the device, often including contact details.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches, ISR 4000 series), the `snmp-server location` command syntax and behavior are identical to classic IOS. The location string is stored in the running configuration and can be verified with `show running-config | include snmp-server location`. IOS-XE also supports the `show snmp location` command in some versions.

In NX-OS (e.g., Nexus 9000, 7000), the command is `snmp-server location <text>` under the `snmp-server` configuration mode. To enter SNMP configuration mode, use `configure terminal` then `snmp-server`. The location can be verified with `show snmp location`.

NX-OS also supports `snmp-server contact` similarly. In IOS-XR (e.g., ASR 9000, CRS), the command is `snmp-server location <text>` under the `snmp-server` configuration context, but configuration is committed using `commit`. The location can be viewed with `show snmp location` or `show running-config snmp`.

In ASA (Adaptive Security Appliance), the equivalent command is `snmp-server location <text>` under global configuration mode, but ASA uses a different SNMP implementation; the location is set via `snmp-server location <text>` and verified with `show running-config snmp-server`. There are no significant differences between IOS versions 12.x, 15.x, and 16.x for this command; however, in very old IOS (12.x), the maximum string length might be shorter (e.g., 127 characters). Always check the specific platform documentation.

The command is not available in IOS-XR's default configuration mode without entering the `snmp-server` submode. In all platforms, the location string is part of the SNMP MIB-II system group and is accessible via SNMPv1, v2c, and v3.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions