Courseiva
DHCPDHCP Pool Config

domain-name [domain]

Assigns a domain name to DHCP clients, which is used for DNS resolution and device naming.

Definition: domain-name [domain] is a Cisco IOS dhcp pool config command. Assigns a domain name to DHCP clients, which is used for DNS resolution and device naming.

Overview

The `domain-name` command in DHCP pool configuration mode assigns a domain name to DHCP clients. This domain name is appended to hostnames for DNS resolution, enabling clients to resolve fully qualified domain names (FQDNs) without manual configuration. For example, if a client receives the domain name 'example.com', a query for 'server' becomes 'server.example.com'.

This command is essential in enterprise networks where consistent DNS suffix assignment simplifies network management and user access. It is typically used alongside other DHCP options like DNS servers, default gateway, and lease time. The command operates at the DHCP pool level, meaning different pools can assign different domain names to different subnets.

Alternatives include manual DNS configuration on clients or using DHCP option 15 (domain name) via a DHCP server, but the `domain-name` command provides a direct Cisco IOS method. In the broader workflow, after creating a DHCP pool and specifying the network, you configure options like domain-name, dns-server, and default-router. The command takes effect immediately and is stored in the running configuration.

Privilege level 15 (enable mode) is required to enter global configuration mode and then DHCP pool configuration mode. There is no buffered output; the command either succeeds silently or returns an error if the pool name is invalid. The impact on running config is the addition of a line under the DHCP pool, which can be verified with `show run | section dhcp`.

Syntax·DHCP Pool Config
domain-name [domain]

When to Use This Command

  • Configure a domain name for DHCP clients in a corporate network so they can resolve internal hostnames.
  • Set a domain name for clients in a branch office to ensure consistent DNS suffix for local resources.
  • Automatically assign a domain name to devices in a lab environment for testing and management.
  • Provide a domain name to clients in a guest network for internet access without internal domain resolution.

Parameters

ParameterSyntaxDescription
domainWORD (domain name string, e.g., example.com)Specifies the domain name to assign to DHCP clients. It must be a valid domain name (e.g., cisco.com). Common mistakes include using an IP address or omitting the domain entirely, which results in no domain suffix being sent.

Command Examples

Basic domain name assignment

domain-name cisco.com

No output is generated; the command configures the DHCP pool to send domain name option 15 to clients.

Verifying domain name in DHCP pool

show ip dhcp pool
Pool mypool :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)        : 0 / 0 
 Total addresses                : 254
 Leased addresses                : 10
 Pending event                   : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.1.1          192.168.1.1 - 192.168.1.254         10
 Domain name                        : cisco.com

The 'Domain name' field shows the configured domain name. If missing, clients may not receive the domain suffix.

Understanding the Output

The command itself produces no output. To verify, use 'show ip dhcp pool' and look for the 'Domain name' line. A missing domain name indicates the option is not sent to clients.

Ensure the domain name matches the organization's DNS suffix for proper name resolution.

Configuration Scenarios

Assign domain name to clients on a single subnet

A small office network with 50 hosts on VLAN 10 needs to automatically receive the domain name 'office.local' for internal DNS resolution.

Topology

Router(R1)---Gi0/0 (192.168.10.1/24)---[DHCP Clients]

Steps

  1. 1.Step 1: Enter global configuration mode: Router> enable
  2. 2.Step 2: Enter global config: Router# configure terminal
  3. 3.Step 3: Create DHCP pool: Router(config)# ip dhcp pool OFFICE_POOL
  4. 4.Step 4: Specify network: Router(dhcp-config)# network 192.168.10.0 255.255.255.0
  5. 5.Step 5: Assign domain name: Router(dhcp-config)# domain-name office.local
  6. 6.Step 6: Set DNS server: Router(dhcp-config)# dns-server 192.168.10.1
  7. 7.Step 7: Set default gateway: Router(dhcp-config)# default-router 192.168.10.1
  8. 8.Step 8: Exit: Router(dhcp-config)# exit
Configuration
!
ip dhcp pool OFFICE_POOL
 network 192.168.10.0 255.255.255.0
 domain-name office.local
 dns-server 192.168.10.1
 default-router 192.168.10.1
!

Verify: Use `show ip dhcp binding` to see active leases. On a client, run `ipconfig /all` (Windows) or `ifconfig` (Linux) to confirm the DNS suffix is 'office.local'.

Watch out: If the domain-name command is omitted, clients will not receive any DNS suffix, causing FQDN resolution to fail unless manually configured.

Multiple DHCP pools with different domain names

A company has two departments (Engineering and Sales) on separate subnets. Each department requires a unique domain name for internal resources.

Topology

Router(R1)---Gi0/0 (10.0.10.1/24) [Engineering]---Gi0/1 (10.0.20.1/24) [Sales]

