Skip to main content

Targets

The Targets tab decides which traffic the set applies to. It has three sub-tabs: Bypass Domains, Bypass IPs and Source Devices.

Adding sites to a set shows the ways to fill this tab, including from the Traffic page and the dashboard. How sets match traffic describes how b4 chooses between sets that target the same site.

The Bypass Domains sub-tab with a GeoSite category

Domains​

The Bypass Domains sub-tab holds domain names and GeoSite categories, and the filters that apply to the whole set.

FieldWhat it doesDefault
Match any domainAdds regexp:.*, which matches every domain. A domain that another set lists is still handled by that set, so this set takes only what no other set claims. For routing, it covers only the addresses this set has resolved, not every address.Off
Domain-only matchingMatches the domains only by the server name in the handshake, never by their IP address. Useful on shared CDN addresses, where a neighbouring domain on the same IP would otherwise get this set's strategy. A routing set with this on routes only the addresses listed explicitly.Off
TLS Version FilterAny, TLS 1.2 or TLS 1.3, compared with the highest version the client offers. For a match by domain it is a preference: among the sets that list the domain, one whose filter fits comes first. For a match by address, a set whose filter does not fit does not take the connection.Any
IP Version FilterAny, IPv4 or IPv6, a preference for matches by domain and by address alike: among the matching sets, one whose filter fits comes first. Shown while both IPv4 and IPv6 support are on under Settings > Core. An ASN target then loads only the prefixes of the chosen family.Any
Manual Bypass DomainsDomain names, added with Enter. A domain covers its subdomains, so a leading *. is removed. Several domains can be pasted at once, separated by commas or new lines. A regexp: entry takes a regular expression.Empty
Bypass GeoSite CategoriesReady-made lists of a service's domains from the GeoSite database, such as youtube or discord. Needs the database loaded under Settings > Geodat Settings. A click on a category shows its domains.Empty

Edit List opens all manual entries as text, one per line. When a domain is already in another set, a warning names that set.

IP addresses​

The Bypass IPs sub-tab holds addresses, GeoIP categories and ASNs.

The Bypass IPs sub-tab

FieldWhat it doesDefault
Match any IP addressAdds 0.0.0.0/0, and ::/0 while IPv6 support is on, which match every address. For DPI bypass, a narrower range in another set is handled by that set, so this set takes only what no other set claims. For routing, a narrower range in another routing set gets no such priority, so the two are best not combined.Off
IP priorityA connection to an address the set lists, by IP, GeoIP category, ASN or collected IPs, stays with this set even when a set lower in the list matches its domain. Shown while TLS Version Filter on Bypass Domains is Any.Off
Use collected IPsAdds the addresses that IP block detection collects to the set's targets, see Collected IPs.Off
Manual Bypass IPsAddresses and CIDR ranges, such as 192.168.1.100 or 10.0.0.0/8, entered the same way as domains. Other text, such as an AS number, is refused.Empty
Bypass GeoIP CategoriesAddress ranges from the GeoIP database, by country or by network. Needs the database loaded under Settings > Geodat Settings.Empty

IP priority suits servers that carry only this set's sites, such as the Google Global Cache nodes in a provider's own network. Shared CDN ranges and large networks carry many sites, and the switch is best left off there. With the Google network AS15169 as a target, for example, the set would also keep youtube.com and every other Google service from the sets below it. Sets that rank above this one still take connections by name. A set limited to source devices ranks above every set without them. Among sets of the same kind, the one higher in the list ranks first. IP priority does not apply to a connection that matches the set only through Match any IP address. IP priority describes the exact rules.

Collected IPs​

Use collected IPs adds the addresses that Collect detected IPs finds to the set's targets, next to its manual IPs, GeoIP categories and ASNs. Every set that collects fills one pool, and every set with the switch on uses all of it. A collected address is a candidate: the TLS handshake to it stalled, which does not show that this set gets through. An empty pool adds nothing.

Which of the sets with Use collected IPs on takes a connection to a collected address:

  • A set with Traffic Routing through a Network interface, an Upstream SOCKS5 proxy or Telegram over WebSocket (built-in), or with Reuse WSSIZE connection, takes every such connection from the devices it applies to, whatever the site name and the set order. Reuse takes TCP port 443 only.
  • Any other set takes it by the usual rules of IP targets. When another set targets the site's domain, that set takes the connection, unless IP priority keeps it with this one. A set whose Reuse WSSIZE connection does nothing, or whose router lacks TPROXY, follows these rules too.

