shower thoughts and ideas

User Tools

Site Tools


Policy based routing in FreeBSD

Status: not testet, maybe not complete


If you have multiple interfaces on a based router, with multiple default routes (in this case two), dynamic routing with BGP or OSPF, have multiple routing tables and want traffic from a specific subnet to use a specific default route, with Linux you will do something like this:

  • setup default route for the router into the default routing table
  • setup dynamic routing protocols with bird
  • export routes into a second routing table
  • export second default route received via a dynamic routing protocol, into a third routing table
  • setup policy routing with ip rule
    • redirect all traffic to the second routing table (the one without a default route)
    • if no route matches: redirect traffic from specific subnet to third routing table
    • last rule: redirect traffic to default routing table


maybe with ipfw setfib

  • Unordered List Item


graphic for illustration

knowledgebase/pbr_freebsd.txt · Last modified: 2023/04/30 16:58 by