1

Brief:

I want my Raspberry Pi to appear as multiple different devices on a network.

Details:

My laboratory contains multiple test equipment that communicate GPIB/SCPI/VISA via a USB interface.

I would like any laptop on the network to be able to connect to any piece of equipment via WiFi.

Each piece of equipment should present to the network with its own unique hostname and implement SCPI commands on port 5025 (and sometimes telnet on 5024 and web GUI on 80).

I need to conform to this way of interfacing in order to be compatible with existing laboratory software that interfaces with SCPI equipment.

I can achieve my objective using a unique Raspberry pi for each piece of equipment as an ethernet-to-serial adapter. I can install the USB related drivers to control each piece of equipment and set up a TCP IP socket / server that listens for connections and forwards commands and responses directly between the USB device and WiFi (ethernet) connection. However, it seems quite inefficient to use one Raspberry Pi per equipment when a single Raspberry Pi and a couple of 1-to-4 USB expanders could easily service all the equipment on a single workbench. (It will also save a lot of power outlets being consumed with plug packs to power the Pis)

Can I make a single Raspberry Pi appear as multiple TCP IP devices on my network? (One for each connected USB device and perhaps one for the Pi itself so that I can send configuration information.)

Have you tried searching online for an answer?

Yes. Here is what I found.

  1. Setting up virtual network interfaces. I note that modifying /etc/network/interfaces won't work on Buster. It looks like the preferred approach has something to do with iproute2. If I can address the (virtual interface) devices by a text-based hostname rather than a static IP, that would be desirable, but the means of achieving this is not very well documented. Overall, this approach appears promising, but I am having a little trouble putting it all together.

  2. Perhaps I can run multiple virtual machines on my Pi. Seems like overkill.

  3. Continue to use multiple Raspberry Pis; one per piece of lab equipment. I don't like this for abovementioned reasons.

  4. Modify the protocol so that I have one hostname (just the Pi) and set up a protocol that re-routes commands to the correct device. I think this might not work with my lab software, which is expecting to send SCPI commands to HOSTNAME:5025

  5. Set up the software on the Raspberry Pi that is connected to the equipment. It is not supported by Linux (and would probably be too much for the poor Pi to handle anyway).

0

1 Answer 1

1

Here's how I would do it - for multiple IP's you'll be creating a file in /etc/network/interfaces.d

lets create /etc/network/interfaces.d/wlan0 - name doesn't matter really

auto wlan0
iface wlan0 inet manual
  up ip address add 192.168.1.100/24 dev wlan0 label wlan0:0
  up ip address add 192.168.1.101/24 dev wlan0 label wlan0:1

Clearly, you would use the appropriate subnet for your environment - mine happens to be 192.168.1.0/24 and my main gateway is 192.168.1.1

Now run

sudo systemctl restart networking

And check that the addresses are on wlan0

ip address show dev wlan0

You should see your IP addresses listed

Now, for hostname resolution, if your SCPI client (on the laptop) can use mDNS/Bonjour/zeroconf/avahi (the protocol with many names) - I would suggest install avahi-daemon

sudo apt install avahi-daemon

then edit /etc/avahi/hosts and add

192.168.1.100 host0.local
192.168.1.101 host1.local

The above assumes that you can run multiple instances of your SCPI "host" (or whatever it is) bound to a particular IP address

5
  • Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details. RTNETLINK answers: File exists ifup: failed to bring up wlan0 Feb 3, 2021 at 1:49
  • hmm ... I admit I didn't try this with wlan0 ... it works with eth0 - let me see if I did something wrong :p Feb 3, 2021 at 2:02
  • hmm, I get the same error ... but I do get the IP addresses - it's odd, I didn't get that error when I first tested on eth0, but now I do! Feb 3, 2021 at 2:06
  • @Insertnamehere I've changed the config - should work, though it is a bit flakey with the single DHCP address, I'd be tempted to use static in there to be honest Feb 3, 2021 at 2:20
  • Followed the instructions provided in the updated post and everything worked without issue. Feb 3, 2021 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.