Summary
This post contains some notes for switching a Cisco switch over to a different DNS server. Specifically, I will be adding, removing, and testing within the process of moving over to new DNS server infrastructure.
In the case of switching over to another name server. Generally when you’re getting rid of infrastructure you need to remove the old configuration so there aren’t any future issues. Plus having a clean configuration is always good.
Adding The New DNS Server
Connect to the console or login remotely to the switch using SSH. Listing the current running configuration to show what the DNS server is set to now.
!
ip domain-name lab.example.com
ip name-server 192.168.1.50
!
Now that I’m SSHed into the switch I can go into the terminal configuration prompt for the switch. I do this by executing the following command.
configure terminal
The following command will add the new name server for name resolution.
ip name-server 192.168.1.51
This adds another name-server configuration entry in the running configuration for the switch. As seen below. Though this server will be replacing the old one. I do this in the next series of steps within this post. Good reason for removing the old entry is so the switch isn’t trying to use an IP for name resolution. This can cause timeouts with DNS.
Though, this brings up another thing. Should this just be another server. There is really no need to remove the old one. As long as the other server is still up. It will provide redundancy for name resolution on the switch.
!
ip domain-name lab.example.com
ip name-server 192.168.1.50
ip name-server 192.168.1.51
!
Removing The Old DNS Server
In this case the new name server is replacing the one that currently resides in the network. So it’ll need to be removed. This can be done using the following command.
no ip name-server 192.168.1.50
Checked the running configuration and it looks like the name server has been switched over to the new infrastructure server IP address. The old server has been removed.
!
ip domain-name lab.example.com
ip name-server 192.168.1.51
!
Testing Configuration
Testing is always a good option. This command pings the infrastructure server. Output will be shown next.
ping inf-01.lab.example.com
Based on the output. It looks like this is working. It resolves the correct IP address of the server and it pings it.
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/11 ms
When that’s configured, tested, and working. Copy the running configuration of the switch to the startup-config. If no one knows how to do this. There’s a link for that.