UDP broadcast relay

Certain applications use UDP broadcasts to discover peers or services within a local subnet. Since IP routers do not forward broadcast packets between subnets, applications in different subnets cannot use broadcast discovery.

The UDP broadcast relay service bridges this gap. When an application sends a UDP broadcast packet to discover peers or services, the relay listens for that message on any of its configured interfaces and rebroadcasts it on the others, reaching the subnets they connect to.

The unit of configuration is a UDP relay instance. Each instance is defined by the following settings:

  • a numeric ID in the range 1–99 that identifies the instance

  • a single UDP port number that the instance relays

  • two or more interfaces across which the instance operates

Every interface in the instance must be assigned an IPv4 address.

Note

Multiple routers may run UDP broadcast relay on a shared subnet, provided that any routers relaying the same UDP port use the same instance ID. Multiple routers relaying the same UDP port with different instance IDs will produce a relay loop and a packet storm.

Configuration

set service broadcast-relay id <1-99> description <description>

Configure a description for the specified relay instance.

Example:

set service broadcast-relay id 1 description 'SONOS discovery'
set service broadcast-relay id <1-99> interface <interface>

Add an interface to the specified relay instance.

Repeat the command to add additional interfaces.

Note

At least two interfaces must be configured per instance, and each interface must be assigned an IPv4 address.

Example:

set service broadcast-relay id 1 interface eth1
set service broadcast-relay id 1 interface eth2
set service broadcast-relay id <1-99> address <ipv4-address>

Configure the source IPv4 address used in forwarded packets.

If unset, the original sender’s source IP address is preserved.

Example:

set service broadcast-relay id 1 address 192.0.2.1
set service broadcast-relay id <1-99> port <1-65535>

Configure the UDP destination port for the specified relay instance.

The relay listens for broadcasts on this port on any of the instance’s interfaces and forwards them to the same port on the others.

Note

This setting is mandatory for each relay instance. Otherwise, the commit is rejected.

Example:

set service broadcast-relay id 1 port 1900
set service broadcast-relay id <1-99> disable

Administratively disable the specified relay instance while preserving its configuration.

Example:

set service broadcast-relay id 1 disable
set service broadcast-relay disable

Administratively disable the UDP broadcast relay service on the router without removing its configured instances.

Example:

set service broadcast-relay disable

Example

The following example shows how to configure the UDP broadcast relay to forward broadcasts on UDP port 1900 between eth1, eth2, and eth3. A broadcast received on any of these interfaces is forwarded to the other two. Each interface must already have an IPv4 address configured.

set service broadcast-relay id 1 description 'SONOS discovery'
set service broadcast-relay id 1 port '1900'
set service broadcast-relay id 1 interface 'eth1'
set service broadcast-relay id 1 interface 'eth2'
set service broadcast-relay id 1 interface 'eth3'