Steps

  1. 1.Step 1: Enter global configuration mode: Router> enable
  2. 2.Step 2: Enter global config: Router# configure terminal
  3. 3.Step 3: Create Engineering pool: Router(config)# ip dhcp pool ENG_POOL
  4. 4.Step 4: Specify network: Router(dhcp-config)# network 10.0.10.0 255.255.255.0
  5. 5.Step 5: Assign domain name: Router(dhcp-config)# domain-name eng.company.com
  6. 6.Step 6: Set DNS and gateway: Router(dhcp-config)# dns-server 10.0.10.1; default-router 10.0.10.1
  7. 7.Step 7: Exit: Router(dhcp-config)# exit
  8. 8.Step 8: Create Sales pool: Router(config)# ip dhcp pool SALES_POOL
  9. 9.Step 9: Specify network: Router(dhcp-config)# network 10.0.20.0 255.255.255.0
  10. 10.Step 10: Assign domain name: Router(dhcp-config)# domain-name sales.company.com
  11. 11.Step 11: Set DNS and gateway: Router(dhcp-config)# dns-server 10.0.20.1; default-router 10.0.20.1
  12. 12.Step 12: Exit: Router(dhcp-config)# exit
Configuration
!
ip dhcp pool ENG_POOL
 network 10.0.10.0 255.255.255.0
 domain-name eng.company.com
 dns-server 10.0.10.1
 default-router 10.0.10.1
!
ip dhcp pool SALES_POOL
 network 10.0.20.0 255.255.255.0
 domain-name sales.company.com
 dns-server 10.0.20.1
 default-router 10.0.20.1
!

Verify: Use `show ip dhcp pool` to see configured pools. On a client in Engineering, `ipconfig /all` should show 'eng.company.com' as the DNS suffix.

Watch out: Ensure the network statements do not overlap; overlapping pools cause unpredictable DHCP behavior.

Troubleshooting with This Command

When troubleshooting DHCP domain name assignment, first verify that the DHCP pool is correctly configured with the `domain-name` command. Use `show running-config | section ip dhcp pool` to confirm the domain name is present. If clients are not receiving the domain name, check that the DHCP pool is bound to the correct interface using the `ip dhcp pool` command and that the `network` statement matches the client's subnet.

Use `debug ip dhcp server events` to observe DHCP packets; look for the 'Domain Name Server Option' (option 15) in the DHCP offer. Healthy output shows the domain name string in the DHCP options. If the domain name is missing, the `domain-name` command may be absent or the pool may be misconfigured.

Another common issue is that the domain name is too long (max 255 characters) or contains invalid characters. Also verify that the DHCP server is enabled globally with `service dhcp`. If clients are on a different VLAN, ensure IP helper addresses are configured on the VLAN interface to forward DHCP broadcasts to the server.

Correlate with `show ip dhcp binding` to see active leases; if no leases exist, the pool may be exhausted or the network statement may be incorrect. Use `show ip dhcp conflict` to check for address conflicts. If the domain name appears in the debug but not on the client, the client's OS may ignore the option; test with a different client OS.

Finally, ensure that no other DHCP server on the network is overriding the option.

CCNA Exam Tips

1.

Remember that 'domain-name' is configured in DHCP pool configuration mode, not global config.

2.

The domain name is sent as DHCP option 15; clients use it for DNS suffix appending.

3.

CCNA may test that 'domain-name' is separate from 'ip domain-name' (global) which is for the router itself.

4.

Know that 'domain-name' in DHCP pool overrides any global domain name for DHCP clients.

Common Mistakes

Configuring 'domain-name' in global configuration mode instead of DHCP pool mode.

Forgetting to apply the command to the correct DHCP pool, leaving clients without a domain.

Using an invalid domain name format (e.g., with spaces or special characters).

domain-name [domain] vs ip dhcp pool [name]

Both commands are essential for DHCP configuration on Cisco IOS, but they serve different functions. The domain-name command is a parameter set within a DHCP pool, while ip dhcp pool creates the pool itself. Network engineers often confuse them because both involve DHCP and share similar terminology.

Aspectdomain-name [domain]ip dhcp pool [name]
ScopeApplies only within a DHCP poolCreates a pool, affects entire subnet
Configuration modeDHCP Pool Config (submode)Global Config
PurposeSets domain name option for clientsDefines pool and enters submode
DependenciesRequires an existing DHCP poolCreates the pool; no prior configuration needed
PrecedenceOverrides global domain-name if setDetermines which pool is used based on network
Typical useSpecifying DNS domain for clientsDefining IP address assignment scope

Use domain-name [domain] when you need to assign a DNS domain suffix to DHCP clients within a specific pool.

Use ip dhcp pool [name] when you need to create a new DHCP pool to allocate IP addresses and define DHCP options.

Platform Notes

In IOS-XE, the `domain-name` command syntax is identical to classic IOS. The output of `show running-config` may be slightly different in formatting but the command works the same. In NX-OS, the equivalent is `ip dhcp pool <name>` followed by `domain-name <domain>` under the DHCP configuration mode, but NX-OS uses a different DHCP server implementation; the command is `domain-name` under the DHCP pool.

For ASA, DHCP services are configured via `dhcpd` commands; the equivalent is `dhcpd domain <domain>` under the interface configuration. In IOS-XR, DHCP server configuration is done via the `dhcp ipv4` submode, and the command is `domain-name <domain>` under the pool configuration. There are no significant differences between IOS versions 12.x, 15.x, and 16.x for this command; it has remained consistent.

However, in newer versions, the `domain-name` command may also be available under the global DHCP configuration mode for default domain name, but the pool-specific command takes precedence.

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