Re: [Bacnet-developers] [BACnet-developers] DNET and gateway
Brought to you by:
skarg
|
From: Steve K. <st...@ka...> - 2021-05-24 15:03:57
|
Hello Derek,
The gateway example already calls dlenv_init(), which calls bip_init() -
aliased as datalink_init():
/* === Initialize the Datalink Here === */
if (!datalink_init(getenv("BACNET_IFACE"))) {
exit(1);
}
Before you run the gateway application, use:
$ export BACNET_IFACE=eth1 ; ./bin/bacgateway
See Q-16/A-16 in the Frequently Asked Questions:
https://sourceforge.net/p/bacnet/src/ci/master/tree/doc/README.faq
If you need to use multiple Ethernet ports for BACnet, then you will need
to use a router application in addition to the gateway application.
Best Regards,
Steve
On Mon, May 24, 2021 at 4:06 AM Derek Noffke <de...@pu...> wrote:
> Thanks Dave and Steve,
>
>
>
> I do appreciate your time, effort and help.
>
> I now understand why I was getting the 255.255… broadcast.
>
>
>
> I have more than 1 Ethernet interface and the “demo” gateway code is not
> really geared to cater for multiple NICs.
>
> My linux device has 2 NICs and I have no way of knowing which NIC the user
> is going to send the who-is request to.
>
> I also have added a SDN so there are 3 possible broadcast submasks to
> calculate.
>
> I will need to add code to the gateway in order to call the bip_init()
> dynamically and then store the corresponding local IP and broadcast address
> in a lookup table.
>
>
>
> If I have this right then when a who-is request is received:
>
> 1) Lookup which NIC it arrived on.
>
> 2) If new then initialize for broadcast using bip_init().
>
> 3) If not new then lookup broadcast submask and save in
> BIP_Broadcast_Address.s_addr so that the library sends the i-am using the
> correct broadcast IP.
>
>
>
> Regards,
>
>
>
> Derek Noffke
>
> PurpleSwift
>
> Cell: 082 780 4680
>
> Tel: 021 761 8264
>
>
>
>
>
>
>
> *From:* Steve Karg [mailto:st...@ka...]
> *Sent:* Friday, 21 May 2021 21:41
> *To:* Discussion for developers of the BACnet stack
> *Subject:* Re: [Bacnet-developers] DNET and gateway
>
>
>
> Hello Derek Noffke,
>
>
>
> The command line apps allow for usage of BACNET_IFACE environment variable
> which you can set to the interface returned by ifconfig (on Linux) or the
> IP address (on Windows). If you set (export) BACNET_IFACE to the
> appropriate interface, the initialization code will lookup the broadcast
> address appropriate for the interface.
>
>
>
> As Dave mentioned BBMD is used to share broadcast messages which often are
> not routed from subnet to subnet. The BACnet/IP solution is to unicast the
> broadcast to a BBMD in another subnet where it can broadcast it locally.
> The dlenv.c module is used by most of the example command line apps to read
> some OS environment variables and configure the example app for the site.
> There are likely (at least in later versions) environment variables to
> configure the BBMD entries for the command line applications.
>
>
>
> Best regards,
>
>
> Steve
>
>
>
>
>
> On Fri, May 21, 2021 at 7:42 AM Derek Noffke <de...@pu...>
> wrote:
>
> Making some slowgress.
>
> 1) I had compiled the gateway to use who-is unicast
> //apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS,
> handler_who_is_unicast);
> apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
>
> 2) The broadcast goes to 255.255.255.255
> Seems the bip_init() is only called once??? and expects the ifname “eth0”
> If a who-is arrives on eth1 then the broadcast mask from eth0 is used.
>
> Am I missing anything here?
>
>
>
>
>
>
>
>
>
> Regards,
>
>
>
> Derek Noffke
>
> PurpleSwift
>
> Cell: 082 780 4680
>
> Tel: 021 761 8264
>
>
>
>
>
>
>
> *From:* Derek Noffke [mailto:de...@pu...]
> *Sent:* Wednesday, 19 May 2021 18:28
> *To:* 'Discussion for developers of the BACnet stack'
> *Subject:* Re: [Bacnet-developers] DNET and gateway
>
>
>
> I am still trying to solve this issue.
>
> I have installed tshark on my linux device so at least I can see the
> bacnet traffic.
>
>
>
> The setup is as follows:
>
> PC with BACnet client software at IP 155.247.120.90
>
> PC is registered as a foreign device on BBMD at IP 10.124.44.63
>
> My device 2700000 is at IP 10.124.44.94
>
> Just to make things a little more difficult the subnet mask is 22 bits L
>
>
>
> [image: 3352 2021-05-19 12:10:51,278265 10.124.44.63 10.124.47.255
> BACnet-APDU 60 47814 Unconfirmed-REQ who-Is 3353 2021-05-19 12:10:51,278544
> 10.124.44.57 10.124.47.255 BACnet-APDU 68 47814 Unconfirmed-REQ i-Am
> device,1045010 3354 2021-05-19 12:10:51,278605 10.124.44.94 155.247.120.90
> BACnet-APDU 63 51948 Unconfirmed-REQ i-Am device,2700000]
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> So the PC sends a broadcast who-is to the BBMD on port 51948
>
> The BBMD resends the who-is shown on line 3352 on port 47814
>
> Some other bacnet device responds with a broadcast i-am on line 3353 on
> port 47814
>
> My device sends a unicast i-am direct back to the PC on port 51948
>
>
>
> Given that the PC only sees the “other” device I assume the unicast
> message is blocked.
>
>
>
> Any help please.
>
>
>
>
>
> Regards,
>
>
>
> Derek Noffke
>
> PurpleSwift
>
> Cell: 082 780 4680
>
> Tel: 021 761 8264
>
>
>
>
>
>
>
> *From:* Dave Lindauer via BACnet-developers [mailto:
> bac...@li...]
> *Sent:* Thursday, 13 May 2021 18:49
> *To:* Derek Noffke; 'Discussion for developers of the BACnet stack'
> *Cc:* Dave Lindauer
> *Subject:* Re: [Bacnet-developers] DNET and gateway
>
>
>
> Hi Derek,
>
>
>
> Take me with a grain of salt… I know quite a bit about bacnet over IP
> but haven’t spent extensive time setting up systems…
>
>
>
> I suppose you set it up that way presuming the BBMD is on your current
> subnet. Then you wouldn’t need to explicitly handle BBMDs I suppose.
>
>
>
> But you are using multiple device objects routed at the same IP? With
> the root device being DNET 0 and the rest of them being DNET 2809? I
> don’t think you should program the DNET of 2809 into the BBMD. I think
> what should be happening is you get the WHOIS broadcasts at the default
> DNET (0) and the bacnet stack does some work to make sure all the device
> objects get it, since it is broadcast it can do that lol. But the
> broadcasts will come in PTP as forwarded broadcast messages.
>
>
>
> And of course responses should have the appropriate SNET set.
>
>
>
> Not sure at this point if we had to make a modification to make it do
> either of those things though. I know I modified that code, just cannot
> remember why…
>
>
>
> *From:* Derek Noffke <de...@pu...>
> *Sent:* Thursday, May 13, 2021 10:40 AM
> *To:* 'Discussion for developers of the BACnet stack' <
> bac...@li...>
> *Cc:* Dave Lindauer <da...@po...>
> *Subject:* RE: [Bacnet-developers] DNET and gateway
>
>
>
> Thanks Dave,
>
>
>
> I know very little about BBMD workings so any info is most welcome. J
>
>
>
> Client on site manually adds my root device 2700000 to his BBMD.
>
> Discover works 20% of the time.
>
> Client says problem is 2700000 is on DNET 0 while all other are on DNET
> 2809
>
>
>
> Regards,
>
>
>
> Derek Noffke
>
> PurpleSwift
>
> Cell: 082 780 4680
>
> Tel: 021 761 8264
>
>
>
>
>
>
>
> *From:* Dave Lindauer via BACnet-developers [
> mailto:bac...@li...
> <bac...@li...>]
> *Sent:* Thursday, 13 May 2021 16:15
> *To:* Discussion for developers of the BACnet stack
> *Cc:* Dave Lindauer
> *Subject:* Re: [Bacnet-developers] DNET and gateway
>
>
>
> Generally the BBMD you want to talk to is on some other subnet. To be
> compatible with a BBMD you have to register with it at intervals (the
> registration expires) so that you can get broadcasts from the other
> subnet. Also in addition to broadcasting on your own network, you have
> to send your broadcasts directly to the BBMD in point to point fashion so
> that they can be received on the other network. For example the IAM
> messages.
>
>
>
> There is specific protocol related to this, but the bacnet stack has
> helpers and so forth. There might be an example as well. I found it
> pretty easy not only to interact with BBMDs but to create one for testing!
>
>
>
> David
>
> *From:* Derek Noffke <de...@pu...>
> *Sent:* Thursday, May 13, 2021 8:59 AM
> *To:* bac...@li...
> *Subject:* [Bacnet-developers] DNET and gateway
>
>
>
> Greetings,
>
>
>
> I have an app based on the gateway demo code. BACnet Stack Version 0.8.4
>
> I have been informed that my gateway is not compatible with a BBMD.
>
>
>
> The startup I-AM sequence is attached.
>
> I see that the I-AM for my “root” device 2700000 does NOT contain the DNET.
>
> Is this possibly the problem?
>
>
>
> Regards,
>
>
>
> Derek Noffke
>
> PurpleSwift
>
> Cell: 082 780 4680
>
> Tel: 021 761 8264
>
>
>
>
>
>
>
> _______________________________________________
> BACnet-developers mailing list
> BAC...@li...
> https://lists.sourceforge.net/lists/listinfo/bacnet-developers
>
>
|