Assign Switch an IP Address for SSH (Cisco)

Problem

Create a VLAN with an IP address on a switch so it can be remotely managed via telnet/SSH

tl;dr

conf t
vlan 42
name switch-management
int vlan 42
description switch-management
ip address 172.16.1.1 255.255.0.0

Solution

To be able to SSH into a switch, you need to assign it a management interface. On level 2 switches (with no routing capability), such as the good old Catalyst 2950's, this is done through a VLAN. However, keep in mind that if your VLAN is not routed, the host you are connecting from must be on the same subnet/VLAN as the management interface to be accessible.

First, create a new VLAN:

conf t
vlan 42
name switch-management

Then assign the VLAN interface an IP:

int vlan 42
description switch-management
ip address 172.16.1.1 255.255.0.0
no shut

This will now allow any host on the 172.16.1.1 /16 subnet (aka VLAN 42), such as the network manager's computer, to connect to the switch via telnet or SSH:

telnet 172.16.1.1
ssh 172.16.1.1

Input methods have to be allowed on virtual terminal lines (vty 0 4) for this to work.

Save your changes

Make sure to exit configuration mode and write your changes.

end
wr


Was this article helpful?

mood_bad Dislike 12
mood Like 5
visibility Views: 20199