In short: an interface list is a group of interfaces with a name, for example WAN or LAN. Firewall rules, neighbor discovery, and the MAC server look at the list instead of the single port: when you add a PPPoE line, an LTE one, or a second WAN, you put it in the list and the rules apply to it right away.

What is an interface list?

It’s a label you put on several interfaces. Instead of writing ether1 in every rule, you write WAN, and you decide in one place which interfaces are “WAN”. You choose the name: RouterOS gives no special meaning to WAN or LAN, they’re just names.

The lists live in /interface list, the interfaces that belong to them in /interface list member:

/interface list add name=WAN
/interface list add name=LAN
/interface list member add list=WAN interface=ether1
/interface list member add list=LAN interface=bridge

The same interface can be in more than one list. The interface names here are the ones from my lab: adapt them to yours.

Which lists are already on the router?

There are four built-in ones, which you don’t create and don’t delete (if you try, the answer is cannot remove builtin): all (every interface), none (none), dynamic (the interfaces with the dynamic flag), and static (all the others). In the print you recognize them by the * flag, which means “system list”.

/interface list print
/interface list member print

MikroTik’s default configuration, the one with the defconf commented rules, also creates the WAN and LAN lists: the port toward the provider in WAN, the bridge in LAN. If you reset with no-defaults=yes those two lists aren’t there, and you create them by hand as in the Basic hardening of a MikroTik router.

none is more useful than it looks: it’s the value that turns a service off on every interface, for example /tool mac-server set allowed-interface-list=none.

How do you build a list with include and exclude?

A list can take the members of other lists with include and remove some with exclude. This way you build “everything except the WAN” without listing port by port:

/interface list add name=NON-WAN include=all exclude=WAN

The order in which RouterOS computes the list is fixed:

  1. it adds the members of the lists in include;
  2. it removes the members of the lists in exclude;
  3. it adds the static members, the ones you put in /interface list member.

The third point is the trap: a static member gets in even if a list in exclude would have removed it. And the members that come from include and exclude don’t appear in /interface list member print: there you see only the static ones.

Where are interface lists used?

Everywhere RouterOS has to decide “on which interfaces”. The places you run into right away:

  • firewall: in-interface-list and out-interface-list in filter, NAT, mangle, and raw, including the negation (in-interface-list=!LAN);
  • neighbor discovery: /ip neighbor discovery-settings set discover-interface-list=LAN, the router announces itself and sees neighbors only there;
  • MAC server: /tool mac-server set allowed-interface-list=LAN for MAC Telnet and /tool mac-server mac-winbox set allowed-interface-list=LAN for WinBox over MAC;
  • Detect Internet: it checks the interfaces in detect-interface-list and adds, on its own, as dynamic members, the ones that turn out to be LAN, WAN, or Internet in the lists you point it at;
  • PPP: in the PPP profile the interface-list parameter adds to the list every interface created by that profile;
  • bridge: a list can be added as a bridge port, and from RouterOS 7.17 also in the tagged and untagged fields of the VLAN table.

⚠️ Warning: Detect Internet can install a DHCP client, default routes, and DNS servers. If you turn it on, check right away what it changed in the configuration.

Why in the firewall is in-interface-list better than in-interface?

Because the rules talk about the role of the interface, not its name. In the manual in-interface-list “works like in-interface”, but over a set. The difference shows up the day the network changes.

Take a router with the WAN on ether1 and the hardening firewall. The customer adds a fiber line with PPPoE. With the lists you do one single thing:

/interface list member add list=WAN interface=pppoe-out1

From that moment the masquerade out-interface-list=WAN goes out over the fiber too, and the drop in-interface-list=WAN connection-nat-state=!dstnat in the forward chain protects the LAN from that side as well. No rule to rewrite, none to duplicate.

With in-interface=ether1 you would have had to copy every rule for pppoe-out1, then for the LTE, then for the third line. More duplicate rules means more chances to forget one. And the forgotten rule is a hole.

The same goes for the other side. In the WireGuard from the phone howto the wg-casa interface goes into the LAN list, and the phones go through the same rules as the home network.

Lists don’t always replace in-interface. When you have to tell one line from the other, as in the balancing with PCC over several internet connections, the mangle marks the connections per single interface. There you need the exact name.

How do interfaces that come and go get into a list?

It depends on who creates the interface. A PPPoE client you configured (pppoe-out1) exists in the configuration even when the line is down: you add it as a member once and it stays there.

Dynamic interfaces, on the other hand, like the ones a PPPoE server creates for each connected user, appear and disappear on their own. You can’t put them in /interface list member by hand. There are two ways:

  • the interface-list parameter of the PPP profile, which puts them in the list when they’re born;
  • the built-in dynamic list, to use in the rules or inside an include.
/ppp profile set [find name=default] interface-list=LAN

According to the manual, the members added this way appear with the D (dynamic) flag in /interface list member print.

What are the typical mistakes?

The rule points to a list that isn’t there

You copy a block of rules from another router and the name doesn’t match: WAN versus wan, or on a router reset with no-defaults=yes the lists just don’t exist. RouterOS rejects the rule with input does not match any value of interface-list, and if the script keeps going you end up with a half firewall. Lists first, then rules.

You deleted a list a rule was using

Here RouterOS doesn’t complain: the list disappears and the rule stays, with a number in place of the name (for example in-interface-list=*2000015). It isn’t marked as invalid, but it no longer matches anything. Before deleting a list, look for who uses it:

/ip firewall filter print where in-interface-list=NOME or out-interface-list=NOME
/ip firewall nat print where in-interface-list=NOME or out-interface-list=NOME

The new WAN port got left out

You add the second line, configure the address, the route works, but you don’t put it in WAN. The masquerade doesn’t see it, so the clients don’t browse through it. And the forward drop doesn’t protect it. Every time you add a line, the first command is the member add.

You put the port in place of the bridge

The traffic the router routes comes in from the bridge, not from ether2 which is one of its ports. If in LAN you put ether2 instead of bridge, the rule in-interface-list=LAN doesn’t match and the LAN stays locked out of the router. For the physical port inside a bridge the firewall has in-bridge-port, which works only with use-ip-firewall active on the bridge.

Neighbor discovery reasons the other way around: it works on the single ports. If the bridge is in the list, all its ports take part; if you want discovery only on some, put those ports and not the bridge. The manual says it clearly: adding the bridge is not the same as adding all its ports, and vice versa. The details are in the MikroTik manual: Interface Lists and in the MikroTik manual: Neighbor discovery.

Which howtos do you use it in?

Tested in the lab on a routerboard with RouterOS 7.24.5 (stable): built-in lists and cannot remove builtin, a list with include=all exclude= and a static member that gets back in despite the exclusion (rule counters), a bridge port in a list in place of the bridge (no match), a rule rejected with a nonexistent list, a list deleted while a rule was using it. PPPoE, the PPP profile, and Detect Internet are from the documentation.

Frequently asked questions

Do the WAN and LAN lists already exist on a MikroTik?

Only if the router has the default configuration. After a reset with no-defaults=yes the built-in lists are just all, none, dynamic, and static: you create WAN and LAN yourself with /interface list add.

What’s the difference between in-interface and in-interface-list?

They work the same way, but in-interface-list looks at a group of interfaces. When you add a line to the list, all the rules that use it apply to it too without changing them.

Why don’t I see all the members in /interface list member?

Because there you see the static members and the dynamic ones added by PPP or Detect Internet (D flag), but not the ones the list takes from include and exclude.

In the LAN list do I put the bridge or its ports?

For the firewall, the bridge: the routed traffic comes in from the bridge, not from the port. To limit neighbor discovery to some ports, instead, put the ports and not the bridge.