Changing the DNS Server Address on the Cisco Ethernet Switch

To change the DNS server address on the Cisco Ethernet switch:

  1. Access the Ethernet switch using SSH, and log in as the admin user with the administrator password.

    If SSH is not configured, then use Telnet to access the switch.

  2. Change to enable mode:
    Switch> enable
    
  3. List the DNS IP addresses currently in use:
    Switch# show running-config
    
  4. Erase the current DNS server addresses and any invalid IP addresses. This example erases three IP addresses:
    Switch# configure terminal
    Enter configuration commands,one per line. End with CNTL/Z.
    Switch(config)# no ip name-server 10.7.7.2
    Switch(config)# no ip name-server 129.148.5.4
    Switch(config)# no ip name-server 10.8.160.2
    Switch(config)# end
    Switch# write memory
    Building configuration...
    Compressed configuration from 2603 bytes to 1158 bytes [OK ]
    
  5. Configure up to three DNS servers. The following example configures three new DNS servers:
    Switch# configure terminal
    Enter configuration commands,one per line. End with CNTL/Z.
    Switch(config)# ip name-server 10.7.7.3
    Switch(config)# ip name-server 129.148.5.5
    Switch(config)# ip name-server 10.8.160.1
    Switch(config)# write memory 
    Building configuration...
    Compressed configuration from 2603 bytes to 1158 bytes [OK ]
    
  6. Verify the changes:
    Switch# show running-config
    Building configuration...
    ...
    ip domain-name example.com
    ip name-server 192.168.10.2
    ip name-server 192.168.10.3
    ip name-server 192.168.10.4
    ...
    
  7. Save the running configuration as the startup configuration:
    Switch# copy running-config startup-config
    Destination filename [startup-config]? 
    Building configuration...
    Compressed configuration from 14343 bytes to 3986 bytes[OK]
    
  8. End the session:
    Switch# exit