Oct
20

Build and configure you own linux serial console server (reverse telnet)

One of the locations I look after has a stack of 16 Cisco switches that I manage remotely via the Internet. These switches often undergo some very complicated reconfigurations for certain customers of the site and from time to time I have found myself locked out via Telnet and have had to visit site with a serial console cable to put the configurations right.

To avoid any more of these unplanned site visits I decided to sort out a serial console server for this site. If your reading this you probably realize that a Serial Console server is basically a computer with a number of Serial Interfaces and an Ethernet port. You can connect to the console server and the out over one of its serial ports to control the attached devices.

I needed a device with 16 ports. Proper 16-port console servers like those produced by Avocent cost upwards of £1500, so I decided to build my own. I put together the cheapest barebones PC system i could find with a spare PCI-Express slot. Into this spare PCI-E Slot i Installed a Startech 16-port PCI-E Serial Card. (PEX16S952LP) shown below.

Startech PEX16S952LP

I then dug around the storerooms and found 16 standard blue Cisco Serial console cables and connected them from the 16-port breakout cable coming from the serial card and into each of the switches. I installed Ubuntu Server on the system. I could see 16 ttySx devices in /dev/ and i could use minicom to connect to the switch on the end of each /dev/ttySx port. The next stage, expose these serial ports via Reverse Telnet for easy remote management.

The ubuntu package ser2net package describes itself as:

 This daemon allows telnet and tcp sessions to be established with a
unit’s serial ports. Combined with a terminal emulation like xterm or
the Linux console, this can be a very simple means of communicating
with routers, other systems’ serial consoles and other equipment with
a serial port. This is remarkably similar to the reverse telnet
feature of some Cisco routers.

I installed the package with:

sudo apt-get install ser2net

The next step is to configure which TCP ports you want ser2net to listen on and which serial ports to map these to. This is done in /etc/ser2net.conf  my configuration file looks something like this:

BANNER:banner:\r\nser2net port \p device \d [\s] (Debian GNU/Linux)\r\n\r\n

2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner
2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner
2002:telnet:600:/dev/ttyS2:9600 8DATABITS NONE 1STOPBIT banner
2003:telnet:600:/dev/ttyS3:9600 8DATABITS NONE 1STOPBIT banner
2004:telnet:600:/dev/ttyS4:9600 8DATABITS NONE 1STOPBIT banner
2005:telnet:600:/dev/ttyS5:9600 8DATABITS NONE 1STOPBIT banner
2006:telnet:600:/dev/ttyS6:9600 8DATABITS NONE 1STOPBIT banner
2007:telnet:600:/dev/ttyS7:9600 8DATABITS NONE 1STOPBIT banner
2008:telnet:600:/dev/ttyS8:9600 8DATABITS NONE 1STOPBIT banner
2009:telnet:600:/dev/ttyS9:9600 8DATABITS NONE 1STOPBIT banner
2010:telnet:600:/dev/ttyS10:9600 8DATABITS NONE 1STOPBIT banner
2011:telnet:600:/dev/ttyS11:9600 8DATABITS NONE 1STOPBIT banner
2012:telnet:600:/dev/ttyS12:9600 8DATABITS NONE 1STOPBIT banner
2013:telnet:600:/dev/ttyS13:9600 8DATABITS NONE 1STOPBIT banner
2014:telnet:600:/dev/ttyS14:9600 8DATABITS NONE 1STOPBIT banner
2015:telnet:600:/dev/ttyS15:9600 8DATABITS NONE 1STOPBIT banner

Once ser2ner has been restarted with /etc/init.d/ser2net restart i was able to telnet into ports 2000 through to 2015 and gain direct access to the serial port connected to each switch.

You should really at this stage add some restrictive firewall rules to your serial console server, or onto whatever hardware firewll device you use. An article detailing how to easily and effectively manage an ipTables firewall will follow on this site in a couple of days time.

Oct
19

Upgrading Trixbox or Elastix Endpoint Manager

The Endpoint Manager that ships with current Elastix or Trixbox PBXes is a little outdated and lacks support for many modern VoIP Phones currently being deployed. Thankfully there is an actively maintained FreePBX Module which uses the latest configurations and firmwares provided provisioner.net. So you should find support for just about any modern VoIP hardware you might be using.

Download this tarball: endpointmanager-v2.9.2.4.tar or if you want to check for a newer version you can  visit the Endpoint Manager GitHub Repository to obtain the module. When I grabbed the tarball from Github I had to rename the file, and rename one of the archives internal folders before FreePBX would allow me to upload it. The version I have directly linked above has already been renamed and is ready to upload.

Next, login to Elastix/Trixbox and navigate to the FreePBX configuration area. You will need to click the “Unembedded freePBX” link if using Elastix to access the full range of FreePBX web panel options. IGNORE the Endpoint Configurator menu link on the Elastix or Trixbox menu bar. This is for the outdated configuration system.

Unembedded freePBX

In the new FreePBX window click the Tools Tab and select Module Admin. Click Upload Module and then once uploaded enable it and find the button to process the changes and install the module.

Enable Module

You should now have an End Point Manager section under the Tools menu of FreePBX. The first thing to do is enter the End Point Configuration menu to enable some handset types.

Enable any handset types you need to auto provision. FreePBX will download a number of files (firmwares, profiles etc) and unpack them to the correct location ready to be served up via TFTP when the phones boot.

Its worth noting at this point that I was Applying Configuration Changes whenever the orange bar appeared at the top of FreePBX as shown below. You might not need to do this until the point your going to reboot your handsets, but I was clicking it any time there were changes to apply before proceeding to the next step.

When you are done enabling device types click on the End Point Device List from the left hand menu. Enter the subnet your phones are in (e.g. 192.168.0.0/24 or 10.10.1.0/23 etc) and click Go! Endpoint Manager will sweep that subnet to discover supported devices.

subnetsearch

In a few moments you should have a list of all devices discovered, and you can click the checkbox by the Mac Address to select the phones you wish to configure, assign each to an existing FreePBX Extension and then click Add Selected Phones to save the provisioning configurations.

At this point you should click the “Apply Configuration Changes” orange  bar at the top of the FreePBX screen if it is present, and then reboot your phones, they should TFTP boot, grab firmware and config via TFTP and register with your Elastix server within a few minutes of being rebooted.

It is worth noting that I had to ensure that my DHCP tftp server option included the tftp:// prefix when provisioning Polycom phones. The entry in /etc/dhcpd.conf that worked for me is:

option tftp-server-name "tftp://172.16.10.2";

Older posts «