Metadata-Version: 2.3
Name: neutron-bsdbridge
Version: 0.9.6
Summary: Neutron ML2 driver with L2, DHCP and L3 agents based on if_bridge and pf for FreeBSD
Author: joshiggins
Author-email: joshiggins <josh@joshh.info>
License: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# neutron-bsdbridge

Neutron ML2 mechanism driver, L2 agent, DHCP agent and L3 agent for FreeBSD based on `if_bridge(4)` and `pf(4)`.

## Status

### Features

- ML2 mechanism driver that binds ports with `vif_type=bridge` and publishes to Nova
- Implements one bridge per Neutron segment for vlan, flat, vxlan and local networks.
- L2 agent to manage bridge, taps and security group rules
- Port security with allowed address pairs
- DHCP agent running one dnsmasq per network inside separate VNET jails
- L3 agent running each router inside a VNET jail with SNAT, floating IPs and port forwarding
- IPv6 subnets in SLAAC, DHCPv6 stateless and DHCPv6 stateful modes, with router advertisements from `rtadvd(8)` in the router jail
- IPv6 security group rules and source address filtering

### Roadmap

- metadata agent
- HA routers (CARP+pfsync)
- prevent ARP spoofing in port security

### Limitations

- Distributed routers are unlikely to ever be supported
- Tenant vxlan networks do not forward application broadcast or multicast traffic - only ARP, DHCPv4, DHCPv6 and IPv6 neighbour discovery is relayed
- A port with port security sends IPv6 only from its fixed addresses, its allowed address pairs and the link-local address derived from its MAC
- A router takes its IPv6 default route from the gateway of the external subnet, not from router advertisements

## Host requirements

Make sure to configure `net.link.bridge.pfil_member=1` on the host.

Add to the host `pf.conf`:

```
set state-policy if-bound
ether anchor "l2-neutron/port/*"
anchor "l2-neutron/port/*"
```

For vxlan networks, port 4789 must be open on the host underlay interface (the one assigned `[vxlan] local_ip` in the config) and allow loopback traffic for the relay service. The L2 agent keeps the tunnel addresses of the other hosts in the `l2-neutron-vtep` table:

```
table <l2-neutron-vtep> persist
pass in on vtnet0 proto udp from <l2-neutron-vtep> to port 4789
pass out on vtnet0 proto udp to port 4789
pass on lo0 proto udp to 127.0.0.1
```

## Configuration

`neutron.conf`

```ini
[DEFAULT]
service_plugins = router
```

`ml2_conf.ini`

```ini
[ml2]
mechanism_drivers = bsdbridge
```

`bsdbridge_agent.ini`

```ini
[bsdbridge]
physical_interface_mappings = physnet1:ix0
```

Map the physical network name in OpenStack to the actual uplink/trunk interfaces on the host.

For vlan networks, the L2 agent will create a vlan interface on top of the mapped physical interface and plug it to the respective bridge for you, but make sure that the actual network trunks those VLAN between hosts.

### Tenant networks with vlan

You can enable self-service/tenant networks based on VLANs by configuring a range of IDs that can be used:

``` ini
[ml2]
tenant_network_types = vlan

[ml2_type_vlan]
network_vlan_ranges = physnet1:100:199
```

Now any networks created in non-admin projects will be allocated a vlan segment automatically (the `ix0.<vid>` uplink is created and plugged by the L2 agent).
Same as above, ensure that the network fabric actually trunks this range of VLAN IDs to the interface on each host which is mapped in `physical_interface_mappings`.

### Tenant networks with vxlan

It is usually better to enable self-service/tenant networks using vxlan, the only requirement is that the hosts can reach each other on UDP port 4789, routed or not.

Set `local_ip` to the IP assigned to the underlay network interface:

`bsdbridge_agent.ini`

```ini
[vxlan]
local_ip = 192.168.50.150
```

Enable the vxlan relay on every host running the L2 agent, it runs as the `neutron` user:

```
sysrc neutron_bsdbridge_vxlan_relay_enable=YES
```

Enable the l2population mechanism driver, set the tenant network type to vxlan and configure the VNI range:

`ml2_conf.ini`

```ini
[ml2]
mechanism_drivers = bsdbridge,l2population
type_drivers = local,flat,vlan,vxlan
tenant_network_types = vxlan

[ml2_type_vxlan]
vni_ranges = 1:65535
```

Note that the MTU in a vxlan neutron network is 1450. If you need a 1500 MTU inside the guests, you can do it by setting `global_physnet_mtu = 1550` and enable jumbo frames on the underlay network.

## IPv6

In OpenStack tenant IPv6 subnets are routed without translation and there is no support for SNAT or floating IPs for IPv6.

The external network has to route tenant prefixes to the router, either with static routes or with BGP using `neutron-dynamic-routing`.
