BACnet/IP: frame format, UDP port 47808, BBMDs and routing
Part of the BACnet guide
BACnet/IP is BACnet carried in UDP datagrams on an IP network, defined in Annex J of ASHRAE 135. Each message is a four-byte BACnet Virtual Link Control (BVLC) header, a network layer header and the application data, sent to UDP port 47808 (0xBAC0) by default. A BACnet/IP device is addressed by its IP address and port, and it uses IP broadcasts for discovery, which is why devices on other subnets stay invisible until a BBMD is set up.
This page belongs to the BACnet guide. The objects being read are described in BACnet objects and properties; the serial data link is in BACnet MS/TP.
BACnet/IP frame format
A BACnet/IP datagram has three parts inside the UDP payload.
| Part | Size | Contents |
|---|---|---|
| BVLC | 4 bytes or more | Type 0x81, a function code, and the total length |
| NPDU | 2 bytes or more | Version 0x01, a control byte, optional routing addresses |
| APDU | Variable | The service request or response |
The BVLC header is fixed:
| Field | Size | Value |
|---|---|---|
| Type | 1 byte | 0x81, BACnet/IP |
| Function | 1 byte | What kind of BVLC message this is |
| Length | 2 bytes | Length of the whole message including these four bytes, high byte first |
The function codes that appear in ordinary traffic:
| Function | Name | Used for |
|---|---|---|
0x0A | Original-Unicast-NPDU | A message to one device |
0x0B | Original-Broadcast-NPDU | A broadcast on the local subnet |
0x04 | Forwarded-NPDU | A broadcast relayed by a BBMD, with the original sender’s address added |
0x05 | Register-Foreign-Device | A device asking a BBMD to include it in broadcasts |
0x09 | Distribute-Broadcast-To-Network | A foreign device asking a BBMD to broadcast for it |
0x00 | BVLC-Result | The answer to a registration or table request |
The largest APDU on BACnet/IP is 1476 bytes. A response that does not fit, such as the object list of a large controller, is either segmented across several messages, if both devices support segmentation, or refused with an Abort.
A decoded Who-Is and I-Am
Discovery starts with a Who-Is sent to the subnet’s broadcast address.
Who-Is: 81 0B 00 0C 01 20 FF FF 00 FF 10 08
81 BVLC type: BACnet/IP
0B function: Original-Broadcast-NPDU
00 0C length: 12 bytes
01 NPDU version 1
20 control: destination network present
FF FF destination network 65535, all networks
00 destination address length 0, broadcast
FF hop count 255
10 APDU type: unconfirmed request
08 service: Who-IsDevice 1001 answers with an I-Am, also broadcast:
I-Am: 81 0B 00 18 01 20 FF FF 00 FF 10 00 C4 02 00 03 E9 22 05 C4 91 03 21 05
81 0B 00 18 BVLC: broadcast, 24 bytes
01 20 FF FF 00 FF NPDU: global broadcast, hop count 255
10 00 unconfirmed request, service I-Am
C4 02 00 03 E9 object identifier: device, instance 1001
22 05 C4 maximum APDU length accepted: 1476
91 03 segmentation supported: none
21 05 vendor identifier: 5The client now knows that device instance 1001 lives at the IP address and port the datagram came from.
A decoded ReadProperty
The client reads Present_Value (property 85, 0x55) of analog input 1.
Request: 81 0A 00 11 01 04 00 05 01 0C 0C 00 00 00 01 19 55
81 0A 00 11 BVLC: unicast, 17 bytes
01 04 NPDU: version 1, control: reply expected
00 APDU type: confirmed request, not segmented
05 maximum APDU the client accepts: 1476 bytes
01 invoke ID 1
0C service: ReadProperty
0C 00 00 00 01 object identifier: analog-input, instance 1
19 55 property identifier: 85, Present_ValueResponse: 81 0A 00 17 01 00 30 01 0C 0C 00 00 00 01 19 55 3E 44 42 90 00 00 3F
81 0A 00 17 BVLC: unicast, 23 bytes
01 00 NPDU: version 1, no routing, no reply expected
30 APDU type: complex acknowledgement
01 invoke ID 1, matching the request
0C service: ReadProperty
0C 00 00 00 01 object identifier: analog-input, instance 1
19 55 property identifier: 85
3E opening tag: the value follows
44 42 90 00 00 REAL, 4 bytes: 0x42900000 = 72.0
3F closing tagThe invoke ID pairs each response with its request, so a client can have several requests outstanding to one device. If analog input 1 did not exist, the device would return an Error PDU (first byte 0x50) with error class object and error code unknown-object.
UDP port 47808
The default port is 47808, chosen because it is 0xBAC0 in hexadecimal. Devices normally send from the same port they listen on, so a firewall between a client and a controller has to pass UDP 47808 in both directions. The port is configurable, and sites that run two separate BACnet/IP networks on the same wire commonly put the second on 47809 (0xBAC1). A client configured for the wrong port sees nothing at all: no error, no reply.
BACnet/IP is UDP, so there is no connection to open and none to drop. A device that is powered off and a device that is unreachable look the same: the request times out. The APDU_Timeout and Number_Of_APDU_Retries properties of the Device object set how long a client waits and how many times it repeats a confirmed request.
Why discovery stops at the router: BBMDs
Who-Is and I-Am are IP broadcasts, and IP routers do not forward broadcasts between subnets. A workstation on 10.1.1.0/24 therefore never hears the controllers on 10.1.2.0/24, even though it can ping them and could read them by unicast if it knew their addresses.
The BACnet answer is the BACnet/IP Broadcast Management Device (BBMD). One device on each subnet is given the BBMD role and a Broadcast Distribution Table (BDT) listing the BBMDs on the other subnets. When a BBMD hears a local broadcast it sends a copy, as a Forwarded-NPDU, to every BBMD in its table, and each of those rebroadcasts it on its own subnet.
The rules that keep this working:
- One BBMD per subnet. Two on the same subnet each forward the other’s rebroadcast, and the network fills with duplicates.
- Every BBMD carries the same table. A BBMD missing from one table produces discovery that works in one direction only.
- A subnet with no BACnet broadcasts to share does not need one.
A device on a subnet without a BBMD can register with a remote one as a foreign device. It sends Register-Foreign-Device with a time-to-live in seconds, the BBMD adds it to its Foreign Device Table and forwards broadcasts to it, and the device has to register again before the time runs out. A laptop or a monitoring gateway added to an existing site often joins this way.
Routed networks and device addresses
A BACnet router connects networks with different numbers, most often an IP network and one or more MS/TP trunks. A message for a device behind a router is sent to the router’s IP address, and the NPDU carries the final destination: the network number (DNET) and the device’s address on that network (DADR).
NPDU of a request to MAC 12 on network 11:
01 version 1
24 control: destination present, reply expected
00 0B DNET: network 11
01 DLEN: address is 1 byte long
0C DADR: MAC address 12
FF hop count 255An MS/TP address is one byte. A BACnet/IP address used as a DADR is six bytes: the four bytes of the IP address followed by the two bytes of the port. A client normally learns DNET and DADR from the I-Am, which arrives with the source network and address filled in by the router. A client that addresses a controller statically needs both values entered by hand.
Common BACnet/IP mistakes
- Treating the IP address as the identity. The device instance is the identity; the IP address is only where it was last seen. Addresses assigned by DHCP can move, and the binding has to be refreshed with Who-Is.
- Duplicate device instances after cloning a controller configuration. Both devices answer, and the client flips between them.
- Expecting broadcasts to cross a VPN or NAT. They do not, and NAT also breaks the address inside a Forwarded-NPDU unless the BBMD is configured for it.
- Polling every property with single ReadProperty requests. ReadPropertyMultiple reads many in one exchange if the device supports it.
- Assuming the network is private. BACnet/IP has no authentication and no encryption; any host that can reach UDP 47808 can read, and can write wherever the device allows writes. Keep it on a segmented network. The standard’s secure data link, BACnet/SC (Annex AB), carries BACnet over TLS and is a separate option that both ends must support.
Serial trunks avoid the broadcast problem and have their own. If the choice between the two is open, the MS/TP page describes what the serial side costs in speed and wiring.
Reading BACnet/IP with ControlCom
The ControlCom Edge Server, the on-site component of ControlCom Connect, has a BACnet IP client. Its Connection tab takes the Device Address (the controller’s IP address), the Port (47808 by default) and the Device Instance. Routed network and Routed MAC (hex) are needed only when the controller sits behind a BACnet router. Poll Interval (ms) sets how often each object is read, 1000 by default, and Timeout (seconds) sets how long a request waits before it counts as failed, 15 by default.
The BACnet tool in the Edge Server’s local web interface sends Who-Is as a broadcast, or as a unicast to a host:port target, and lists the devices that answer. Its Poller tab can read a device with either ReadPropertyMultiple or ReadProperty. The BACnet client documentation and the BACnet tool documentation list the fields. Hospital plant rooms are a common case; the healthcare page covers that setup.
The Edge Server polls BACnet/IP controllers on the building network and publishes each object as a variable in ControlCom Connect, so plant data from several buildings sits in one account.