Traffic matrix: designing the rules between zones

What talks to what, what should be blocked, and how to handle shared services: building and maintaining a traffic matrix for segmentation.

Topic
Networks
Author
ARLITECH expert team
Published

Segmentation rarely gets stuck at assigning VLANs. The harder question is what exactly may pass between the zones. If there is no written answer, sooner or later an “any to any” rule meant to be temporary shows up on the firewall, and from then on the segmentation exists only on the network diagram.

The traffic matrix settles that question: it records which zone may talk to which, over what service, and why. This article follows it from first draft through enforcement to ongoing maintenance.

What a traffic matrix is

In its simplest form it is a table: the rows are source zones, the columns are destination zones, and each cell says what communication is allowed between them. A cell holds the protocol, the port, the direction and, if the traffic is narrower than that, the specific hosts or groups. An empty cell means the traffic is denied.

The grid view is good for an overview, but for the details a row-by-row list is easier to work with. Each allowed connection is one row, and besides the technical data two fields are always filled in: the justification and the owner, meaning the person or role who can say whether this traffic is still needed.

Simplified example with four zones (for illustration; a real environment has far more rows)
SourceDestinationServiceJustificationOwner
User clientsApplication serversHTTPS (443/tcp) to the web interface of the ERP systemDaily workApplication owner
User clientsShared servicesDNS (53/udp and 53/tcp) to the internal resolversName resolutionNetwork operations
ManagementApplication serversSSH (22/tcp) and RDP (3389/tcp), from the jump host onlyOperationsSysadmin team
Guest Wi-FiAny internal zoneDenied, internet onlyNo business needNetwork operations

The matrix describes intent at the zone level, and the firewall rule base implements it. One cell can turn into several rules, but every rule has to trace back to a cell. If a rule has no matching row, either the rule is unnecessary or the row is missing from the matrix. Comparing the two regularly is covered under maintenance below.

In industrial systems the same idea appears in the zone and conduit model of the IEC 62443 family of standards: 62443-3-2 divides the system into zones, treats the connections between zones as conduits, and assigns each a target security level (SL-T). The specific system requirements are in 62443-3-3.

Data collection: what talks to what today

Build the first version of the matrix from existing traffic. If you rely only on memory and old documentation, processes that run rarely get left out, and they are the first to break when enforcement starts.

Sources

  • Flow data from routers and switches. NetFlow and IPFIX export per-connection metadata and sFlow exports sampled packet headers, which show who talked to whom, on which port, and with how much traffic. With sampling (sFlow always works this way, and NetFlow and IPFIX are often configured that way), rare or short connections can be missed, so you need the other sources alongside the flow data. Network visibility is covered in a separate article.
  • Logs from existing firewalls, wherever a zone boundary already exists, for example between the server room and the office network.
  • The list of services running on the servers: which ports they listen on and which connections are currently open. This also shows what generated no traffic during the sampling period.
  • Vendor documentation for the applications, which usually lists the required ports and directions.
  • Conversations with the application owners. They know that accounting uploads data to the bank once a month, or that the quarterly report reads from a database at another site.

How long to observe

Two weeks of sampling shows daily traffic well, but not the month-end close, the quarterly reports or the annual inventory. The observation period should cover at least one full business cycle, and the rarer events have to be filled in from the interviews.

Processing

The raw list consists of IP addresses and ports, and it has to be turned into services. Individual hosts are assigned to zones and roles, and the many individual connections can be merged, so traffic from several hundred clients to one database server becomes a single row. Each row then goes into one of three groups: needed, not needed, or unknown. The third group takes the most time, because for every item you have to find the person responsible for it.

Default deny and justified exceptions

Between zones the base rule is deny, and every filled cell in the matrix is an exception with a justification attached. The question then becomes what has to be allowed. If you start from what has to be blocked, the list is never complete, because new applications and an attacker’s tools get through on their own.

What makes an exception narrow

A rule has four fields you can narrow: source, destination, port and direction. “Any” is not a good default for any of them. If a field does have to stay broad, for example because every client must reach the resolver, write that down in the matrix. Direction needs particular attention: a stateful firewall lets return traffic through automatically, so you only need to specify the side that initiates the connection. An application server rarely has a reason to open connections toward the clients, so if the collected data shows that, look into it.

Traffic within a zone

The diagonal of the grid, meaning traffic within the same zone, does not pass through the firewall in many networks. You have to decide whether everything is allowed there. Most offices have no business need for client-to-client traffic, yet it is one of the paths malware uses to spread laterally. Client isolation is covered in the article on segmenting the internal network.

Temporary exceptions

A migration or a vendor troubleshooting session often needs a temporary rule. It should appear in the matrix with an expiry date and, where the product supports it, as a scheduled rule on the firewall, because without an expiry nobody will notice when it is no longer needed.

Shared services: DNS, directory, updates, backup

Some services are needed by almost every zone: name resolution, time sync (NTP, 123/udp), directory authentication, updates, backup and log collection. These servers are reachable from every zone, so unless access to them is kept tight, they act as a bridge between the segments. A compromised client that reaches the directory server on many ports gets into the same server the server zone connects to.

A common approach is to put the shared services in a zone of their own. The other zones may initiate connections to them only on the required ports, and the shared servers may open connections toward clients only where that is actually needed.

DNS

Clients should reach only the internal resolvers, not internet DNS servers directly. That way name resolution can be logged and filtered, and it is harder to use DNS traffic for data exfiltration or as a command-and-control channel. Outbound traffic from the internal resolvers is a separate, narrow rule.

Directory

Authentication needs Kerberos (88/tcp and 88/udp), LDAP (389) or LDAPS (636), and domain-joined machines need further services on top of that. Some of these use dynamic RPC ports. The list of required ports is in the directory product’s documentation, and the dynamic range can usually be narrowed on the servers, so you do not have to open a wide port range on the firewall either. Management interfaces, such as remote administration, should not be reachable from user zones.

Updates

If every zone downloads its updates directly from the internet, outbound traffic has to be allowed from every zone. A central update server or caching proxy in the shared zone narrows this to a single outbound connection, and the zones reach only that one internal destination.

Backup

In most environments the backup server has access to everything, which makes it a favorite target for attackers. The matrix has to record which side initiates: whether the backup server pulls the data or the agents push it. The backup repository and the backup system’s management interface should not be reachable from user zones. Protecting backups is covered in more detail in the article on the 3-2-1 rule.

Log collection and monitoring

Logs (for example syslog, 514/udp) and monitoring data typically flow in one direction, from the sources to the collector. If the monitoring system actively polls the devices, that is a rule in the opposite direction, and it also has to be added as a separate row.

Monitor mode first, then enforcement

The riskiest moment is when the deny takes effect at the zone boundary. If a connection was left out of the matrix, it shows up when the deny is switched on, usually as an application that stops working. A monitoring phase comes first to prevent that.

First the matrix’s allow rules go onto the firewall, and at the end of the list, instead of a deny, a rule that lets everything through but logs it. Whatever hits that rule is either missing from the matrix or unnecessary traffic. Every hit has to be reviewed and assigned to one of the two. The same applies to the length of the monitoring phase as to data collection: if it is shorter than one business cycle, the traffic of monthly tasks will be missed here too.

Once the logging rule shows only known traffic already classified as unnecessary, the deny can go in. Work zone by zone, starting with the least critical one, such as the guest network, and leave the production systems for last. Every step needs a rollback plan and an agreed date, and the help desk has to know that on that day an application that suddenly becomes unreachable is probably blocked by the firewall.

After enforcement, keep logging of denied traffic switched on. In the first days this is the fastest way to find a missed connection within hours, instead of piecing it together from user complaints.

In OT environments the monitoring phase is usually longer, because some processes run only at a production changeover or during annual maintenance, and the deny is best switched on in a maintenance window, agreed with the process owner.

Maintaining the matrix as things change

The matrix is accurate on the day it goes live, and after that every new application, relocated server and decommissioned system changes it. If the firewall is changed independently of the matrix, the two drift apart within a few months, and the matrix can no longer tell you what the firewall allows.

Make it part of change management

A request for a new connection should itself be a matrix row: source, destination, service, direction, justification and owner. The firewall rule is built from it, and the rule comment carries the request ID, so for any rule you can look up who asked for it and why.

At decommissioning, too

When a server is decommissioned, its rows and rules have to be deleted as well. This step is easy to skip, and that is how rules pointing to machines that no longer exist pile up. If the address is later given to another machine, the old rule grants access to that new machine.

Periodic reconciliation

At regular intervals the firewall rule base has to be compared with the matrix. The rules’ hit counters show which rules have carried no traffic for a long time, and those are candidates for deletion. In the matrix, look for rows that no longer have an owner, or whose owner has since moved to a different role.

Version control

If the matrix is kept in a structured form, such as a spreadsheet or a text data file, it can live in version control, and you can see what changed between two versions and when. A script can also use the same file to check whether the firewall configuration differs from it.

Related service: Network segmentation →

Contact

Ready to secure your critical systems?

Our experts will assess where your security stands and build a roadmap that fits your organization.

ARLITECH's office in Gödöllő

Visit us

You are welcome to visit our Gödöllő office in person.

Address
Centrum Office Building, 2100 Gödöllő, Dózsa György út 13, 3rd floor, office 309
Office hours
Mon–Fri, 9 a.m. to 5 p.m.
Get directions (opens in a new tab)