Junos OS Security Objects · Topic 3 of 4

Address Books and Address Objects

Learn SRX address books: the global book, books attached to zones, prefix, range, DNS and wildcard addresses, address sets and the any address entries.

  • 5 min
In a nutshell
  • Address objects live in address books under security address-book; the book named global is visible everywhere.
  • Other address books are attached to zones with attach zone.
  • Global policies can only use objects from the global address book.

What it is

An address object is a named entry for a host, network or range of addresses, such as WEB1 for 10.20.20.10/32. Security policies match source and destination by these names, not by raw IP addresses.

Address objects live in an address book. An address set groups several objects under one name, so a policy can refer to all of them at once.

Address WEB1Address setWEB SERVERSAddress bookglobalPolicydestination address

How it works

The global address book

The address book named global is available to every zone and is the simplest place to define objects.

security {
    address-book {
        global {
            address WEB1 10.20.20.10/32;
            address WEB2 10.20.20.11/32;
            address LAN 10.10.10.0/24;
            address-set WEB-SERVERS {
                address WEB1;
                address WEB2;
            }
        }
    }
}

The same objects in set form:

user@srx# set security address-book global address WEB1 10.20.20.10/32
user@srx# set security address-book global address WEB2 10.20.20.11/32
user@srx# set security address-book global address LAN 10.10.10.0/24
user@srx# set security address-book global address-set WEB-SERVERS address WEB1
user@srx# set security address-book global address-set WEB-SERVERS address WEB2

A policy then uses the names:

user@srx# set security policies from-zone trust to-zone dmz policy LAN-TO-WEB match source-address LAN destination-address WEB-SERVERS application junos-https
user@srx# set security policies from-zone trust to-zone dmz policy LAN-TO-WEB then permit

Address types

TypeSyntax exampleMatches
IP prefixaddress LAN 10.10.10.0/24A host (/32) or a subnet
Rangeaddress POOL range-address 10.10.10.50 to 10.10.10.60Every address in a continuous range
DNS nameaddress PARTNER dns-name partner.example.comThe addresses the name resolves to
Wildcardaddress ROUTERS wildcard-address 10.0.0.1/255.0.0.255Addresses that match on the bits set in the mask

A DNS name entry needs the SRX to resolve the name, so system name-server must be configured. The SRX refreshes the resolved addresses as the DNS records change.

A wildcard address uses a mask whose 1 bits must match and whose 0 bits can be anything. The example matches every address with 10 in the first octet and 1 in the last octet, which a prefix cannot express.

Predefined entries

You do not need to create entries for "all addresses". Every address book already understands:

EntryMatches
anyAny IPv4 or IPv6 address
any-ipv4Any IPv4 address
any-ipv6Any IPv6 address

Address books attached to zones

Besides global, you can create your own address books and attach them to one or more zones. Entries in an attached book can only be used in policies whose zones match the attachment.

user@srx# set security address-book DMZ-BOOK address MAIL1 10.20.20.25/32
user@srx# set security address-book DMZ-BOOK attach zone dmz
BookVisible to
globalEvery zone and global policies
User-defined book attached to a zonePolicies where that zone is the source or destination zone

A zone-based policy can reference addresses from the global book and from a book attached to the policy's zones. A global policy, which may match many zones, can only reference addresses from the global address book.

Policy from trust to dmzsourceGlobal bookor book for trustPolicy from trust to dmzdestinationGlobal bookor book for dmz

Zone-defined address books in older configurations

Older releases defined addresses inside each zone, under security zones security-zone <zone> address-book. You cannot mix these zone-defined books with books under security address-book on the same device. Current designs use security address-book, with global plus attached books where needed.

Address sets

RuleDetail
ContentsAddresses and other address sets from the same address book
NestingAn address set can contain another address set
UseAnywhere a policy accepts an address name
BenefitAdd a server to the set once, and every policy that uses the set covers it

Policies also accept several addresses in one match, for example destination-address [ WEB1 WEB2 ]. Several values of one match condition are combined with OR.

Checking address books

show configuration security address-book lists the books and their entries. To see which policy a given source and destination match, use show security match-policies, covered in the troubleshooting chapter.

Exam tip

Use address sets for any group of servers that more than one policy refers to. When the group changes, you edit one set instead of every policy.

Common mistakes

Referencing an address that is not visible to the policy's zones. An object in a book attached only to dmz cannot be used in a policy from trust to untrust, and the commit fails.

Using an attached book in a global policy. Global policies take addresses from the global address book only.

Forgetting the name server for DNS entries. A dns-name address cannot resolve without system name-server, so the policy matches nothing for it.

Typing raw IP addresses in a policy. Policy match conditions take address book names, or any, any-ipv4 and any-ipv6, not literal prefixes.

Watch out

An address object name must be unique within its address book. Configuring the same name again in one book changes the existing object instead of creating a second one.

What to remember for the exam

  • Address objects live in address books under security address-book; the book named global is visible everywhere.
  • Other address books are attached to zones with attach zone.
  • Global policies can only use objects from the global address book.
  • Address types: prefix, range-address, dns-name and wildcard-address.
  • any, any-ipv4 and any-ipv6 are predefined.
  • Address sets group addresses and can be nested.
  • Policies match on names, not raw IP addresses.

Check yourself

  • Which address book can a global security policy reference?

    Only the global address book, because a global policy is not tied to one zone pair.

  • What does wildcard-address 10.0.0.1/255.0.0.255 match?

    Any address with 10 in the first octet and 1 in the last octet, because only the bits set in the mask must match.

  • A policy from trust to untrust references MAIL1, which exists only in a book attached to zone dmz. What happens at commit?

    The commit fails, because MAIL1 is not visible to the trust or untrust zone.

Topic 3 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.