Lesson 1 of 5

Hostname and Domain Configuration

Lab Objectives

  • Configure and verify device hostnames on routers and switches in the lab topology.
  • Configure basic DNS behavior on devices by disabling DNS lookups to avoid command delays.
  • Create a local management username and enable local login for remote sessions.

Tip: In production networks, setting clear hostnames and managing DNS lookup behavior prevents operational confusion and delays when an operator mistypes a command. Hostnames are also used by monitoring systems and logs to identify devices.

Topology (BASE LAB TOPOLOGY — exact IPs on every interface)

                      [Internet]
                     203.0.113.1
                          |
                        R1 (Gateway)
          Gi0/0: 10.10.10.1 | Gi0/1: 10.10.20.1 | Gi0/2: 10.10.30.1
                        /  |    \    \
                      /    |     \    \
                   R2     R3     R4
 Gi0/0: 10.10.10.2      Gi0/1: 10.10.40.1  Gi0/0: 10.10.30.2
 Gi0/1: 10.10.40.1      (other interfaces as needed)
    /   \                 |
  S1     S2               S3
 /  \    |              /  \
PC1 PC2  PC3         PC4  PC5

IP SCHEME:
- 10.10.10.0/24 — R1–R2 link (R1 Gi0/0 = 10.10.10.1, R2 Gi0/0 = 10.10.10.2)
- 10.10.20.0/24 — R1–R3 link (R1 Gi0/1 = 10.10.20.1)
- 10.10.30.0/24 — R1–R4 link (R1 Gi0/2 = 10.10.30.1, R4 Gi0/0 = 10.10.30.2)
- 10.10.40.0/24 — R2–S1 link (R2 Gi0/1 = 10.10.40.1)
- 192.168.1.0/24 — VLAN 10 (Sales)
- 192.168.2.0/24 — VLAN 20 (Engineering)
- 192.168.3.0/24 — VLAN 30 (Management)
- 203.0.113.0/24 — Public/Internet simulation

Lab Tasks (Try It Yourself First!)

Complete these tasks WITHOUT looking at the solution below. Use ? and show commands to figure it out.

Task 1: Set Hostnames

Configure each router and switch with a clear hostname matching the diagram: R1, R2, R3, R4, S1, S2, S3. (Do this from global configuration mode.)

Task 2: Disable DNS Lookups

Disable DNS lookups on each device so the device does not attempt to resolve mistyped commands as hostnames. (Use the global command that prevents DNS queries from the device.)

Task 3: Configure Local Management User

Create a local user named nhprep with privilege level 15 and the password Lab@123. Configure VTY lines to use local authentication for remote access.

Think About It: Why might you prefer to disable DNS lookups on infrastructure devices in a lab or production environment? What are the trade-offs if you later need name resolution from the device?


Lab Solution

Task 1 Solution: Set Hostnames

What we are doing: We are assigning meaningful names to each device so humans and tools can identify them easily in logs, CLI prompts, and monitoring systems. Hostname configuration is local to the device and is stored in running-config.

Example commands for R1:

configure terminal
hostname R1
end

What just happened:

  • configure terminal — enters global configuration mode so we can change device settings.
  • hostname R1 — sets the device prompt to R1, which updates the running configuration and appears in the CLI prompt.
  • end — exits configuration mode.

Verify:

show running-config | include hostname

Expected output (on R1):

hostname R1

Repeat the same commands on each device, replacing the name accordingly (R2, R3, R4, S1, S2, S3). Example for R2:

configure terminal
hostname R2
end

Tip: Hostnames must be unique on the network for clarity in logs and management systems.


Task 2 Solution: Disable DNS Lookups

What we are doing: We disable the device attempting to perform DNS resolution when a mistyped command is entered (prevents device from sending DNS queries to name servers and causing delays).

configure terminal
no ip domain lookup
end

What just happened:

  • no ip domain lookup — disables the default behavior where the IOS will try to resolve any command token it thinks is a hostname. With this disabled, when you mistype a command the device will immediately return an error rather than waiting for DNS timeouts.

Why this matters: In labs and many production environments, accidental delays from DNS lookups can slow troubleshooting. If you need DNS resolution for hosts, enable name servers explicitly; for basic device operation it's common to disable lookups.

Verify:

show running-config | include no ip domain lookup

Expected output:

no ip domain lookup

Test behavior interactively (optional): mistype a common command and observe immediate "Invalid input" response rather than a delay caused by DNS.


Task 3 Solution: Configure Local Management User

What we are doing: Creating a local user account and telling the VTY lines to use local authentication provides a secure way to log in for telnet/ssh sessions.

configure terminal
username nhprep privilege 15 password Lab@123
line vty 0 4
 login local
 end

What just happened:

  • username nhprep privilege 15 password Lab@123 — creates a local account named nhprep with full administrative privileges (15) and password Lab@123.
  • line vty 0 4 — enters VTY line configuration for remote connections.
  • login local — forces the VTY lines to authenticate against the local username database we just created.

Verify:

show running-config | section username
show running-config | section line vty

Expected output snippets:

username nhprep privilege 15 password Lab@123

and

line vty 0 4
 login local

Real-world context: Using a centralized AAA server is preferred in production, but local accounts are a valid fallback during initial configuration or in small networks.


Troubleshooting Scenario

Scenario: Hostname still shows default after reload

Symptom: After saving and reloading, the device prompt shows the old or default hostname.

Your task: Find and fix the issue.

Hint: Check whether the hostname is saved to startup-config.

Solution:

  • Enter the device and confirm running-config contains the hostname:
show running-config | include hostname
  • If present but hostname reverts after reload, ensure you saved the config:
write memory

or

copy running-config startup-config
  • Verify show startup-config | include hostname now reflects the intended hostname.

Warning: Failing to save the running-config means changes are lost on reboot.


Verification Checklist

  • Each device (R1, R2, R3, R4, S1, S2, S3) shows the correct hostname in the running-config.
  • no ip domain lookup is present on every device.
  • Local user nhprep with privilege 15 exists and VTY lines are configured with login local.

Common Mistakes

SymptomCauseFix
Hostname not retained after rebootRunning-config not copied to startup-configcopy running-config startup-config
Typo in hostname commandMistyped hostname in configRe-enter hostname <name> in global config
Still seeing DNS lookup delaysno ip domain lookup not configured or re-enabledConfigure no ip domain lookup and save config
Cannot log in remotelyusername not created or login local not set on VTYCreate username nhprep ... and set line vty 0 4 -> login local

Challenge Task

Configure the same hostname, DNS lookup behavior, and local user but also configure the device prompts to display the domain in addition to the hostname (use lab.nhprep.com). Note: this is a challenge — research the commands to add a domain portion to the prompt and apply it consistently across devices.

Important: When providing domain names in explanations or examples use lab.nhprep.com and passwords Lab@123 when required by examples.