In IT, many positions are compartmentalized based on the primary role’s responsibilities. With every organization being its own entity with unique needs, sometimes these roles will cross-pollinate, and IT pros will find themselves wearing many hats.
To complicate matters further is the influx of heterogeneous networks—populated with all matter of Apple, Linux, and Microsoft devices. Being multifaceted among job roles and proficient with different OSes is increasingly essential to modern IT pros being able to accomplish tasks across multiple platforms, sometimes at the drop of a hat.
Recently my colleague, a Mac systems administrator looking to gain more hands-on experience in network administration, was tasked with configuring several switches that were to be installed in production offices. Having only their trusty MacBook Air handy, they did not have access to the software typically used to configure devices and their laptop did not have the legacy serial port needed.
SEE: Apple macOS Mojave: An insider’s guide (free PDF) (TechRepublic)
Luckily, with a USB to micro-USB cable in hand, macOS includes the native Screen command that allows for tunneling consoled communications over USB. This allows users to interface with devices that support console connections, like the managed network switch, in this case, to gain access to its internal OS and configure it—just as one would with a serial cable and commonly used software, such as Putty.
Note: Since Macs do not have serial connections built-in, a USB cable will work just fine. The only caveat is the connector type on the device to be configured. Some modern devices have moved away from serial connections to micro-USB, while others feature a full-size USB port, so make sure you have the right cable for the job before beginning.
How to identify the communications port
1. Connect one end of the USB cable to your Mac computer and the other to the device you wish to console into.
2. Launch Terminal, and enter the following command:
3. The Terminal will respond with the full string that identifies the USB modem connection that you will use to console into the device in the following section. Typically, it is something like “/dev/tty.usbmodem1234567.”
How to establish a console connection
1. Launch Terminal, and enter the following command:
screen “USB_MODEM_STRING” “BAUDRATE_THE_DEVICE_COMMUNICATES_AT”
Example using the string in the previous section and a baudrate of 9600:
screen /dev/tty.usbmodem1234567 9600
2. After pressing Enter, the Mac will now open a console connection to the device, and if the baudrate is set correctly (it must match or else the bits will not flow properly) a connection will be opened, and you’ll be greeted with the CLI of the device you’re about to configure.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays