# Babel - Loop-free Distance-Vector Routing Protocol

> Configure the Babel routing protocol in VyOS for mesh networks - interfaces, metrics, redistribution and integration with other protocols

Source: https://opennix.org/en/docs/vyos/routing/vyos-babel/


## Babel - Loop-free Distance-Vector Routing Protocol

## Overview

Babel is a modern routing protocol designed specifically for wired and wireless mesh networks. It is defined in RFC 8966 and is a loop-free distance-vector protocol with advanced capabilities for dynamic routing in complex topologies.

### Key features

- **Loop-free distance-vector**: Guaranteed absence of routing loops thanks to the feasibility condition mechanism
- **Dual-stack**: Native support for IPv4 and IPv6 in a single protocol
- **Adaptive metrics**: Automatic link-quality computation based on RTT and packet loss
- **Diversity routing**: Route selection that minimizes interference on wireless links
- **Configuration simplicity**: Minimal configuration required to operate in mesh networks
- **Fast convergence**: Efficient detection of and reaction to topology changes
- **Scalability**: Suitable for small to medium-sized networks

### Use cases

Babel is best suited for the following scenarios:

1. **Wireless mesh networks**: WiFi mesh, point-to-multipoint, ad-hoc networks
2. **Hybrid networks**: A combination of wired and wireless links
3. **Overlay networks**: VPN mesh, SD-WAN, tunnel topologies
4. **Home networks**: Backup links, multi-homing, fault tolerance
5. **Cloud infrastructures**: Dynamic routing between virtual machines

## Architecture and operating principles

### Distance-vector with guaranteed loop freedom

Babel uses an enhanced distance-vector algorithm that:

1. **Distributes routes**: Each node advertises the networks it knows about and the metric to reach them
2. **Computes the metric**: The metric increases by the link cost when relayed through a neighbor
3. **Checks feasibility**: Accepts a route only if it cannot create a loop
4. **Uses sequence numbers**: Tracks route versions to detect changes
5. **Runs loop avoidance**: Special mechanisms prevent loops during topology changes

### Metrics and link quality

Babel supports different metric types depending on the interface type:

**Wired links**:
- Base metric: hop-count
- Minimum cost: 96 units per hop
- Additional cost: based on RTT (optional)

**Wireless links**:
- ETX metric (Expected Transmission Count)
- Accounts for packet loss and retransmissions
- Automatically computed from hello-packet statistics

**Metric formula with RTT**:
```
metric = base_metric + rtt_penalty
where rtt_penalty = (RTT / rtt_min) * rtt_max
```

### Protocol messages

Babel uses the following message types:

1. **Hello**: Neighbor discovery and connectivity checks (periodic)
2. **IHU (I Heard You)**: Acknowledgment of a received hello and link-quality information
3. **Update**: Advertisement of routes and their metrics
4. **Route Request**: Request for a route to a specific network
5. **Seqno Request**: Request to update the sequence number for a route

### Timers

- **Hello interval**: Interval between hello messages (default: 4 seconds)
- **Update interval**: Interval between route updates (default: 16 seconds)
- **Hold time**: Time a route is retained without updates (typically 3.5 x hello interval)

## Basic configuration

### Enabling Babel on interfaces

Minimal configuration to start Babel:

```bash
configure

# Enable Babel on interface eth1
set protocols babel interface eth1

# Save the configuration
commit
save
```

When the first interface is added, the Babel process (babeld) starts automatically.

### Specifying the interface type

The interface type affects metric selection and protocol optimization:

```bash
configure

# Wired interface (hop-count metric)
set protocols babel interface eth1 type wired

# Wireless interface (ETX metric)
set protocols babel interface wlan0 type wireless

# Automatic detection (default)
set protocols babel interface eth2 type auto

commit
save
```

**Recommendations for choosing the type**:
- `wired`: Ethernet, GRE/IPIP tunnels, wired connections
- `wireless`: WiFi mesh, point-to-multipoint, mobile links
- `auto`: Babel detects the type automatically (uses hop-count)

### Basic interface parameters

```bash
configure

set protocols babel interface eth1 type wired

# Hello interval (seconds)
set protocols babel interface eth1 hello-interval 4

# Update interval (seconds)
set protocols babel interface eth1 update-interval 16

# Split-horizon (prevents advertising routes back to the sender)
set protocols babel interface eth1 split-horizon enable

commit
save
```

## Advanced interface settings

### Configuring link cost

You can explicitly set the packet reception cost on an interface:

```bash
configure

# Set a fixed reception cost (rxcost)
# Value in Babel units (256 = 1 hop)
set protocols babel interface eth1 rxcost 512

# For wireless interfaces, use automatic calculation
# delete protocols babel interface wlan0 rxcost

commit
save
```

**Use cases**:
- Force one link to be preferred over another
- Create backup links with a high cost
- Manually adjust the automatic metric

### RTT (Round-Trip Time) parameters

Babel can measure RTT and use it to improve the metric:

```bash
configure

# Enable RTT measurement
set protocols babel interface eth1 enable-timestamps

# Minimum RTT for normalization (ms)
set protocols babel interface eth1 rtt-min 10

# Maximum RTT influence on the metric
set protocols babel interface eth1 rtt-max 120

# RTT smoothing period (seconds)
set protocols babel interface eth1 rtt-decay 42

commit
save
```

**How it works**:
- Babel adds timestamps to hello/IHU messages
- The RTT between neighbors is computed
- RTT affects the metric: `penalty = (current_rtt / rtt_min) * rtt_max`
- Useful for detecting congested or unstable links

### Channel diversity

For wireless networks you can use diversity routing - selecting routes with minimal interference:

```bash
configure

# Globally enable diversity routing
set protocols babel diversity

# Diversity factor (1-256)
# The higher the value, the stronger the influence of diversity
set protocols babel diversity-factor 128

# Specify the channel on the interface
set protocols babel interface wlan0 channel 36
set protocols babel interface wlan1 channel 149

commit
save
```

**Operating principle**:
- Babel takes channel numbers into account when selecting a route
- It prefers routes that use different channels
- It minimizes interference in WiFi mesh networks
- diversity-factor determines how important diversity is relative to the metric

## Route redistribution

### Redistributing connected networks

Advertising directly connected networks:

```bash
configure

# Redistribute IPv4 connected networks
set protocols babel redistribute ipv4 connected

# Redistribute IPv6 connected networks
set protocols babel redistribute ipv6 connected

commit
save
```

### Redistributing static routes

```bash
configure

# IPv4 static routes
set protocols babel redistribute ipv4 static

# IPv6 static routes
set protocols babel redistribute ipv6 static

commit
save
```

### Redistributing from other protocols

Babel can redistribute routes from other routing protocols:

```bash
configure

# Redistribute from OSPF
set protocols babel redistribute ipv4 ospf

# Redistribute from BGP
set protocols babel redistribute ipv4 bgp

# Redistribute from RIP
set protocols babel redistribute ipv4 rip

# Redistribute from ISIS
set protocols babel redistribute ipv4 isis

# Redistribute from EIGRP
set protocols babel redistribute ipv4 eigrp

# Redistribute from the kernel routing table
set protocols babel redistribute ipv4 kernel

commit
save
```

### Filtering redistributed routes

Using a prefix-list to control redistribution:

```bash
configure

# Create a prefix-list
set policy prefix-list BABEL-EXPORT rule 10 action permit
set policy prefix-list BABEL-EXPORT rule 10 prefix 10.100.0.0/16

set policy prefix-list BABEL-EXPORT rule 20 action permit
set policy prefix-list BABEL-EXPORT rule 20 prefix 172.16.0.0/12

set policy prefix-list BABEL-EXPORT rule 100 action deny
set policy prefix-list BABEL-EXPORT rule 100 prefix 0.0.0.0/0 le 32

# Apply it to redistribution
set protocols babel redistribute ipv4 connected
set protocols babel redistribute ipv4 connected prefix-list BABEL-EXPORT

commit
save
```

## Route filtering

### Inbound filtering (import)

Controlling the routes accepted from neighbors:

```bash
configure

# Create a prefix-list for IPv4
set policy prefix-list BABEL-IMPORT-V4 rule 10 action permit
set policy prefix-list BABEL-IMPORT-V4 rule 10 prefix 10.0.0.0/8

set policy prefix-list BABEL-IMPORT-V4 rule 20 action permit
set policy prefix-list BABEL-IMPORT-V4 rule 20 prefix 172.16.0.0/12

set policy prefix-list BABEL-IMPORT-V4 rule 100 action deny
set policy prefix-list BABEL-IMPORT-V4 rule 100 prefix 0.0.0.0/0 le 32

# Apply it to the interface
set protocols babel interface eth1 import-filter prefix-list BABEL-IMPORT-V4

commit
save
```

### Outbound filtering (export)

Controlling the routes advertised on an interface:

```bash
configure

# Create a prefix-list for IPv6
set policy prefix-list6 BABEL-EXPORT-V6 rule 10 action permit
set policy prefix-list6 BABEL-EXPORT-V6 rule 10 prefix fd00::/8

set policy prefix-list6 BABEL-EXPORT-V6 rule 100 action deny
set policy prefix-list6 BABEL-EXPORT-V6 rule 100 prefix ::/0 le 128

# Apply it to the interface
set protocols babel interface eth1 export-filter prefix-list BABEL-EXPORT-V6

commit
save
```

### Filtering with an access-list

An alternative filtering method using an access-list:

