LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get IP using MAC address

I am trying to talk to an embedded device over ethernet.  I can use a utility software package to get the IP address that was assigned to the device and after knowing the IP address, I can use the TCP modules in LabVIEW to talk to it no problem.  The problem is, the end user will not have this utility, so the end user needs a way of getting and or assigning the IP address.  Is there a way I can get or set the IP address using the MAC address?  The MAC address will be printed on the product.  BTW, I'm using LavVIEW 7.0.
Thanks.
0 Kudos
Message 1 of 13
(32,534 Views)
You can tell the local host via the command line software arp what ip address to use for a specific ethernet address. (in fact I believe this is an InArp see below). (I am assuming Windows, but the technique exists for other platforms) use the arp -a command to view current stuff and arp -s .... to set an address for a mac address and assign an ip address on the local machine. Then you can find or set the device as required or allowed.

A similar process is often used on IP printer servers such as HP Jet direct boxes.

However, some devices won't allow this for security, as this could be a hacking exploit. As its your device I guess you will know this or can allow for it during the configuration phase.


Check out the following for more detailed background information: -

http://en.wikipedia.org/wiki/Address_Resolution_Protocol
http://en.wikipedia.org/wiki/ARP_spoofing
0 Kudos
Message 2 of 13
(32,505 Views)
Often these utility programs are based on UDP. If you have a protocol sniffer, you may try to mimic the application's behaviour. Success is not guaranteed, though.
My opinion, based on the limited information given, is that the end user should have the utility software. Supposedly he will own the device, why not the companion software?
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 13
(32,494 Views)
I'm curious as to why this 'embedded device' can't be set to the same default IP before a customer gets it?
0 Kudos
Message 4 of 13
(32,485 Views)
Rick,
I was wondering the same thing, and tech spt at NI had no workaround.
If you find out anything please let me know! Regards, Larry


rickford66 wrote:
> I am trying to talk to an embedded device over ethernet.  I can use a utility software package to get the IP address that was assigned to the device and after knowing the IP address, I can use the TCP modules in LabVIEW to talk to it no problem.  The problem is, the end user will not have this utility, so the end user needs a way of getting and or assigning the IP address.  Is there a way I can get or set the IP address using the MAC address?  The MAC address will be printed on the product.  BTW, I'm using LavVIEW 7.0.
> Thanks.

0 Kudos
Message 5 of 13
(32,471 Views)
A bit more information.  First off, the OS will be a windows platform, W98, W2K or XP.  I don't know a whole lot about networking.  This is my first ethernet project and I'm trying to learn as I go.  For the networking solution, I am using a canned solution (ethernet module) that interfaces the embedded device to the network via a serial port on the embedded device.  The utility program that comes with the ethernet module is supplied by the manufacturer of the ethernet module, with their name all over it.  We want any software that our customers use to have our name on it, so I need to write some software that allows the customer to set up this device on their network.  The only thing I'm sure about is that the product will have a tag on it showing the MAC address that the customer will be able to read.  As for setting to a known IP address at shipment, I was under the impression that only a range of IP addresses were valid within a certain network.  If I choose a default value, won't it be outside the range of 99.99999% of all those out there?  Also, if after the customer changes it, somehow the value is lost, they need to be able to re-establish communication with it by either reading the IP address, or assigning a new one.
Thanks.
0 Kudos
Message 6 of 13
(32,471 Views)
You have quite a few options.
  1. arp -a is a bit tricky, because it only lists the local arp cache. Unless the computer already communicated with the device very recently, it won't show up. You could do a ping sweep of the local subnet, followed by "arp -a" (using system exec) to see all devices.
  2. Why don't you contact the manufacturer of the device who wrote the utility. Most likely there are some easy specifications to get the device to respond (e.g. to a certain broadcast or multicast packet that you can easily generate in LabVIEW).
  3. Where does the device get its IP address? If it uses DHCP, most DHCP server lets you reserve a certain IP for a certain MAC address, keeping the IP address of the device known and constant.
  4. How do you communicate with the device? You could write a very simple port scanner that scans the local subnet on a certain server port (e.g. TCP/21 or TCP/80, etc. then parse the server response for a known string. Since the device is local, use a very short timeout and reset the connection immediately if there is no quick response. This allows you to quickly skip all nonassigned and firewalled local IPs. (Long ago I wrote a simple port scanner that did this in LabVIEW. Maybe I can find it somewhere). Of course this will no longer work well once the customer has multiple such devices on the same subnet. (In this case you need to tell them apart using ARP.)
  5. Maybe the device is SNMP enabled? Again you can do a quick scan on all local devices.

Can you point us to a website of the ethernet/serial device you are using. Is the manual online?

Message 7 of 13
(32,457 Views)
Well, just about every product that ships from where I work has a default IP address. Though most also have a serial port through which it can be configured and some also support DHCP, if a customer needs to configure the product, they first plug it into a second NIC card that they can assign a static IP to.
0 Kudos
Message 8 of 13
(32,449 Views)
I've been thinking about doing this another way.  That is, the embedded controller that connects to the the ethernet module (XPORT-03 from Lantronix) has a USB connection.  I can configure the ethernet module from the back side using a program that talks to it through the USB.  I think I can make that work great, but it would be nice to be able to do it through the network as well.  I was hoping LabVIEW would have some module that could be made to work, similar to the TCP modules.  As for all these other suggestions, I'd have to learn a bit more about how this all works first.  Perhaps I'll pose the question to the ethernet module manufacturer and see how they are doing it.
Thanks.
 
0 Kudos
Message 9 of 13
(32,448 Views)
When I do this at work, with a 'dumb' Modicon Momentum controller ethernet port, I use a program called bootplt.exe. With this program you enter the mac address and the desired ip settings. Then cycle power on the controller and the ip stuff gets set on powerup. Search the web for a bootp utility.
Message 10 of 13
(32,431 Views)