Skip to content

Rules ​

Every rule has the same shape: if this, then that. A rule with no if applies to everything. Most rules can also have a description.

RuleKindWhat it does
{ if: { protocol: "icmp" }, then: "accept" }Firewallthen is accept, drop, or reject. With fast_path: true, the rest of the flow skips the rules.
{ if: { src: "...", out_interface_set: "uplinks" }, then: "masquerade" }NATthen is masquerade, snat, or dnat. snat and dnat need a to_address, and can have a to_port.
{ if: { vlan: "...", src: "..." }, then: "drop" }Switch ACLthen is accept or drop. A rate drops accepted traffic over that rate.
{ if: { prefix_set: "ours" }, then: "reject" }Route policythen is accept or reject, and the policy ends for that route.
{ if: { ... }, set: { local_pref: 200 } }Route policyIf a rule has no then, Circuit changes the route and goes to the next rule.
{ call: "common-import" }Route policyRuns another policy. If that policy accepts or rejects the route, it stops there.
{ communities: "import" }Route policyYour community scheme's rules.
{ match: { src: "..." }, routing_table: "..." }Policy routingMatching traffic uses that routing table.

Rule order ​

In these lists, the first rule runs first:

  • each firewall chain's rules
  • firewall.nat.source and firewall.nat.destination
  • each route policy, and routing.policy_routing
  • each switch ACL

Rules have no line numbers: the order of the list is the order on the device. You write each list in one place, and merge brings in rules from other files.

In other lists the order doesn't matter, except in DNS and NTP servers, which go in order of preference.

Shortcuts ​

ShortcutWhat it does
A list in a matchsrc: ["a", "b"] matches either one. Circuit writes one rule per value. Filter and NAT rules take lists in src, dst, in_interface, and out_interface; ACL rules in vlan, src, and dst.
Interface setsfirewall.interface_sets.uplinks: ["25g-1", "25g-2"], then in_interface_set: "uplinks" in a rule. A part can add interfaces to a set.
bgpNeighbors()An address set with every BGP neighbor of the device. It changes when you add a neighbor.
management.allowA list of prefixes, or the name of an address set.
presetsReady-made rules and values from public standards, such as presets.bgp_sanity (RFC 7454, plus RPKI invalid) and presets.rfc1918. Use one whole, or pick items.

Released under the Business Source License 1.1.