I have several sites that have switches with no assigned IP address, or wrong IP address according to our network...
addressing convention. I can telnet to the branch router. Now I want to go through the switch port that the router is connected to and configure the switch. How? I have Cisco routers and switches all around. You can do this, but it takes a little bit of work. It is a bit complicated, but I will give it my best shot.
For the switches that have the wrong IP address you should use the CDP protocol on the router to show details of the neighboring device. Use the command
show cdp neighbor detail
and it will show the IP address of the device. On the router, go to the interface and configure a secondary IP address that is within the network of the IP address of the switch. For example, if the switch has an IP address of 192.168.25.4, then the following is the interface config from your Cisco router:
interface Ethernet 0/0
ip address 172.16.1.1 255.255.255.0
ip address 192.168.25.200 255.255.255.0 secondary
Now try to telnet to the switch and it will work. You can then change the address of the switch to an IP address in the range of 172.16.1.0/24 and all should be well.
For a Cisco switch that has no IP address, you will not be able to telnet to it, so we have to use some physical means to connect. I would guess that you don't actually want to go where the device is, so here is a tip.
First, get a Cisco rollover cable and connect it from the AUX port on your router to the console port on your switch. Most Cisco routers have AUX ports -- Cisco 2500, 2600, 3600 and so on all have them. In your config, you should see
line aux 0
and this will confirm that you have one in the router.
Now we configure the AUX port to act as a telnet server, so that you can telnet to it. When you do this, it will allow you access the console port on the switch. Add the "transport input all" to the aux port config as follows:
line aux 0
transport input all
The next thing to type is the "show line" command at the exec prompt. Look for the AUX port in this list and then the line number that it is on. For a Cisco 2600 or 3620 series, the AUX port is line 129; for a Cisco 3640 series is it line 257; and for a Cisco 2500 it is line 1. This is important, because this tells you the port number to use when you telnet to the AUX port.
Now, let's say that the Ethernet address of the router is 172.16.1.1. Test access to the AUX port by doing the following:
telnet 172.16.1.1 2001
If you are using a Cisco 2600, then
telnet 172.16.1.1 2129
The port number will be 2000 plus the line number of the AUX port.