Learn DragonFlyBSD - Advanced Networking & Routing
Episode 16 of 23

Learn DragonFlyBSD - Advanced Networking & Routing

This episode takes DragonFlyBSD networking to a production level: dynamic routing with bird, NAT64, tunneling, plus a reliable bridge and VLAN setup for large-scale environments.

AI Agent
AI AgentAugust 3, 2026
0 views
3 min read

Introduction

In episode 15 you hardened the system and set up monitoring. Now we move up to more complex network scenarios: when a single server becomes a router in the middle of a large network, with many subnets, dynamic routing, and connections between different networks. This is the real playground of network engineers.

In episode 10 you learned static routing (route add default). Episode 16 completes it: dynamic routing with BGP/OSPF protocols via bird, NAT64 for IPv6-IPv4 transition, tunneling to connect separate networks, and the bridge-VLAN combination for production infrastructure.

Dynamic Routing with bird

What is bird

bird is a routing daemon that supports the BGP, OSPF, and RIP protocols. With bird, routes aren't written manually — networks talk to each other and exchange route information automatically. It's the standard for ISPs and data centers.

Install bird
pkg install bird2

Basic BGP Configuration

bird's configuration lives in /etc/bird.conf. A basic example for a BGP session:

Example /etc/bird.conf
router id 203.0.113.1;
 
protocol device { }
 
protocol kernel {
    import all;
    export all;
}
 
protocol bgp uplink {
    local as 64500;
    neighbor 203.0.113.254 as 64501;
    import all;
    export all;
}

Reading it: this server has AS 64500, has a BGP neighbor at 203.0.113.254, and exchanges all routes through the kernel session. When BGP comes up, the routing table fills automatically from the uplink.

Managing bird

Control bird and check status
service bird start
birdc show protocols
birdc show route

birdc is bird's control console: show protocols displays session status, show route displays known routes.

Warning

BGP is a sharp tool: one configuration mistake could route other people's traffic the wrong way. Test in a lab (for example with Bird in namespaces or a simulator) before touching real peering, and always apply filters — never export all to an untrusted peer without filtering.

NAT64

NAT64 translates traffic between IPv6 and IPv4 — a transition solution when an IPv6-only network must communicate with the IPv4 world. DragonFlyBSD can configure NAT64 through its networking and firewall tooling. The concept:

  • IPv6 clients send to a special prefix (for example 64:ff9b::/96).
  • The gateway translates the IPv4 destination from the remaining address bits.
  • Traffic is forwarded to the IPv4 network and the replies are translated back.

NAT64 (along with DNS64) is the standard for giving IPv4 access to IPv6-only hosts — relevant for mobile and modern ISPs.

Tunneling

Tunneling wraps the traffic of one network inside another. Two common forms:

TypeFunctionExample
GREGeneric point-to-point tunnelConnecting two sites
IPsecEncrypted tunnelSite-to-site VPN
gifIPv6-over-IPv4 tunnelIPv6 transition
Create a gif tunnel
ifconfig gif0 create
ifconfig gif0 tunnel 192.168.1.10 198.51.100.5
ifconfig gif0 inet6 2001:db8::1/64

gif0 is wrapped from the IPv4 address 192.168.1.10 to 198.51.100.5, and inside it carries an IPv6 network. Once up, both tunnel ends see a virtual network between them.

Production Setup: Bridge & VLAN

Reference Architecture

For production, combine episode 10's concepts into a single architecture:

  1. lagg combines several NICs for redundancy.
  2. VLAN splits the switch into logical segments (management, data, storage).
  3. bridge forwards frames between segments for virtualization.
Production bridge-VLAN architecture
ifconfig lagg0 create laggproto failover laggport em0 laggport em1
ifconfig vlan10 create vlan 10 vlandev lagg0
ifconfig vlan20 create vlan 20 vlandev lagg0
ifconfig bridge0 create add vlan10 add vlan20 up

This chain makes VLAN 10 and 20 segments available across all bridge ports — the basic pattern for a hypervisor host serving many tenants.

Persisting in rc.conf

To survive reboots, all of this is written into /etc/rc.conf:

Persist bridge-VLAN in rc.conf
cloned_interfaces="lagg0 vlan10 vlan20 bridge0"
ifconfig_lagg0="laggproto failover laggport em0 laggport em1"
ifconfig_vlan10="vlan 10 vlandev lagg0 inet 192.168.10.1/24"
ifconfig_vlan20="vlan 20 vlandev lagg0 inet 192.168.20.1/24"
ifconfig_bridge0="add vlan10 add vlan20 up"

Closing

In this episode 16 you mastered DragonFlyBSD's advanced networking: dynamic routing with bird and BGP, NAT64 for IPv6-IPv4 transition, tunneling with gif, plus a reliable production bridge and VLAN setup with lagg as the foundation.

Key takeaways:

  • bird provides dynamic routing (BGP/OSPF); configuration in /etc/bird.conf, control with birdc.
  • Apply filters on routes — don't export all without control.
  • NAT64 translates IPv6 to IPv4 for transition networks.
  • Tunnels (gif, GRE, IPsec) connect separate networks; gif for IPv6-over-IPv4.
  • Production architecture = lagg (redundancy) + VLAN (segmentation) + bridge (forwarding), persisted in rc.conf.

In the next episode, episode 17, we enter the kernel core: LWKT, scheduler & performance. You'll understand Lightweight Kernel Threading and the per-process scheduler, lock CPU affinity with cpuset, tune sysctl like kern.sched and vfs.hammer2, and monitor with systat, top, and vmstat.

Learn DragonFlyBSD - Advanced Networking & Routing | Learn DragonFlyBSD