```bash
configure

# Create an access-list
set policy access-list 100 rule 10 action permit
set policy access-list 100 rule 10 source address 10.100.0.0
set policy access-list 100 rule 10 source inverse-mask 0.0.255.255

set policy access-list 100 rule 100 action deny
set policy access-list 100 rule 100 source any

# Apply it to the interface
set protocols babel interface eth1 import-filter access-list 100

commit
save
```

## Dual-stack configuration (IPv4 and IPv6)

### Running IPv4 and IPv6 simultaneously

Babel natively supports dual-stack without additional configuration:

```bash
configure

# Interface with IPv4 and IPv6 addresses
set interfaces ethernet eth1 address 10.100.1.1/24
set interfaces ethernet eth1 address fd00:100:1::1/64

# Enable Babel
set protocols babel interface eth1 type wired

# Redistribute both stacks
set protocols babel redistribute ipv4 connected
set protocols babel redistribute ipv6 connected

commit
save
```

### Separate configuration for IPv4 and IPv6

```bash
configure

# IPv4 routes only over a specific interface
set protocols babel interface eth1 ipv4 enable
set protocols babel interface eth1 ipv6 disable

# IPv6 routes over another interface
set protocols babel interface eth2 ipv4 disable
set protocols babel interface eth2 ipv6 enable

commit
save
```

### Filtering by protocol version

```bash
configure

# Filter for IPv4
set policy prefix-list BABEL-V4 rule 10 action permit
set policy prefix-list BABEL-V4 rule 10 prefix 10.0.0.0/8

# Filter for IPv6
set policy prefix-list6 BABEL-V6 rule 10 action permit
set policy prefix-list6 BABEL-V6 rule 10 prefix fd00::/8

# Apply
set protocols babel redistribute ipv4 connected prefix-list BABEL-V4
set protocols babel redistribute ipv6 connected prefix-list BABEL-V6

commit
save
```

## Configuration examples for Yandex Cloud

### Example 1: Mesh network between virtual machines

Scenario: 4 virtual machines in Yandex Cloud arranged in a mesh topology for fault tolerance.

**Topology**:
```
VM1 (10.100.1.1) -------- VM2 (10.100.2.1)
     |                         |
     |                         |
VM3 (10.100.3.1) -------- VM4 (10.100.4.1)
```

**VM1 configuration** (10.100.1.1):

```bash
configure

# Interfaces
set interfaces ethernet eth1 address 10.100.1.1/24
set interfaces ethernet eth1 description 'Link to VM2'

set interfaces ethernet eth2 address 10.100.13.1/24
set interfaces ethernet eth2 description 'Link to VM3'

# Babel on both interfaces
set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired

# Loopback for identification
set interfaces loopback lo address 192.168.1.1/32

# Redistribute the loopback
set protocols babel redistribute ipv4 connected

commit
save
```

**VM2 configuration** (10.100.2.1):

```bash
configure

set interfaces ethernet eth1 address 10.100.1.2/24
set interfaces ethernet eth1 description 'Link to VM1'

set interfaces ethernet eth2 address 10.100.24.1/24
set interfaces ethernet eth2 description 'Link to VM4'

set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired

set interfaces loopback lo address 192.168.1.2/32

set protocols babel redistribute ipv4 connected

commit
save
```

**VM3 configuration** (10.100.3.1):

```bash
configure

set interfaces ethernet eth1 address 10.100.13.2/24
set interfaces ethernet eth1 description 'Link to VM1'

set interfaces ethernet eth2 address 10.100.34.1/24
set interfaces ethernet eth2 description 'Link to VM4'

set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired

set interfaces loopback lo address 192.168.1.3/32

set protocols babel redistribute ipv4 connected

commit
save
```

**VM4 configuration** (10.100.4.1):

```bash
configure

set interfaces ethernet eth1 address 10.100.24.2/24
set interfaces ethernet eth1 description 'Link to VM2'

set interfaces ethernet eth2 address 10.100.34.2/24
set interfaces ethernet eth2 description 'Link to VM3'

set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired

set interfaces loopback lo address 192.168.1.4/32

set protocols babel redistribute ipv4 connected

commit
save
```

### Example 2: Hub-and-Spoke with redundancy

Scenario: A central router (Hub) in Yandex Cloud and 3 remote offices (Spokes) with backup links.

**Topology**:
```
        Spoke1 (10.1.0.0/24)
           |  \
           |   \
    Primary \   \ Backup
           |     \
          Hub (10.0.0.1)
           |     /
    Primary /   / Backup
           |   /
           |  /
        Spoke2 (10.2.0.0/24)
```

**Hub configuration**:

