Before joining Twitter to work in their data center I used PuTTY to connect networking devices like switches or routers. I didn’t know about different applications even after switching to Linux in 2015 because by that time I wasn’t connecting to devices anymore. So when it was time for me to connect to a switch in the data center to troubleshoot a port I asked how to install PuTTY. My coworker, a grizzled yet friendly older man who knew a great deal about networking, suggested I use screen instead. When I told him I didn’t know what that was or how to use it I got an extensive lesson about the command. Here’s what I learned.
Using Screen To Connect To Network Devices Requires An USB To RJ45 Cable
Yes, before using screen you need an USB to RJ45 cable. You may hear people call these a “Cisco cable.” If you don’t have one you can buy a generic cable online. Here’s one I found on Amazon for $10 USD. (Not an affiliate link.) However, these cables come with new switches or routers so many IT departments should have at least a few laying around.
The reason for this cable is so your computer can communicate properly to the switch or router. There are other way to connect to the switch or router but I won’t focus on those in this article. Once you have your cable connect the USB connector into a free USB port on your computer. Then connect the RJ45 connector to the “console” port on your network device.
Using Screen To Connect To Network Devices Requires /dev
All right, the next step of using screen to connect to a network device is to navigate to the /dev directory in Terminal. This directory lists all the special devices or device files on your computer. This is the same whether you’re using a Linux distribution or Mac OS.
Searching the /dev directory you should have a device listed “tty.usbmodem” or something similar. You may have to search the directory using “ls | grep usb” or “ls -ltr /dev/usb” commands. Once you know the device name of your cable you can now connect!
Finally, Let’s Connect Using Screen
You should still have Terminal open so I suggest open a new tab. Type the following at the prompt: “screen tty.usbmodem” (at tty.usbmodem you enter the specific device name you found in the previous step.” That will start the screen program and connect to the switch or router. (NOTE: If that doesn’t work then you may not have screen installed. Depending on your OS you can install screen through the Terminal using your package manager.)
If you see a login prompt then you’re good to go. Or if your network device is brand new then you will see a setup mode.
This guide is a quick overview on using screen to connect to a network device. The command has many flags you can use to configure the new window. I suggest reading additional articles like this one and watching YouTube videos for an actual demonstration. Happy networking!