Yeah, I managed to put my hands on a Cisco Catalyst 3560G Series switch which was specifically meant for enterprise use cases and I actually got it from the local market selling used stuff at my country, it's working perfectly in a very good condition.
Of course, the first thing you will have to do after purchasing a used network switch is resetting it to factory settings and it's really straight forward when it comes to Cisco switches, I will write about that later on in a new post.
Then, you definitely want to configure it to work in your own network with specific settings because it is a smart switch for which you want to reach its command line through the serial console interface and that's what I am going to explain in details today.
Since I am labeling this as a Homelab tutorial where we mostly like to run Linux on our servers and desktop computers, I would rather explain through steps specifically on that operating system and its widely known distributions including:
- Debian based distributions like Ubuntu, Elementary OS, Mint, etc.
- RPM Package Manager (RPM) based distributions like CentOS, Fedora, etc.
- Pacman Package Manager based distributions like Arch and Manjaro.
And many others, there's no limit for the diversity of an open source project like Linux but definitely the software and steps we are going to use are the same.
Install Minicom from Package Manager
That's why I've been mentioning each distribution matched with its package manager. We need to install the package for "Minicom" which is described by the maintainer as follows:
Minicom is a text-based serial port communications program. It is used to talk to external RS-232 devices such as mobile phones, routers, and serial console ports.
Now, just figure out what is the package manager for your Linux distribution and open up a terminal on your screen.
sudo -s apt update apt install minicom exit
sudo -s yum install minicom exit
sudo -s pacman -S minicom exit
That's about it, you should now be ready to go.
Connect RJ45 Console Port to Linux Computer
In order to connect with the RJ45 console port on the back of your Cisco switch you have two options.
RS232 to RJ45
This is actually the cable that comes packed originally in the box when you buy the switch, if you don't have one of these just buy from AliExpress or Amazon. I got mine from this seller on that link.
This won't work if your Linux computer motherboard doesn't have an RS232 DB9 COM Serial Port which leaves you with the second option.
USB to RJ45
This might be the ideal choice for many of you, because every motherboard will definitely include some USB ports. I also happen to have one of these and I bought it from this seller on that link.
Configure Minicom to Work with Cisco Switch
Okay, it's time to create a Minicom configuration file.
Find Serial Connection Path
The moment you connect the switch from its RJ45 console port to your Linux computer, open up a terminal and enter.
dmesg | grep tty
Let me show you a sample output if you are using an RS232 to RJ45 cable.
[ 0.000000] console [tty0] enabled [ 0.726168] 00:08: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
In the other hand if you are using an USB to RJ45 cable, you should get something like this.
[155582.296838] usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB0
What you are looking for is the text marked with white colour as shown in the samples above. Now, accordingly for each output sample the serial connection path is:
Note yours down and proceed to the next step.
Create Configuration File
Again, open the terminal and enter.
sudo minicom -s
You will be greeted with the main menu list for Mnicom now go to
Configuration → Serial Port Setup and you should see another menu to define which serial port path you are going to use.
A on your keyboard and enter the serial connection path that you have noted from the previous step which is for example something like this
/dev/ttyUSB0 in my case, then press
Enter to go back to the serial port setup menu.
E on your keyboard, resulting in another menu for
Bps/Par/Bits rate, from that menu press
C to set the rate to
9600 8N1 then press
Enter to go back to the serial port setup menu.
Last but not least, I prefer to enable the
Hardware Flow Control so just press
F on your keyboard and toggle that option to
Yes then press
Enter to go back to Minicom main menu.
In the main menu choose the
Save setup as option and give it a name, in my case I named it as
cisco then finally press
Enter and you have successfully created a Minicom configuration file to connect with your Cisco switch.
Communicate with Cisco Switch Serial Console
Basically, every time you want to communicate with your Cisco switch you will only have to load the configuration file that you have created for Minicom with a simple single command from the terminal.
sudo minicom cisco
Notice that I am running Minicom calling the "cisco" configuration file that we created earlier, if everything is done correctly press "Enter" right after you run that command and you will be presented with something like this:
Welcome to minicom 2.7.1 OPTIONS: I18n Compiled on Aug 13 2017, 15:25:34. Port /dev/ttyUSB0, 02:35:45 Press CTRL-A Z for help on special keys Switch>
If you can see the hostname "Switch" then that indicates it has connected successfully, enter any command to the switch like
show interface for example, and see if you are getting a response to make sure.