Address already in use when configuring multiple devices
-
Hi Scott,
I'm running into the same issue. Could you figure out how to run multiple local devices?
I installed BACnet4J today and am trying to run the sample tests with mediocre results. As you mentioned, the first device runs fine, but subsequent devices try to bind to the same localBindAddress in bacnet4j.npdu.ip.IpNetwork.Additionally, I'm wondering about the WARNINGs as well. For instance, both my BacnetTest and DiscoveryTest classes spew out the "Another instance with my device instance ID found!" error. The device's MAC address magically changes between sending and receiving its own message. How come?
Best Regards.
-
I was pretty successful when I used virtual interfaces bound to the main interface. I have to track which device is bound to what address and have to use a virtual mac address when I configure it. Using 02:xx:xx:xx:xx:xx is okay as the 02 is for "local" unregistered mac addresses. I track the mac and ip address of the interface and which device is attached. On a linux system I use the ip command to configure the interfaces on startup. Let me know if you need more info.
Scott -
The 02: etc on the mac address has been kindly replaced with smiley faces. 02 colon hex hex colon .....
-
Thanks for your very swift response. I didn't manage to get a working multi-device setup working yet. For some reason, any Linux VM I set up, is slow as fck and I could only work with Windows for now. I tried using the Microsoft Loopback Adapter to set up another network interface, but so far couldn't use that for my second BACnet device. Do you have any idea by chance how to get it working under Windows? I will try to set up a VM tomorrow on my desktop machine at work.
-
I am a linux guy but found this: http://www.sevenforums.com/network-sharing/3156-adding-virtual-network-adapter.html
Good luck! -
I managed to set up an Ubuntu 14 VM with virtual network interfaces. That took me longer than I'd like to admit since I'm no Linux guy nor really just a guy of anything in particular for that matter...
Despite setting up those interfaces and configuring the LocalDevices in both the SlaveDeviceTest and DiscoveryTest classes, I still didn't manage to make them talk to each other. I'm guessing I might have a fundamentally flawed understanding of how to set up such simulation. Could you look over my configuration and tell me if I'm on the right track?My interface configuration is as follows
auto eth0 iface eth0 inet static address 10.0.2.15 netmask 255.255.255.0 gateway 10.0.2.2 auto eth0:2 iface eth0:2 inet static address 9.0.0.2 netmask 255.255.255.0 auto eth0:3 iface eth0:3 inet static address 9.0.0.3 netmask 255.255.255.0
I then try to bind two LocalDevice objects to eth0:2 and eth0:3 (after starting them up with the ifup command):
// In SlaveDeviceTest.java LocalDevice localDevice = new LocalDevice(1969, new Transport(new IpNetwork("9.0.0.255", 2068, "9.0.0.2")));
// In DiscoveryTest LocalDevice localDevice = new LocalDevice(1234, new Transport(new IpNetwork("9.0.0.255", 2069, "9.0.0.3")));
Now, my expectation was that when first starting SlaveDeviceTest and then DiscoveryTest, SlaveDeviceTest would receive the WhoIsRequest. But what actually happens, is nothing. What are my mistakes?
-
I could never get the slave device test to work. The only way this has worked is when the port numbers are identical. This is why using the virtual interfaces was critical. You can set the port to 47808 for all of them.
-
Hm, that's bad.
So just to be clear, I would change the ports of all the IpNetwork objects (2068 and 2069 in my example given) to the same one and that's it, or do I need to configure that somewhere in the Linux system as well?
I did manage to configure multiple Microsoft Loopback adapters yesterday, but only after that did I find out that they can't communicate with each other...You said you used the ip command to set up virtual interfaces. By the looks of it, that seems to be something different to the network interfaces I configured via the "network/interfaces" settings file (and ultimately the ifconfig command I think). I'm checking the man pages for it but I'm not sure what I'm looking at. Could you give me examples of how you set up your virtual interfaces?
-
At the moment that is the big hammer approach. I am experimenting with setting up a virtual network on the linux system just for the bacnet devices. I will let you know how that goes. The ifconfig and ip commands can do the same things. the ip command can do more but for this application ifconfig is just fine. I am going to start a blog of my experiences and give some same code once I get this thing working (just about ready).
Scott