MOXA NPort Ethernet to Serial

From Swivel Knowledgebase
Jump to: navigation, search


Overview

The MOXA NPort 5000 and 6000 Series device allows a Serial GSM modem to be connected to a Swivel appliance through a ethernet network connection. See also the NowSMS How to guide.


Prerequisites

  • MOXA NPort 5000 or 6000 series device

tested with

    • NP5110
    • NP6150
  • Serial GSM modem
  • Swivel appliance v2.x
  • Swivel appliance v3.x
  • New version of the GSM Modem Transport class - ModemTransport.class. Please contact Swivel support for this, if it does not exist under /webapps/pinsafe/WEB-INF/classes/com/swiveltechnologies/pinsafe/server/transport. Since it is still under development at the time of writing this article (this is required in order to detect the new Serial Port ttyS99 from within the Swivel Core).

Configuring the Swivel appliance

Versions 2.0.15 appliances (not 2.0.16) have the NPort software pre-installed. Earlier versions of the appliance will need to install and then configure the appliance.


Swivel 2.0.15

These appliances have the Nport software installed, continue with configuration.


Swivel 2.0.16 appliances and Swivel 2.0.14 and earlier appliances - Nport Software Installation

This is for appliances 2.0.14 or older where the NPort software is not installed.

From the command line install the software using the following command (requires internet connectivity from the appliance.

rpm –ivh http://yum.swivelsecure.net/files/drivers/npreal-2.1.18.1-5.i386.rpm

or locally using

rpm -ivh npreal-2.1.18-1-5.i686.rpm

Example:

  [admin@single swivel]# rpm -ivh ./npreal-2.1.18-1.i686.rpm
  
  Preparing...                ########################################### [100%]
     1:npreal                 ########################################### [100%]
  
  Loading TTY Driver...
  Complete.

Configure the MOXA NPort Adapter

The Official MOXA NPort User Guide - http://www.moxa.com/doc/manual/nport/5110/NPort_5110_Users_Manual_v2.pdf

Connecting the MOXA to the Network

Connect one end of the Ethernet cable to NPort's 10/100M Ethernet port and the other end of the cable to the Ethernet network. The MOXA NPort will indicate a valid connection to the Ethernet in the following ways:

  • The Ethernet LED maintains a solid green colour when connected to a 100 Mbps Ethernet network.
  • The Ethernet LED maintains a solid orange colour when connected to a 10 Mbps Ethernet

network.

  • The Ethernet LED will flash when Ethernet packets are being transmitted or received.

The MOXA adapter are configured with the following default private IP address:

192.168.127.254

Once the adapter is connected to the network, you MUST assign it a static IP address which should be accessible by the GSM and pingable by the Swivel Appliance.

Edit the NPreal2 File

To change the remote modem IP address edit the file /etc/init.d/npreal2

The default IP used is 192.168.127.254

Edit the below line to the new Static IP

DEVICE_IP=192.168.127.254

Setting up a Virtual Serial Port in VMware

Note - You will need to power down the VM before adding a new serial port.

1. Select a virtual machine.

2. In the VM Hardware panel, click Edit Settings.

3. Click "Add..." and then Serial Port.

4. Click Next and select "Connect via Network".

5. Under Network Backing, select Client (VM initiates connection).

6. The Port URI must be the static IP address set for the MOXA adapter, with a telnet prefix and port number of 4001.

Example: telnet://192.168.0.1:4001

7. Click Finish.

Connecting to the MOXA Adapter

Plug the MOXA NPort Adpater into the GSM Modem and ensure that you can see the serial port ttyS99 from the Swivel Appliance. To confirm, please run the following commands:

 dmesg | grep tty 

E.g Output ttyS99 at 0x03f8 (irq = 4) is a 16550A

OR

 setserial –g /dev/ttyS99

Start and Stop the MOXA NPort service

The MOXA NPort service has the following commands:

To start the service

service npreal2 start

To stop the service

service npreal2 stop

Please Note: The NPreal (MOXA) service does not start automatically on boot up and has be started manually (if the Appliance has been rebooted).

Example:

  [admin@single ~]# service npreal2 start
  
  Adding Server...
  
  ttyr00, cur00
  
  Added RealCom server: ip : 192.168.0.100
  
  mknod -m 666 ttyr00 c 33 0
  
  mknod -m 666 cur00 c 38 0
  
  Complete.


Example:

  service npreal2 stop
  
  Delete Server ...
  
  rm -f /dev/ttyr00
  
  rm -f /dev/cur00
  
  Deleted server: 192.168.0.100
  
  Complete.

Configure a GSM Modem

On the Swivel Administration console configure a Swivel group to use a GSM modem. For further information on configuring transports see Transport Configuration

Destination Attribute: Ensure this is set to phone

Strings Repository group: To send security strings by SMS ensure that this is set to a group

Alert Repository Group: To send alerts by SMS ensure that this is set to a group


GSMmodem.JPG


Configure the GSM Modem Settings

On the Swivel Administration console configure the GSM modem created above

Serial Port: The serial port /dev/ttyS99 should be selectable

Bit Rate: 115200 - The Baud Rate MUST be set to 115200 and not 9600.

Bits: 8

Parity: None

Stop Bits: 1

Flow Control: None

These settings may need to be varied for some installation.


GSM Modem settings details.jpg

Testing

Send a SMS from the Swivel Appliance using minicom - please see Send a Test Message.

Also, from the User Administration screen, navigate to a User and Send String. Check in the Swivel logs and check that a SMS message has been added to the message queue and then message sent can be seen in the log.

To check if the module (driver) is loaded From the command line run the following command

lsmod | grep -i npreal2

Example:

  lsmod | grep -i npreal2
  
  npreal2               223556  1

If there is a 1, that means it's loaded.

Known Issues

If the GSM Modem is timing out or a Message is Added to Queue, please ensure that the Baud Rate is set to 115200 within the minicom setup and Swivel.

Please see: Minicom Setup.

The Moxa driver service must be started before Tomcat. If you have difficulty getting it working, try restarting Tomcat.

Troubleshooting

Can the MOXA NPort device be pinged from the Swivel appliance?

Is port 80 or 443 open to the MOXA NPort, are any ports being blocked.

Check the Swivel logs.

MODEM_EXCEPTION Port name - NONE; Method name - openPort(); Exception type - Port not found.

This is seen when a Serial Port is set to NONE under the GSM Modem Transport. It is known, if the ModemTransport.class is being used, then you may need to restart Tomcat after changing the Serial Port from NONE. Or the serial port is not set to ttyS99 within minicom.