An address leaves the pool 6 hours after it was collected. It leaves earlier when its server answers a connection that IP block detection watches in a set without Use collected IPs, unless a routing or reuse set from the list above takes that connection. The set's own connections never remove an address, whether they get through or not. Two new silent connections in a row can collect it again. The pool is kept when the settings are saved and cleared when b4 restarts. The Collected IPs panel on the dashboard lists the addresses and removes them.

For MSS Clamping, Packet Duplication and the set's DSCP value, the collected addresses count as the set's addresses, and Use collected IPs alone is enough of a target. A set for calls cannot use collected IPs.

The set's JSON on the Import/Export tab carries the switch, never the addresses. A shared set carries neither. Collected IP targets describes how collection works under the hood.

ASN​

The Networks (ASN) panel on Bypass IPs holds the set's ASN targets. An ASN (autonomous system number) identifies the network of one operator: AS15169 is Google, AS13335 is Cloudflare. An ASN target makes the set match every address range, or prefix, the network announces. b4 fetches the prefixes from RIPEstat, refreshes them daily and keeps the last good copy when a fetch fails.

FieldWhat it does
Add ASN, or find one by IPTakes a number (15169), the number with its prefix (AS15169) or an IP address. For an address, b4 lists the networks that announce it, and a button such as Add AS15169 adds one. The address itself is not added.
ASN rowsEach ASN in the set with its holder, the number of IPv4 and IPv6 prefixes, the approximate number of IPv4 addresses and the time of the last update. Refresh from RIPEstat fetches the prefixes again, Show prefixes lists them, and Remove from the set removes the ASN.

When a lookup fails, the error is shown, and Add anyway, resolve later still adds the ASN. b4 retries in the background. Until a fetch succeeds, the ASN adds no addresses to the set, and the set's card shows N ASN unresolved. Private and reserved numbers are refused, since no public network announces them.

For routing, where two sets of the same kind cover the same addresses, the set higher in the list wins, and sets limited to selected devices or source interfaces come before the others. A set with ASN targets and no domains cannot be kept working by the watchdog, which identifies a set's sites by their names. How sets match traffic describes where the prefixes come from and how they are refreshed.

Large and shared networks

A large network expands into thousands of prefixes, which costs memory on a small router. The panel warns above 2,000 prefixes or 16,777,216 IPv4 addresses. A cloud, hosting or CDN network such as AWS, Google Cloud, Cloudflare, Akamai or Hetzner carries many unrelated services. Its ASN also catches every other site hosted there, public DNS resolvers such as 8.8.8.8 and 1.1.1.1 included. A domain target, or a narrower set placed above, keeps the set to the service meant.

Source devices​

The Source Devices sub-tab limits the set to traffic from selected devices. Applying b4 to selected devices shows the setup.

The Source Devices sub-tab with two devices selected, one of them offline

FieldWhat it doesDefault
Device tableThe devices with their MAC address, IP address and name. offline marks a device not on the network now. The set applies to the traffic of the selected ones.None selected
All devices except selectedApplies the set to every device except the selected ones.Off

With no device selected, the set applies to all traffic. A set limited to devices takes priority over a set without devices that targets the same site.

A device that has left the network for good is removed from this set by clearing its checkbox, or from every set by forgetting it under Settings > Core > Devices.

Devices found in the router's ARP table are matched by their MAC address. A device added by hand has no MAC address on the network, so it is matched by the IP address entered for it. Such a device needs a fixed or reserved address, and it cannot be matched when a router between it and b4 replaces its source address. Without a working ARP table, the tab says so, and filtering by source device does not work.

Source devices do not select traffic on their own

Source devices decide whose traffic the set applies to, not which traffic. A routing set whose only target is a source device routes nothing. To route everything from a device, Match any IP address is turned on in the Bypass IPs sub-tab. A set in Upstream SOCKS5 proxy mode can also route the device's UDP by port. Traffic the router itself sends never comes from a source device, so such a set leaves it alone.