```bash
configure

# Primary links to Spoke1 and Spoke2
set interfaces ethernet eth1 address 10.100.11.1/30
set interfaces ethernet eth1 description 'Primary to Spoke1'

set interfaces ethernet eth2 address 10.100.12.1/30
set interfaces ethernet eth2 description 'Primary to Spoke2'

# Backup links
set interfaces ethernet eth3 address 10.100.21.1/30
set interfaces ethernet eth3 description 'Backup to Spoke1'

set interfaces ethernet eth4 address 10.100.22.1/30
set interfaces ethernet eth4 description 'Backup to Spoke2'

# Babel on all interfaces
set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired
set protocols babel interface eth3 type wired
set protocols babel interface eth4 type wired

# Higher cost for the backup links
set protocols babel interface eth3 rxcost 512
set protocols babel interface eth4 rxcost 512

# Hub local networks
set interfaces ethernet eth0 address 10.0.0.1/24

# Redistribute local networks
set protocols babel redistribute ipv4 connected

commit
save
```

**Spoke1 configuration**:

```bash
configure

# Primary link to the Hub
set interfaces ethernet eth1 address 10.100.11.2/30
set protocols babel interface eth1 type wired

# Backup link to the Hub
set interfaces ethernet eth2 address 10.100.21.2/30
set protocols babel interface eth2 type wired
set protocols babel interface eth2 rxcost 512

# Local network
set interfaces ethernet eth0 address 10.1.0.1/24

# Redistribution
set protocols babel redistribute ipv4 connected

commit
save
```

### Example 3: Dual-stack mesh with IPv6

Scenario: A mesh network in Yandex Cloud with full IPv4 and IPv6 support.

**Node configuration**:

```bash
configure

# Interfaces with dual-stack
set interfaces ethernet eth1 address 10.100.1.1/24
set interfaces ethernet eth1 address fd00:100:1::1/64

set interfaces ethernet eth2 address 10.100.2.1/24
set interfaces ethernet eth2 address fd00:100:2::1/64

# Dual-stack loopback
set interfaces loopback lo address 192.168.1.1/32
set interfaces loopback lo address fd00:ffff::1/128

# Babel on the interfaces
set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired

# Redistribute both stacks
set protocols babel redistribute ipv4 connected
set protocols babel redistribute ipv6 connected

# Filter IPv6 ULA only
set policy prefix-list6 BABEL-V6-FILTER rule 10 action permit
set policy prefix-list6 BABEL-V6-FILTER rule 10 prefix fd00::/8

set policy prefix-list6 BABEL-V6-FILTER rule 100 action deny
set policy prefix-list6 BABEL-V6-FILTER rule 100 prefix ::/0 le 128

set protocols babel redistribute ipv6 connected prefix-list BABEL-V6-FILTER

commit
save
```

## Configuration examples for VK Cloud

### Example 1: Overlay mesh network on top of VK Cloud VPC

Scenario: 3 VK Cloud regions joined into a mesh network through WireGuard tunnels with dynamic Babel routing.

**Topology**:
```
Region MSK (wg0: 10.200.1.1/24)
    |                    \
    |                     \
    |                      \
Region SPB              Region KZN
(wg1: 10.200.2.1/24)   (wg2: 10.200.3.1/24)
```

**Region MSK configuration**:

```bash
configure

# WireGuard tunnels (already configured)
# wg0 -> Region SPB (10.200.1.1/24)
# wg1 -> Region KZN (10.200.2.1/24)

# Babel on the WireGuard interfaces
set protocols babel interface wg0 type wired
set protocols babel interface wg0 hello-interval 10
set protocols babel interface wg0 update-interval 40

set protocols babel interface wg1 type wired
set protocols babel interface wg1 hello-interval 10
set protocols babel interface wg1 update-interval 40

# MSK region local networks
set interfaces ethernet eth0 address 172.16.1.0/24

# Redistribute local networks
set protocols babel redistribute ipv4 connected

# Filter - internal networks only
set policy prefix-list VK-INTERNAL rule 10 action permit
set policy prefix-list VK-INTERNAL rule 10 prefix 172.16.0.0/12

set policy prefix-list VK-INTERNAL rule 20 action permit
set policy prefix-list VK-INTERNAL rule 20 prefix 10.200.0.0/16

set policy prefix-list VK-INTERNAL rule 100 action deny
set policy prefix-list VK-INTERNAL rule 100 prefix 0.0.0.0/0 le 32

set protocols babel redistribute ipv4 connected prefix-list VK-INTERNAL

commit
save
```

**Region SPB configuration**:

```bash
configure

# WireGuard tunnels
# wg0 -> Region MSK (10.200.1.2/24)
# wg1 -> Region KZN (10.200.3.1/24)

set protocols babel interface wg0 type wired
set protocols babel interface wg0 hello-interval 10
set protocols babel interface wg0 update-interval 40

set protocols babel interface wg1 type wired
set protocols babel interface wg1 hello-interval 10
set protocols babel interface wg1 update-interval 40

# SPB region local networks
set interfaces ethernet eth0 address 172.16.2.0/24

set protocols babel redistribute ipv4 connected

# Apply the filter
set policy prefix-list VK-INTERNAL rule 10 action permit
set policy prefix-list VK-INTERNAL rule 10 prefix 172.16.0.0/12

set policy prefix-list VK-INTERNAL rule 20 action permit
set policy prefix-list VK-INTERNAL rule 20 prefix 10.200.0.0/16

set policy prefix-list VK-INTERNAL rule 100 action deny
set policy prefix-list VK-INTERNAL rule 100 prefix 0.0.0.0/0 le 32

set protocols babel redistribute ipv4 connected prefix-list VK-INTERNAL

commit
save
```

### Example 2: Babel with RTT optimization for VK Cloud

Scenario: A mesh network that automatically selects the optimal route based on latency.

```bash
configure

# Interfaces to neighbors
set protocols babel interface eth1 type wired
set protocols babel interface eth2 type wired
set protocols babel interface eth3 type wired

# Enable RTT measurements
set protocols babel interface eth1 enable-timestamps
set protocols babel interface eth1 rtt-min 5
set protocols babel interface eth1 rtt-max 100
set protocols babel interface eth1 rtt-decay 42

set protocols babel interface eth2 enable-timestamps
set protocols babel interface eth2 rtt-min 5
set protocols babel interface eth2 rtt-max 100
set protocols babel interface eth2 rtt-decay 42

set protocols babel interface eth3 enable-timestamps
set protocols babel interface eth3 rtt-min 5
set protocols babel interface eth3 rtt-max 100
set protocols babel interface eth3 rtt-decay 42

# Redistribution
set protocols babel redistribute ipv4 connected

commit
save
```

### Example 3: Babel for a multi-tenant overlay

Scenario: Separating the traffic of different customers (tenants) in VK Cloud using VRF and Babel.

```bash
configure

# VRF for Tenant A
set vrf name TENANT-A table 100
set vrf name TENANT-A description 'Customer A'

# VRF for Tenant B
set vrf name TENANT-B table 200
set vrf name TENANT-B description 'Customer B'

# Interfaces for Tenant A
set interfaces ethernet eth1 vrf TENANT-A
set interfaces ethernet eth1 address 10.10.1.1/24

# Interfaces for Tenant B
set interfaces ethernet eth2 vrf TENANT-B
set interfaces ethernet eth2 address 10.20.1.1/24

# Babel for Tenant A
set protocols babel vrf TENANT-A interface eth1 type wired
set protocols babel vrf TENANT-A redistribute ipv4 connected

# Babel for Tenant B
set protocols babel vrf TENANT-B interface eth2 type wired
set protocols babel vrf TENANT-B redistribute ipv4 connected

commit
save
```

Note: VRF support in Babel depends on the VyOS version. On older versions a separate babeld instance per VRF may be required.

## Verification and monitoring commands

### Viewing general Babel information

```bash
# Overall Babel protocol status
show babel summary

# Output:
# Babel instance running
# Interfaces: 3 active
# Routes: 12 total (8 installed)
# Neighbors: 4
```

### Viewing neighbors

```bash
# All Babel neighbors
show babel neighbors

# Output:
# Interface  Address               Reach  RXcost  TXcost
# eth1       10.100.1.2            FFFF   96      96
# eth2       10.100.2.2            FFFF   96      96
# wg0        10.200.1.2            FF7F   256     96
```

Values:
- **Reach**: Reachability bitmap (last 16 hellos), FFFF = all received
- **RXcost**: Cost of reception from the neighbor
- **TXcost**: Cost of transmission to the neighbor (computed by the neighbor)

### Viewing routes

```bash
# All Babel routes
show babel routes

# Output:
# Prefix                via             Interface  Metric  Installed
# 10.0.0.0/24          -               eth0       0       yes
# 10.1.0.0/24          10.100.1.2      eth1       96      yes
# 10.2.0.0/24          10.100.2.2      eth2       192     yes
# 192.168.1.2/32       10.100.1.2      eth1       96      yes
# 192.168.1.3/32       10.100.2.2      eth2       192     yes

# Routes with IPv6
show babel routes ipv6

# Routes installed in the kernel only
show babel routes installed
```

### Viewing interface information

```bash
# Babel interfaces
show babel interfaces

# Output:
# Interface  Type    Hello  Update  Neighbors
# eth1       wired   4      16      2
# eth2       wired   4      16      1
# wg0        wired   10     40      1

# Detailed interface information
show babel interface eth1

# Output:
# Interface: eth1
# Type: wired
# Hello interval: 4
# Update interval: 16
# RXcost: 96
# Split-horizon: enabled
# Neighbors: 2
# Timestamps: enabled
# RTT min: 10 ms
# RTT max: 120 ms
```

### Viewing statistics

