User Tools

Site Tools


doc:uci:babeld

babeld is the reference implementation of the Babel routing protocol

Configuration for babeld

This documentation applies to babeld between version 1.5.1 and 1.8. Older versions used a slightly different syntax and different option names.

Introduction

The UCI configuration aims at being as transparent as possible: option names are the same as the native babeld config (using "_" instead of "-"). Refer to the commented default configuration file and to the man page for babeld for more details.

You can configure babeld in three different places:

  • /etc/babeld.conf, the native babeld configuration
  • native configuration fragments in /tmp/babeld.d/ (starting from babeld 1.6.0-3). The fragments must end with a .conf extension.
  • /etc/config/babeld, the UCI-style configuration. This is the preferred way of configuring babeld.

If the same option is defined in several places, the last one takes precedence. So, for instance, you can mix native and UCI-style configuration, but the UCI-generated configuration will take precedence over the native configuration for conflicting options.

General configuration

General configuration for babeld is done inside a config general section, for instance:

/etc/config/babeld:

config general
	option 'random_id'    'true'
	option 'local_port'   '33123'
	list   'import_table' '42'
	list   'import_table' '100'

You can use any global option accepted by babeld, see "Global options" in the man page.

:!: Remember, you must replace "-" by "_" in option names on OpenWrt.

Interface configuration

To start using babeld on a network interface, a config interface section must be used. In its simplest form, this section just needs the name of the interface:

/etc/config/babeld:

config interface
	option 'ifname' 'br-lan'

You can also specify options:

/etc/config/babeld:

config interface
	option 'ifname'         'tun-fastd'
	option 'type'           'tunnel'
	option 'hello_interval' '2'
	option 'rxcost'         '60'

You can use any interface option accepted by babeld, see "Interface configuration" in the man page.

:!: Remember, you must replace "-" by "_" in option names on OpenWrt.

You can also use logical interface name, see the examples below.

Default interface configuration

You can also configure options for all interfaces. To do this, simply omit the ifname option:

/etc/config/babeld:

# Disable split horizon on all interfaces
config interface
	option 'split_horizon' 'false'

Note that interface-specific configuration always overrides default interface configuration.

Filtering rules and redistribution

TODO

Troubleshooting

When starting babeld, /etc/config/babeld is used to generate a configuration in /var/etc/babeld.conf. If babeld does not start, look for something unusual in this file. Also look at the logs (using logread).

Note that, by default, no interface is configured, so babeld will refuse to start.

Examples

It is recommended to use logical interface names, so that you can also define firewall zones with these interfaces, and use all UCI goodness (automatic interface reloading, ifstatus, persistent interface name, etc). But you can also use physical interface names if you want to.

:!: Using logical interface names does not seem to work reliably in all cases, see this ticket.

Wireless setup with logical interface names

Here is an example with two radios, one 2.4 GHz (wlan_24) and one 5 GHz (wlan_5). Note that we don't bridge anything, as Babel will route between the interfaces.

/etc/config/network:

config interface wlan_24
        option proto    static
        option ipaddr   10.0.0.42
        option netmask  255.255.255.255

config interface wlan_5
        option proto    static
        option ipaddr   10.0.0.42
        option netmask  255.255.255.255

/etc/config/wireless:

config wifi-iface
	option device   radio0
	option network  wlan_24
	option mode     adhoc
	option ssid     mymesh
	option encryption none

config wifi-iface
	option device   radio1
	option network  wlan_5
	option mode     adhoc
	option ssid     mymesh
	option encryption none

/etc/config/babeld:

# Default options
config interface
    option hello_interval 1
    option update_interval 16

config interface
    option ifname wlan_24

config interface
    option ifname wlan_5

Wireless setup with physical interface names

If you don't want to bother, or don't use the firewall, you can just use physical interface names instead:

# Default options
config interface
    option hello_interval 1
    option update_interval 16

config interface
    option ifname wlan0

config interface
    option ifname wlan1

UCI-managed tunnel

This example uses a GRE tunnel, defined in UCI, and enables the RTT-based metric on it.

/etc/config/network:

config interface mytunnel 
    option proto    gre
    # Firewall zone
    option zone     myzone
    option peeraddr 198.51.100.42
                                                            
config interface mytunnel_static                               
    option proto    static                              
    option ifname   @mytunnel                              
    option ipaddr   10.0.0.42                       
    option netmask  255.255.255.254                     
    # Fixes IPv6 multicast (long-standing bug in kernel)
    option ip6addr  'fe80::42:42:42/64'

/etc/config/babeld:

# Default options
config interface
    option wired true

config interface
    option ifname mytunnel
    option max_rtt_penalty 100

Manually managed tunnel

In some cases, tunnels are managed outside of UCI. It's still a good idea to declare them in /etc/config/network. The simplest form is:

config interface mytunnel
    option ifname   tun-openvpn
    option proto    none

You may actually want to assign addresses on your tunnel interfaces, you can do that in /etc/config/network:

config interface mytunnel
    option ifname   tun-openvpn       
    option proto    static
    option ipaddr   10.0.0.42
    option netmask  255.255.255.255
    # OpenVPN does not assign a link-local address on tunnels
    option ip6addr  'fe80::42:42:42/64'
    # Firewall zone
    option zone     dn42                              

In both cases, you can then use the logical interface name in /etc/config/babeld:

config interface
    option ifname mytunnel
    option max_rtt_penalty 100

History: backward compatibility

This section is kept for historical interest, since babeld 1.5.1 was released a long time ago (August 2014).

Global options

Compared to pre-1.5.1 versions of babeld, the name of options in the "general" section have changed. We now use the same names as babeld (which have been introduced only recently, in babeld 1.4.2).

Most old options are accepted and translated, with a few exceptions:

  • hello_interval and wired_hello_interval are ignored. You must set hello_interval on interfaces instead.
  • conf_file is ignored
  • diversity does no longer accept the old "3,42" syntax. You must use diversity 3 and diversity_factor 42 instead

So, except if you were using diversity, your old configuration file should still work.

Interfaces

Pre-1.5.1 versions of babeld used a slightly different syntax for specifying interface options:

config interface wlan
    option foo bar

instead of the new syntax:

config interface
    option ifname wlan
    option foo bar

However, the old syntax is still accepted, so you can keep using your old configuration files.

doc/uci/babeld.txt · Last modified: 2017/01/15 16:35 by tmomas