Finding a Lantronix Device on a Subnet

If your router doesn’t disclose the IP table, there are at least five ways you can discover the Xport’s IP; one PC-dependent, one Mac-dependent, and three platform independent.

Technorati Tags: ,



Mac-dependent: download IPNetMonitorX and use it to ping all devices on your subnet. It won’t find Xports specifically, it’ll just find all active devices. Do it once with the Xport unplugged, and note all addresses active. Do it again with the Xport plugged in, and note the new address in your list. That’s the Xport. (note: IPNetMonitorX is not free, but it is very handy software if you administer a system and work on a Mac)

PC-dependent: download the DeviceInstaller software from Lantronix on your PC. It’s free and it’s designed to sniff out and configure Xports on a network. It’ll find your Xport and tell you its IP and let you configure it.

Independent: Use the Processing query app below. It will send out broadcast UDP packets, querying every device on the subnet. Any that are Xports or Coboxes will reply, and you’ll have their IP addresses.To use it, you’ll need Processing and the UDP library from Hypermedia.

Note: both my app and the installer app will return all Xport addresses. If you’re on a subnet with a lot of Xports (like ITP) make sure you know the MAC address of yours, so you can identify it in the table.

A fourth method: Serially configure your Xport with a hard-coded address, e.g. 192.168.2.150. That way you’ll always know. This is the easiest method.

Processing app:

import processing.net.*;

/*
  Lantronix UDP Device Query
 
 Sends out a UDP broadcast packet to query a subnet for Lantronix
 serial-to-ethernet devices.
 Lantronix devices are programmed to respond to UDP messages received on
 port 30718.  If a Lantronix device receives the string 0x00 0x00 0x00 0xF6, 
 it respond with a UDP packet containing the status message on port 30718.
 See the Lantronix integration guide from http://www.lantronix guid for the details.
 
 This program uses the Hypermedia UDP library available at 
 http://hypermedia.loeil.org/processing/
 
 by Tom Igoe
 Created 18 April 2006
 */

// import UDP library
import hypermedia.net.*;


UDP udp;                  // define the UDP object
int queryPort = 30718;    // the port number for the device query
String broadcastIpAddress = "128.122.151.255";  // fill in IP address here

void setup() {

  // create a new connection to listen for 
  // UDP datagrams on query port
  udp = new UDP(this, queryPort);
// listen for incoming packets:
    udp.listen( true );

}

//process events
void draw() {
  // twiddle your thumbs.  Everything is event generated.
}

/*
 send the query message when any key is pressed:
 */
void keyPressed() {
  byte[] queryMsg = new byte[4];
  queryMsg[0] = 0x00;
  queryMsg[1] = 0x00;
  queryMsg[2] = 0x00;		
  queryMsg[3] = (byte)0xF6;

  // send the message
  udp.send( queryMsg, broadcastIpAddress, queryPort );
}

/*
  listen for responses
 */
void receive( byte[] data, String ip, int port ) {	

  String inString = new String(data);    // data converted to a string
  int[] intData = int(data);             // data converted to ints
  int i = 0;                             // counter
  // print the result:
  println( "received "+inString+"  from "+ip+" on port "+port );

  // parse the payload for the appropriate data:
  print("Opcode: ");
  println(intData[3]);

  // if the fourth byte is <F7>, we got a status reply:
  if (intData[3] == 0xF7) {		
    // firmware data is bytes 4 to 20:
    print("Firmware data: ");
    for (i=4; i < 20; i++) {
      print(" " + Integer.toHexString(intData[i]));
    }
    // MAC address is bytes 24 to 30 (the end):
    print("\nMAC Addr: ");
    for (i=24; i < intData.length; i++) {
      print(" " + Integer.toHexString(intData[i]));
    }
    print("\n\n");
  }
}
This entry was posted in Lantronix. Bookmark the permalink.

Comments are closed.