```bash
# Protocol statistics
show babel statistics

# Output may include:
# - Number of sent/received messages of each type
# - Route update counters
# - Errors and warnings
```

### Viewing the configuration

```bash
# Babel configuration
show configuration protocols babel

# Output of the current configuration:
# protocols {
#     babel {
#         interface eth1 {
#             type wired
#         }
#         interface eth2 {
#             type wired
#         }
#         redistribute {
#             ipv4 {
#                 connected {
#                 }
#             }
#         }
#     }
# }
```

### Real-time monitoring

```bash
# Monitor Babel logs
monitor protocol babel

# Or via journalctl (in operational mode)
monitor log babel
```

### Viewing the kernel routing table

```bash
# Verify that routes are installed in the kernel
show ip route babel

# Output:
# B>* 10.1.0.0/24 [100/96] via 10.100.1.2, eth1, weight 1, 00:05:23
# B>* 10.2.0.0/24 [100/192] via 10.100.2.2, eth2, weight 1, 00:05:23
# B>* 192.168.1.2/32 [100/96] via 10.100.1.2, eth1, weight 1, 00:05:23

# B = Babel, > = selected route, * = active route
# [AD/Metric] - Administrative Distance / Babel metric
```

## Diagnostics and troubleshooting

### Problem: Neighbors are not established

**Symptoms**:
```bash
show babel neighbors
# Output is empty or incomplete
```

**Checks**:

1. Verify that Babel is enabled on the interface:
```bash
show configuration protocols babel
```

2. Check IP connectivity:
```bash
ping <neighbor-ip>
```

3. Check multicast (Babel uses UDP port 6696 and multicast):
```bash
# IPv4 multicast: 224.0.0.1
# IPv6 multicast: ff02::1:6

# Check the firewall
show firewall

# Allow Babel in the firewall
configure
set firewall name WAN_LOCAL rule 100 action accept
set firewall name WAN_LOCAL rule 100 protocol udp
set firewall name WAN_LOCAL rule 100 destination port 6696
commit
```

4. Check the network namespace (for VRF):
```bash
# If VRF is used, make sure the interfaces are in the correct VRF
show vrf
```

### Problem: Routes are not installed

**Symptoms**:
```bash
show babel routes
# Routes are visible but not installed (Installed = no)
```

**Checks**:

1. Check for conflicts with other protocols:
```bash
show ip route <prefix>

# If there is a route with a lower AD (Administrative Distance):
# - Connected: AD 0
# - Static: AD 1
# - OSPF: AD 110
# - Babel: AD 100 (default in FRR)
```

2. Check the feasibility condition - the route may be rejected due to loop prevention:
```bash
# Check the sequence number and the metric
show babel routes detail
```

3. Check the filters:
```bash
show configuration protocols babel
# Check for import-filters that may be blocking routes
```

### Problem: High route metrics

**Symptoms**:
```bash
show babel routes
# The metric is very high (for example, >1000)
```

**Causes and solutions**:

1. **ETX metric on a wireless interface**:
```bash
# Check the interface type
show babel interface <name>

# If wireless is used but the link is wired:
configure
set protocols babel interface <name> type wired
commit
```

2. **High rxcost**:
```bash
# Check rxcost
show babel interface <name>

# If it was set manually, reset it:
configure
delete protocols babel interface <name> rxcost
commit
```

3. **RTT influence**:
```bash
# Check the RTT parameters
show babel interface <name>

# Reduce the RTT influence:
configure
set protocols babel interface <name> rtt-max 50
commit
```

### Problem: Routing loops

**Symptoms**:
```bash
traceroute <destination>
# The route loops
```

**Actions**:

1. Babel should prevent loops automatically. Check the version:
```bash
show version

# Update VyOS/FRR if the version is old
```

2. Check split-horizon:
```bash
show configuration protocols babel interface <name>

# Enable split-horizon if it is disabled:
configure
set protocols babel interface <name> split-horizon enable
commit
```

3. Temporary workaround - prevent advertising specific routes:
```bash
configure
set protocols babel interface <name> export-filter prefix-list LOOP-FIX
commit
```

### Problem: Slow convergence

**Symptoms**:
- Long failover time to the backup route on failure
- Slow detection of topology changes

**Solutions**:

1. Reduce the hello interval (with caution):
```bash
configure
# Default: 4 seconds
set protocols babel interface eth1 hello-interval 2

# Reduce the update interval proportionally
set protocols babel interface eth1 update-interval 8
commit
```

Warning: Intervals that are too small increase the load and protocol traffic.

2. Enable BFD (Bidirectional Forwarding Detection) if supported:
```bash
# BFD detects link failures faster
configure
set protocols bfd peer <neighbor-ip> interval receive 300
set protocols bfd peer <neighbor-ip> interval transmit 300
set protocols bfd peer <neighbor-ip> multihop
commit
```

