ip domain-name [domain]
Configures the default domain name appended to incomplete hostnames during DNS resolution, enabling the router to resolve unqualified names into fully qualified domain names.
ip domain-name [domain]When to Use This Command
- Setting a domain name for a small office router so that pinging 'server1' resolves to 'server1.example.com'.
- Configuring a domain name for SSH key generation, as the domain name is required for RSA key pair creation.
- Defining a domain name for a branch office router to simplify hostname resolution in a corporate network.
- Using with 'ip name-server' to ensure DNS queries use the correct domain suffix.
Command Examples
Basic domain name configuration
ip domain-name example.comNo output is generated; the command sets the domain name to 'example.com' in the running configuration.
Verifying domain name configuration
show running-config | include ip domain-nameip domain-name example.com
The output displays the configured domain name. If missing, DNS resolution for unqualified names will fail.
Understanding the Output
The 'ip domain-name' command does not produce output upon execution. To verify the configuration, use 'show running-config | include ip domain-name' which displays the domain name if set. If no domain name is configured, the line will be absent, and the router will not append a domain suffix to unqualified hostnames. This can cause DNS resolution failures for names like 'server1' unless a fully qualified domain name is used.
CCNA Exam Tips
CCNA exam tip: The 'ip domain-name' command is required before generating RSA keys with 'crypto key generate rsa'.
CCNA exam tip: Without a domain name, the router will not append a suffix to hostnames, so 'ping server1' will fail unless 'server1' is in the hosts table.
CCNA exam tip: The domain name is stored in the running configuration and can be verified with 'show running-config | include domain'.
CCNA exam tip: The command is global configuration mode; ensure you are in the correct mode before entering it.
Common Mistakes
Mistake 1: Forgetting to configure 'ip domain-name' before generating SSH keys, leading to an error 'No domain name configured'.
Mistake 2: Using 'ip domain-name' with a trailing dot (e.g., 'example.com.') which is incorrect and may cause DNS issues.
Mistake 3: Confusing 'ip domain-name' with 'ip domain-list' which adds multiple domain suffixes for DNS resolution.
Related Commands
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions