Guide 6 of 10

Firewall rules

Rules are how you tell Demarc exactly what your apps may reach. These guides cover the whole life of a rule: how the list works, writing, changing and removing rules, and the options that go with them.

How rules work

One ordered list, checked from the top. The first rule that matches decides. Anything no rule covers falls through to the default at the bottom.

Anatomy of the list

Guard › Rules. Your rules are numbered in the order they are checked, because order is what people get wrong with firewalls. Each row has move up, move down, an On/Off switch and a bin.

When no rule fits is the default: Allow (everything is allowed unless a rule blocks it) or Block (everything is blocked unless a rule allows it, including apps you have not set up yet, so some may stop working).

Rules screen showing two rules, the When no rule fits default and the Extra protection switches

The three actions

ActionEffect
BlockMatching connections are refused.
AllowMatching connections go through and skip the blocklists. Allow rules are placed at the top of the list so they can take effect.
AlertThe connection is allowed and you are notified; it also appears in What needs a look.
Monitoring has to be on. Rules are saved while it is off and take effect when you start it. They are also suspended while Demarc is paused.

Create a rule

From an empty list to an enforced rule in five steps. The example blocks two advertising domains for every app.

01

Open Rules

Go to Guard and tap Rules. A new install has none, and the list says so. Everything is allowed until a rule, or the default at the bottom, says otherwise.

Starting a rule from a connection you just saw in Watch is faster still: open it and tap Make a rule from this, and the form arrives filled in.

Rules screen with no rules yet, showing New rule and quick start presets

02

Choose what it does

Tap New rule. Pick Block to refuse matching connections, Allow to let them through even if a later rule would block them, or Alert to flag them without interfering.

Give it a name you will still understand in a month. It is the name the block shows up as in Guard. Then choose Any app or Chosen apps.

New rule form showing Block, Allow and Alert, a name field and the app scope choice

03

Say where it goes

Fill in any of Domains, Addresses, Countries and Networks. A domain also covers its subdomains. Leave all four empty to match wherever the connection goes.

Fill more than one and any of them matching is enough, so a rule naming a domain and a country matches either. Further down, narrow it by port and by TCP or UDP.

New rule form with the name Block ad trackers and two domains entered

04

Check it and save

Optionally limit the rule to certain hours, or have it stop applying after 1, 8 or 24 hours. This rule then reads back what you have built as one sentence: here, "any app · doubleclick.net, ads.example.net".

Tap Save rule. It goes to the bottom of the list and starts working the next time monitoring is on. Turn Enabled off first if you want it saved but not deciding anything yet.

Bottom of the rule form with the schedule options, the rule summary and the Save rule button

05

See it in the list

The new rule appears under Your rules with its number, action and a summary of what it matches. Rules are checked from the top and the first match wins, so use the arrows to move a rule up when order matters.

Rules list showing one Block rule, Block ad trackers
Allow rules go to the top. In a first-match-wins list, an allow underneath a block that already matches would never fire, so Demarc puts allows where they can work and tells you where the rule landed.

Edit a rule

Change what a rule matches, what it does, or whether it is on. It keeps its place in the list.

01

Open the rule

On the Rules screen, tap the rule itself. Rules added from a quick start preset are ordinary rules, so they can be edited like your own. Here, the preset's plain HTTP rule is opened.

The form is the same one you used to create it, with the title Edit rule.

Edit rule screen showing the plain HTTP rule with ports 80 and 8080

02

Change it and save

Change anything: the action, the name, the apps, the destinations, the ports or the schedule. The summary under This rule updates as you go. In this example the action went from Block to Alert.

Tap Save changes. The rule stays at the same position, so editing never changes which rule wins.

Bottom of the edit form showing the rule summary with an Alert tag and the Save changes button

03

Confirm in the list

The row now shows the new action. Use the On / Off switch on any row to pause a rule without losing it, and the up and down arrows to change its priority.

Rules list showing the plain HTTP rule now tagged Alert
Prefer Off to delete when you are unsure. A rule that is switched off stays in the list, keeps its number and can be turned back on in one tap.

Delete a rule

Remove a rule for good. Everything it was deciding goes to the next rule that fits.

01

Tap the bin

Each row has a bin icon on the right. Tap the one on the rule you want gone.

Demarc asks first. The dialog names the rule and says what happens next: anything it was deciding follows the next rule that fits, or the default at the bottom of the list.

Delete this rule dialog naming the rule and explaining what happens to its connections

02

Confirm

Tap Delete. The rule disappears and the rules below it renumber. Cancel leaves everything as it was.

There is no undo, so for a quick start preset you can instead use Remove beside it to take out everything it added, or add the preset back later. A rule you only want to pause can be switched Off, as the second row shows.

Rules list after deleting the mail rule, with the remaining plain HTTP rule switched off
Mind the default. Once a block rule is deleted, its traffic is governed by When no rule fits. If that is set to Allow, the traffic is allowed again.

Quick start presets

Ready-made rules to start from. They are ordinary rules once added, so you can edit, reorder or delete them.

PresetWhat it adds
Quiet hoursBlocks social and video sites overnight, 23:00 to 06:30 every day: instagram.com, facebook.com, tiktok.com, snapchat.com, x.com, twitter.com, reddit.com, youtube.com and twitch.tv.
No cleartextRefuses unencrypted traffic: plain HTTP on ports 80 and 8080, and unencrypted mail on ports 25, 110 and 143, on every network.

Tap What it adds to see the rules before adding them. Add appends them below your own rules, so yours still come first. Afterwards the row reads Added, or 1 of 2 added with Add the rest if you deleted some; Remove takes the preset out. Presets never change the default, lockdown or blocklists, and never target specific apps.

What a rule can match

Combine any of these in one rule. Within one rule, leave a field empty to mean “anything”.

FieldAcceptsNotes
Which appsAny app, or chosen appsPick from the installed list; there is a search box.
Domainsexample.com, ads.example.netAlso covers every subdomain.
Addresses1.2.3.4, 10.0.0.0/8, 2001:db8::/32IPv4 or IPv6, single addresses or ranges.
CountriesTwo-letter codes: RU, CNNeeds the location database. Until it is on, this part never matches.
NetworksOperator AS numbers: AS15169, 13335Same database requirement.
Ports443, 8000-8080Empty means any port.
TransportTCP, UDPNeither or both means any.
Domains, addresses, countries and networks are “or”. Fill in more than one and any of them matching is enough. Ports and transport then narrow the result, and apps narrow it further.

Schedules and expiry

A rule can apply only at certain hours, or remove itself after a while.

In the rule form, under When, switch on Only at certain times. Choose the days (none chosen means every day) and a From and To time in 24-hour format. Outside the window the rule is skipped, and whatever matches next decides.

The same start and end means all day. A window that ends before it starts runs overnight, which is how Quiet hours works.

Stops applying after is separate: Never, 1 hour, 8 hours or 24 hours, after which the rule deletes itself. It is handy for a temporary block.

Block everything? Saving a new rule that would match every connection triggers a confirmation. Choose Save anyway only if that is what you mean.

Extra protection

Four switches at the bottom of Rules. Each shows its technical name in small type.

SwitchTechnical nameWhat it does
Block all internetLockdownNo app can go online until you turn it off. It overrides everything and tears down open connections. Also available as a Lockdown tile in Android’s Quick Settings (add it from the tile editor).
Protect while connectingFail closedKeeps rules active while your phone changes networks, and also applies to unknown or unnamed traffic.
Standard web connections onlyBlock QUICFor when something is getting past your rules. Forces browsers to fall back to ordinary HTTPS.
Block unsafe websitesBlock HTTPBlocks websites that do not use a secure connection.
Fail-open by default. Paused, stopped, unknown or unnamed traffic is allowed unless you turn on Protect while connecting. Guard’s Rules row says Lockdown is on — nothing gets out when lockdown is active.

Save or load rules

Guard › Rules › Save or load rules. Back up a ruleset, move it to another phone, or share it.

Save a copy exports your rules plus your default choice and extra-protection settings as text; Share ruleset sends it through Android’s share sheet. What’s in the file previews the export.

Load rules: paste the text and tap Import. Merging (the default) adds the rules and skips duplicates. Replacing deletes every rule you have now first. Text that is not a Demarc ruleset is rejected with a message.