### Problem: High CPU/memory usage

**Symptoms**:
```bash
show system resources
# High CPU usage by babeld process
```

**Solutions**:

1. Increase the intervals:
```bash
configure
set protocols babel interface eth1 hello-interval 10
set protocols babel interface eth1 update-interval 40
commit
```

2. Reduce the number of redistributed routes:
```bash
# Use aggregation or filtering
configure
set protocols babel redistribute ipv4 connected prefix-list AGGREGATE-ONLY
commit
```

3. Optimize diversity routing:
```bash
# Disable it if it is not used
configure
delete protocols babel diversity
commit
```

## Debugging

### Enabling debug logs

```bash
# In operational mode
debug babel events
debug babel packets
debug babel route

# View the debug output
show log babel

# Disable debug
no debug babel events
no debug babel packets
no debug babel route
```

### Packet analysis

```bash
# Capture Babel packets on an interface
monitor traffic interface eth1 filter "udp port 6696"

# Or with tcpdump
sudo tcpdump -i eth1 -vvv udp port 6696
```

### Logging to a file

```bash
configure

# Direct Babel logs to a dedicated file
set system syslog file babel facility local7 level debug
set system syslog file babel archive size 10

commit
save
```

Viewing:
```bash
show log file babel
```

## Best practices

### Network design

1. **Topology**:
   - Prefer mesh or partial mesh for fault tolerance
   - For hub-and-spoke, use different rxcost values for primary/backup links
   - Avoid topologies with a single point of failure

2. **Scalability**:
   - Babel is efficient for networks up to 50-100 nodes
   - For larger networks consider BGP with route reflectors
   - Use route aggregation where possible

3. **Security**:
   - Babel has no built-in authentication
   - Use a firewall to accept Babel packets only from trusted neighbors
   - In overlay networks, use tunnel encryption (WireGuard, IPsec)

### Tuning parameters

1. **Intervals**:
   - Stable wired networks: hello 4s, update 16s (default)
   - Unstable wireless networks: hello 2s, update 8s
   - WAN links with high latency: hello 10s, update 40s

2. **Interface types**:
   - Always specify the type explicitly (wired/wireless)
   - Do not use auto in production

3. **RTT optimization**:
   - Enable it only if there are alternative paths with different latency
   - Set rtt-min close to the minimum RTT in the network
   - rtt-max affects the maximum metric change

### Route redistribution

1. **Filtering**:
   - ALWAYS use a prefix-list to control the advertised prefixes
   - Deny the default route (0.0.0.0/0) unless it is explicitly required
   - Filter private ranges at the boundaries

2. **Aggregation**:
   - Advertise aggregated prefixes instead of /32 or /128
   - Use static aggregate routes

3. **Selective redistribution**:
   - Do not redistribute everything at once (kernel, connected, static simultaneously)
   - Select the minimum necessary set of sources

### Monitoring and maintenance

1. **Regular checks**:
```bash
# Check weekly:
show babel summary
show babel neighbors
show babel routes

# Check route metrics for anomalies
```

2. **Logging**:
   - Centralized syslog to correlate events
   - Alerts on neighbor loss
   - Monitor changes in the number of routes

3. **Backup**:
```bash
# Save the configuration regularly
save
show configuration protocols babel > /tmp/babel-backup.conf
```

### Integration with other protocols

1. **Babel + OSPF**:
   - OSPF for the core network, Babel for the edge/mesh
   - Redistribute routes with caution (loop risk)
   - Use route-maps for control

2. **Babel + BGP**:
   - BGP for the WAN, Babel for site-local
   - Do not advertise Babel routes into BGP without aggregation
   - Use BGP communities to tag the source

3. **Babel + Static**:
   - Static routes as a fallback
   - Set a high AD for Babel if static should be preferred

### Upgrade and migration

1. **Adding a new node**:
```bash
# On the new node:
configure
set protocols babel interface <intf> type wired
set protocols babel redistribute ipv4 connected
commit

# Verify that neighbors appear:
show babel neighbors

# Verify that routes are received:
show babel routes
```

2. **Decommissioning a node**:
```bash
# Graceful shutdown - remove redistribution:
configure
delete protocols babel redistribute
commit

# Wait for neighbors to remove the routes (update interval x 3)
# Then disable the interfaces:
delete protocols babel interface <intf>
commit
```

3. **Updating parameters**:
   - Changes take effect immediately
   - Changing the interface type may trigger route switching
   - Changing the hello/update interval affects the convergence speed

## Limitations and characteristics

### Protocol limitations

1. **Scalability**:
   - Optimal for 50-100 nodes
   - Larger networks require a hierarchical architecture

2. **Security**:
   - No built-in authentication
   - No encryption (required at the tunnel level)
   - Vulnerable to DoS without firewall filtering

