Junos OS Security Objects · Topic 1 of 4

Security Zones and Host-Inbound Traffic

Learn SRX security zones, the functional management zone, the null zone, intrazone traffic and host-inbound-traffic system services and protocols.

  • 6 min
  • Includes a diagram
In a nutshell
  • Zones hold logical interfaces; one interface belongs to one zone; one zone sits in one routing instance.
  • Interzone and intrazone traffic both need a security policy.
  • Interfaces in no zone are in the null zone and drop traffic.

What it is

A security zone is a named group of logical interfaces that share the same level of trust, such as trust, untrust or dmz. Security policies are written between zones, so the zone of the ingress and egress interface decides which policies apply to a packet.

A zone also decides which host-bound traffic, such as SSH, ping or OSPF to the SRX itself, the device accepts. That is the job of host-inbound-traffic.

Interface ge 0/0/1member ofZone trustpolicyZone untrustmember ofInterface ge 0/0/0

How it works

Creating a zone

security {
    zones {
        security-zone trust {
            host-inbound-traffic {
                system-services {
                    ssh;
                    ping;
                }
            }
            interfaces {
                ge-0/0/1.0;
            }
        }
        security-zone untrust {
            interfaces {
                ge-0/0/0.0;
            }
        }
    }
}

The same trust zone in set form:

user@srx# set security zones security-zone trust interfaces ge-0/0/1.0
user@srx# set security zones security-zone trust host-inbound-traffic system-services ssh
user@srx# set security zones security-zone trust host-inbound-traffic system-services ping

Zone rules

RuleDetail
One zone per interfaceA logical interface belongs to exactly one zone
Many interfaces per zoneA zone can hold any number of logical interfaces
One routing instance per zoneAll interfaces of a zone must be in the same routing instance
No zone means no trafficAn interface in no zone is in the null zone; its traffic is dropped
Names are your choicetrust and untrust are only names; the SRX attaches no meaning to them

Interzone and intrazone traffic

Traffic from one zone to another is interzone traffic, and needs a policy from the ingress zone to the egress zone. Traffic that enters and leaves through two interfaces of the same zone is intrazone traffic, and it also needs a policy, from that zone to the same zone.

user@srx# set security policies from-zone trust to-zone trust policy INTRA match source-address any destination-address any application any
user@srx# set security policies from-zone trust to-zone trust policy INTRA then permit

Without that policy, the default deny drops traffic between two trust interfaces. The branch factory default configuration includes a trust to trust permit policy, which is why intrazone traffic works there out of the box.

Types of zones

ZonePurpose
Security zoneNormal zone for transit traffic; used in policies
Functional zone managementInterfaces used only for managing the device; no transit traffic and no policies
Null zoneWhere every interface without a zone sits; drops all traffic
junos-hostBuilt-in zone that stands for the SRX itself, for policies that control traffic to and from the device

A functional zone is configured under security functional-zone management:

user@srx# set security functional-zone management interfaces ge-0/0/7.0 host-inbound-traffic system-services ssh

Host-inbound-traffic

Host-inbound-traffic lists the services and protocols that the SRX accepts for itself on interfaces of a zone. It has two parts.

PartExamples
system-servicesssh, ping, https, http, snmp, ntp, dhcp, traceroute, ike, all
protocolsospf, bgp, bfd, vrrp, pim, all

The default is nothing. A zone with no host-inbound-traffic drops every packet addressed to the SRX, including ping and routing protocol packets. Transit traffic is not affected, because host-inbound-traffic only controls host-bound traffic.

Packet to the SRXIngress interfacesettingnone setZone settingallowedRouting EngineZone settingnot allowedDropped

Zone level compared with interface level

You can set host-inbound-traffic on the zone or on one interface inside the zone.

user@srx# set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ike
user@srx# set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ping

The interface level overrides the zone level for that interface. The two lists are not merged, so if the interface allows only ike, SSH to that interface is dropped even when the zone allows SSH.

You can also allow everything except a few services:

user@srx# set security zones security-zone trust host-inbound-traffic system-services all
user@srx# set security zones security-zone trust host-inbound-traffic system-services telnet except

Which zone decides

PC1 in zone trust pings 203.0.113.1, the address of the SRX untrust interface. The packet arrives on ge-0/0/1 in zone trust, so the host-inbound-traffic of zone trust decides, not that of zone untrust. The zone that decides is the ingress zone, the zone of the interface the packet arrives on. A host in trust that pings the address of the untrust interface is checked against the trust zone's host-inbound-traffic, because the packet arrived on a trust interface.

TCP reset

By default, the SRX silently drops a non-SYN TCP packet that matches no session. With tcp-rst on the zone, it answers such packets with a TCP reset:

user@srx# set security zones security-zone trust tcp-rst

Monitoring zones

show security zones lists each zone, its interfaces and its policy configurable state. show security zones detail adds more detail per zone.

Exam tip

When a ping to an SRX interface fails but transit traffic works, look at host-inbound-traffic on the ingress interface first, then on its zone. An interface-level entry hides the zone's list.

Common mistakes

Assuming intrazone traffic is permitted. On an SRX, traffic between two interfaces of the same zone needs a policy unless the factory default policy is still there.

Thinking host-inbound-traffic controls transit traffic. It only controls traffic addressed to the SRX; security policies control transit traffic.

Expecting interface and zone settings to add up. The interface list replaces the zone list for that interface.

Allowing OSPF under system-services. Routing protocols go under host-inbound-traffic protocols, not system-services.

Watch out

Enabling a service under system services, such as SSH, does not open it on a revenue port. The ingress zone or interface must also allow it in host-inbound-traffic.

What to remember for the exam

  • Zones hold logical interfaces; one interface belongs to one zone; one zone sits in one routing instance.
  • Interzone and intrazone traffic both need a security policy.
  • Interfaces in no zone are in the null zone and drop traffic.
  • The management functional zone carries no transit traffic and cannot be used in policies.
  • Host-inbound-traffic defaults to nothing; system-services for services, protocols for routing protocols.
  • Interface-level host-inbound-traffic overrides the zone level.
  • The ingress zone decides host-bound traffic, whatever address is targeted.

Check yourself

  • Zone untrust allows SSH and ping, and interface ge-0/0/0.0 in that zone allows only IKE. Is SSH to ge-0/0/0.0 accepted?

    No. The interface setting overrides the zone setting, so only IKE is accepted on that interface.

  • Two hosts on different interfaces of zone trust cannot reach each other. What is missing?

    An intrazone policy from zone trust to zone trust. Without it, the default deny drops the traffic.

  • OSPF on ge-0/0/2.0 will not form an adjacency. Which setting does the zone need?

    host-inbound-traffic protocols ospf on the zone or the interface, because OSPF is host-bound traffic.

Topic 1 of 4 in Junos OS Security Objects

Test yourself on Junos OS Security Objects

The full Juniper JNCIA-SEC JN0-232 question bank has 658 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.