3. **Transport**:
   - UDP port 6696
   - Uses multicast (may not work in some overlay networks)
   - Requires bidirectional connectivity

### Implementation specifics in VyOS

1. **FRR babeld**:
   - VyOS uses the FRR routing suite
   - Version support depends on the FRR version
   - Some options may differ from standalone babeld

2. **VRF support**:
   - VRF support depends on the VyOS version
   - May require a separate instance per VRF

3. **IPv6**:
   - Full dual-stack support
   - Link-local addresses are used for message exchange
   - IPv6 on the interface is required even for IPv4-only routing in some versions

### Differences from other protocols

**Babel vs OSPF**:
- Babel: Simpler configuration, better for mesh, support for wireless metrics
- OSPF: More mature, better scalability, wide support

**Babel vs BGP**:
- Babel: Automatic neighbor discovery, simpler for small networks
- BGP: Scalability, policy control, the standard for the Internet

**Babel vs RIP**:
- Babel: Fast convergence, loop-free, modern metrics
- RIP: Legacy, slow convergence, 15-hop limit

**Babel vs EIGRP**:
- Babel: Open standard, simpler
- EIGRP: Proprietary (Cisco), more complex metrics, DUAL algorithm

## Reference information

### RFCs and documentation

- **RFC 8966**: The Babel Routing Protocol (the main standard)
- **RFC 8967**: MAC Authentication for Babel
- **draft-ietf-babel-rfc6126bis**: Updates to Babel
- **VyOS Documentation**: https://docs.vyos.io/en/latest/configuration/protocols/babel.html
- **FRR Documentation**: https://docs.frrouting.org/en/latest/babeld.html

### Default parameters

| Parameter | Value | Description |
|----------|----------|----------|
| Hello interval | 4 seconds | Interval between hello messages |
| Update interval | 16 seconds | Interval between update messages |
| Hold time | 14 seconds (3.5 x hello) | Time a neighbor is retained without hellos |
| Wired cost | 96 | Base cost for wired links |
| Wireless cost | 256 | Base cost for wireless links |
| UDP port | 6696 | Port for the Babel protocol |
| IPv4 multicast | 224.0.0.1 | Multicast group for IPv4 |
| IPv6 multicast | ff02::1:6 | Multicast group for IPv6 |
| Administrative Distance | 100 | AD in the FRR routing table |

### Configuration commands (quick reference)

```bash
# Enable Babel on an interface
set protocols babel interface <name>
set protocols babel interface <name> type [auto|wired|wireless]

# Interface parameters
set protocols babel interface <name> hello-interval <seconds>
set protocols babel interface <name> update-interval <seconds>
set protocols babel interface <name> rxcost <cost>
set protocols babel interface <name> split-horizon [enable|disable]

# RTT parameters
set protocols babel interface <name> enable-timestamps
set protocols babel interface <name> rtt-min <ms>
set protocols babel interface <name> rtt-max <ms>
set protocols babel interface <name> rtt-decay <seconds>

# Diversity routing
set protocols babel diversity
set protocols babel diversity-factor <1-256>
set protocols babel interface <name> channel <number>

# Redistribution
set protocols babel redistribute [ipv4|ipv6] [connected|static|ospf|bgp|rip|isis|eigrp|kernel]

# Filtering
set protocols babel interface <name> import-filter [access-list|prefix-list] <name>
set protocols babel interface <name> export-filter [access-list|prefix-list] <name>
```

### Show commands (quick reference)

```bash
# Status and information
show babel summary
show babel neighbors
show babel routes
show babel routes ipv6
show babel routes installed
show babel interfaces
show babel interface <name>

# Configuration
show configuration protocols babel

# Routes in the kernel
show ip route babel
show ipv6 route babel

# Monitoring
monitor protocol babel
monitor log babel
```

## Conclusion

Babel is a modern and efficient routing protocol for mesh networks that combines configuration simplicity with reliability and performance. Its dual-stack IPv4/IPv6 support, adaptive metrics, and guaranteed loop freedom make it an excellent choice for:

- Mesh networks in cloud providers (Yandex Cloud, VK Cloud)
- Overlay networks on top of VPN tunnels (WireGuard, IPsec)
- Hybrid wired/wireless networks
- Fault-tolerant topologies with multiple paths

With proper configuration and by following best practices, Babel delivers stable and predictable routing even in dynamically changing environments.

### Next steps

1. Study other VyOS routing protocols for comparison
2. Test Babel in a lab environment before a production deployment
3. Set up monitoring and alerting for Babel metrics
4. Document the settings specific to your infrastructure
5. Update VyOS regularly to receive the latest Babel improvements

---

**Document version**: 1.0
**Creation date**: 2025-01-15
**Applies to**: VyOS 1.3+, VyOS 1.4 (Sagitta), VyOS 1.5 (Circinus)
**Author**: OpenNix Documentation Team

