Professional Documents
Culture Documents
Fortinet Basic and Fundamentals
Fortinet Basic and Fundamentals
Fortinet Basic and Fundamentals
FortiGate Fundamentals
This document describes firewall components, and how to implement firewall policies
on FortiGate units operating in both NAT/Route, and Transparent mode.
This FortiOS Handbook chapter contains the following sections:
The Purpose of a Firewall provides an overview of the FortiGate firewall and its traffic controlling
options.
Life of a Packet describes how a FortiGate unit processes incoming and outgoing network traffic
through its interfaces and firewall policies.
Firewall components describes the FortiGate interfaces, addressing, services and user
configuration that goes into creating a firewall policy.
Firewall Policies describes what policies are, the types of firewall policies and how to configure
and arrange them to ensure proper traffic management.
Troubleshooting describes some common problems and solutions when setting up firewall
policies to manage network traffic.
Concept Example: Small Office Network Protection walks through a small office configuration of
firewall policies.
Ranging from the FortiGate-30B series for small offices to the FortiGate-5000 series
for large enterprises, service providers and carriers, the FortiGate line combines the FortiOS™
security operating system and latest hardware technologies to provide a comprehensive and
high-performance array of security and networking functions.
This chapter describes the features of the FortiGate firewall that help to protect your network,
and the firewall policies that are the instructions for the FortiGate unit.
Firewall features
The FortiGate unit provides unified threat management by including a rich feature set
to protect your network from unwanted attacks. This section provides an overview of what the
FortiGate unit can protect against. Each of these elements are configured and added to firewall
policies as a means of instructing the FortiGate unit what to do when encountering an security
threat.
Antivirus
Antivirus is a group of features that are designed to prevent unwanted and
potentially malicious files from entering your network. These features all work in different ways,
whether by checking for a file size, name, type, or the presence of a virus or grayware
signature.
The antivirus scanning routines used are designed to share access to the network traffic. This
way, each individual feature does not have to examine the network traffic as a separate
operation, reducing overhead significantly. For example, if you enable file filtering and virus
scanning, the resources used to complete these tasks are only slightly greater than enabling
virus scanning alone. Two features do not require twice the resources.
Antivirus scanning function includes various modules and engines that perform separate tasks.
The FortiGate unit performs antivirus processing in the following order:
•File size
•File pattern
•File type
•Virus scan
•Grayware
•Heuristics
If a file fails any of the tasks of the antivirus scan, no further scans are performed. For example,
if the file “fakefile.exe” is recognized as a blocked pattern, the FortiGate unit will send the
recipient a message informing them that the original message had a virus, and the file will be
deleted or quarantined. The virus scan, grayware, heuristics, and file type scans will not be
performed as the file is already been determined to be a threat and has been dealt with.
Web Filtering
Web filtering is a means of controlling the content that an Internet user is able to
view. With the popularity of web applications, the need to monitor and control web access is
becoming a key component of Secure Content Management systems that employ antivirus, web
filtering, and messaging security.
As the number and severity of threats increase on the web, the risk potential is increasing within
a company's network as well. Casual non-business related web surfing has caused many
businesses countless hours of legal litigation as hostile environments have been created by
employees who download and view offensive content.web-based attacks and threats are also
becoming increasingly sophisticated. New threats and web-based applications that are causing
additional problems for corporations include:
•Spyware/Grayware
•Phishing
•Instant Messaging
•Peer-to-Peer File Sharing
•Streaming Media
•Blended Network Attacks
The FortiGate data leak prevention (DLP) system allows you to prevent sensitive
data from leaving your network. When you define sensitive data patterns, data matching these
patterns will be blocked, logged, and archived, or any combination of these three actions, when
passing through the FortiGate unit. You configure the DLP system by creating individual rules,
combining the rules into DLP sensors, and then assigning a sensor to a firewall policy.
Although the primary use of the DLP feature is to stop sensitive data from leaving
your network, it can also be used to prevent unwanted data from entering your network and to
archive some or all of the content passing through the FortiGate unit.
DLP examines network traffic for data patterns you specify. You define whatever
patterns you want the FortiGate unit to look for in network traffic. The DLP feature is broken
down into a number of parts.
Application control
Using the application control UTM feature, your FortiGate unit can detect and take
action against network traffic depending on the application generating the traffic. Application
control is a user-friendly and powerful way to use Intrusion Protection features to log and
manage the behavior of application traffic passing through the FortiGate unit. Application control
uses IPS protocol decoders that can analyze network traffic to detect application traffic even if
the traffic uses non-standard ports or protocols.
The FortiGate unit can recognize the network traffic generated by a large number
of applications. You can create application control lists that specify the action to take with the
traffic of the applications you need to manage and the network on which they are active, and
then add application control lists to the firewall policies that control the network traffic you need
to monitor.
Spyware/Grayware
Phishing
Phishing is the term used to describe social engineering attacks that use web technology to
trick users into revealing personal or financial information. Phishing attacks use web sites and
emails that claim to be from legitimate financial institutions to trick the viewer into believing that
they are legitimate. Although phishing is initiated by spam email, getting the user to access the
attacker’s web site is always the next step.
Pharming
Pharming is a next generation threat that is designed to identify, and extract financial,
and other key pieces of information for identity theft. Pharming is much more dangerous than
Phishing because it is designed to be completely hidden from the end user. Unlike phishing
attacks that send out spam email requiring the user to click to a fraudulent URL, Pharming
attacks require no action from the user outside of their regular web surfing activities. Pharming
attacks succeed by redirecting users from legitimate web sites to similar fraudulent web sites
that have been created to look and feel like the authentic web site.
Instant messaging
Instant Messaging presents a number of problems. Instant Messaging can be used to infect
computers with spyware and viruses. Phishing attacks can be made using Instant Messaging.
There is also a danger that employees may use instant messaging to release sensitive
information to an outsider.
Peer-to-peer
Peer-to-Peer networks are used for file sharing. Such files may contain viruses. Peer-to-Peer
applications take up valuable network resources and lower employee productivity but also has
legal implications with the downloading of copyrighted material. Peer-to-Peer file sharing and
applications can also be used to expose company secrets.
Streaming media
Streaming media is a method of delivering multimedia, usually in the form of audio or video to
Internet users. The viewing of streaming media has increased greatly in the past few years.
The problem with this is the way it impacts legitimate business.
Antispam/Email Filter
The FortiGate unit performs email filtering (formerly called antispam) for IMAP, POP3,
and SMTP email. Email filtering includes both spam filtering and filtering for any words or files
you want to disallow in email messages. If your FortiGate unit supports SSL content scanning
and inspection you can also configure spam filtering for IMAPS, POP3S, and SMTPS email
traffic.
You can configure the FortiGate unit to manage unsolicited commercial email by detecting and
identifying spam messages from known or suspected spam servers. The FortiGuard Antispam
Service uses both a sender IP reputation database and a spam signature database, along with
sophisticated spam filtering tools, to detect and block a wide range of spam messages. Using
FortiGuard Antispam protection profile settings you can enable IP address checking, URL
checking, E-mail checksum check, and Spam submission. Updates to the IP reputation and
spam signature databases are provided continuously via the global FortiGuard distribution
network.
From the FortiGuard Antispam Service page in the FortiGuard center you can use IP and
signature lookup to check whether an IP address is blacklisted in the FortiGuard antispam IP
reputation database, or whether a URL or email address is in the signature database.
The FortiGate unit queries the FortiGuard Antispam service to determine if any URL in
the message body is associated with spam. If any URL is blacklisted, the FortiGate unit
determines that the email message is spam.
The FortiGate unit sends a hash of an email to the FortiGuard Antispam server
which compares the hash to hashes of known spam messages stored in the FortiGuard
Antispam database. If the hash results match, the email is flagged as spam.
The FortiGate unit compares the IP address of the client delivering the email to the addresses
in the IP address black/white list specified in the protection profile. If a match is found, the
FortiGate unit will take the action configured for the matching black/white list entry against all
delivered email.
The FortiGate unit takes the domain name specified by the client in the HELO greeting sent
when starting the SMTP session, and does a DNS lookup to determine if the domain exists. If
the lookup fails, the FortiGate unit determines that any messages delivered during the SMTP
session are spam.
The FortiGate unit compares the sender email address, as shown in the message envelope
MAIL FROM, to the addresses in the email address black/white list specified in the protection
profile. If a match is found, the FortiGate unit will take the action configured for the matching
black/white list entry.
The FortiGate unit performs a DNS lookup on the reply-to domain to see if there is an A or MX
record. If no such record exists, the message is treated as spam.
The FortiGate unit will block email messages based on matching the content of the message
with the words or patterns in the selected spam filter banned word list.
For more information on FortiGate antispam processes, features and configuration,
see the UTM chapter.
Intrusion Protection
The FortiGate Intrusion Protection system combines signature detection and prevention with
low latency and excellent reliability. With intrusion Protection, you can create multiple IPS
sensors, each containing a complete configuration based on signatures. Then, you can apply
any IPS sensor to each protection profile. The FortiGate intrusion protection system protects
your network from outside attacks. Your FortiGate unit has two techniques to deal with these
attacks.
Anomaly-based defense is used when network traffic itself is used as a weapon. A host can be
flooded with far more traffic than it can handle, making the host inaccessible. The most
common example is the denial of service attack, in which an attacker directs a large number of
computers to attempt normal access of the target system. If enough access attempts are
made, the target is overwhelmed and unable to service genuine users. The attacker does not
gain access to the target system, but it is not accessible to anyone else. The FortiGate unit
DoS feature will block traffic over a certain threshold from the attacker, allowing connections
from other legitimate users.
Signature-based defense is used against known attacks or vulnerability exploits. These often
involve an attacker attempting to gain access to your network. The attacker must communicate
with the host in an attempt to gain access, and this communication will include particular
commands or sequences of commands and variables. The IPS signatures include these
command sequences, allowing the FortiGate unit to detect and stop the attack.
The basis of signature-based intrusion protection are the IPS signatures, themselves. Every
attack can be reduced to a particular string of commands or a sequence of commands and
variables. Signatures include this information so your FortiGate unit knows what to look for in
network traffic.
Before examining network traffic for attacks, the FortiGate will identify each protocol appearing
in the traffic. Attacks are protocol-specific so your FortiGate unit conserves resources by
looking for attacks only in the protocols used to transmit them. For example, the FortiGate unit
will only examine HTTP traffic for the presence of a signature describing an HTTP attack.
Once the protocol decoders separate the network traffic by protocol, the IPS engine examines
the network traffic for the attack signatures.
The IPS engine does not examine network traffic for all signatures, however. You must first
create an IPS sensor and specify which signatures are included. You do not have to choose
each signature you want to include individually, however. Instead, filters are used to define the
included signatures.
IPS sensors contain one or more IPS filters. A filter is simply a collection of signature attributes
you specify. The signatures that have all of the attributes specified in a filter are included in the
IPS signature.
For example, if your FortiGate unit protects a Linux server running the Apache web
server software, you could create a new filter to protect it. Set OS to Linux,
and Application to Apache and the filter will include only the signatures applicable to both Linux
and Apache. If you wanted to scan for all the Linux signatures and all the Apache signatures,
you would create two filters, one for each.
For more information on FortiGate IPS processes, features and configuration, see
the UTM chapter.
Traffic Shaping
Traffic shaping, when included in a firewall policy, controls the bandwidth available to, and sets
the priority of the traffic processed by, the policy. Traffic shaping makes it possible to control
which policies have the highest priority when large amounts of data are moving through the
FortiGate unit. For example, the policy for the corporate web server might be given higher
priority than the policies for most employees’ computers. An employee who needs extra high
speed Internet access could have a special outgoing policy set up with higher bandwidth.
Traffic shaping is available for firewall policies whose Action is ACCEPT, IPSEC, or SSLVPN. It
is also available for all supported services, including H.323, TCP, UDP, ICMP, and ESP
Traffic shaping cannot increase the total amount of bandwidth available, but you can use it to
improve the quality of bandwidth-intensive and sensitive traffic.
The bandwidth available for traffic set in a traffic shaper is used to control data sessions for
traffic in both directions. For example, if guaranteed bandwidth is applied to an internal and an
external FTP policy, and a user on an internal network uses FTP to put and get files, both the
put and get sessions share the bandwidth available to the traffic controlled by the policy.
Once included in a firewall policy, the guaranteed and maximum bandwidth is the
total bandwidth available to all traffic controlled by the policy. If multiple users start multiple
communications session using the same policy, all of these communications sessions must
share from the bandwidth available for the policy.
However, bandwidth availability is not shared between multiple instances of using the same
service if these multiple instances are controlled by different policies. For example, you can
create one FTP policy to limit the amount of bandwidth available for FTP for one network
address and create another FTP policy with a different bandwidth availability for another
network address
A basic traffic shaping approach is to prioritize certain traffic flows over other traffic
whose potential discarding is less advantageous. This would mean that you accept sacrificing
certain performance and stability on low-priority traffic, in order to increase or guarantee
performance and stability to high-priority traffic.
If, for example, you are applying bandwidth limitations to certain flows, you must accept the fact
that these sessions can be limited and therefore negatively impacted. Traffic shaping applied to
a firewall policy is enforced for traffic which may flow in either direction. Therefore a session
which may be set up by an internal host to an external one, through an Internal-to-External
policy, will have traffic shaping applied even if the data stream flows external to internal. One
example may be an FTP “get” or a SMTP server connecting to an external one, in order to
retrieve email.
Note that traffic shaping is effective for normal IP traffic at normal traffic rates. Traffic shaping is
not effective during periods when traffic exceeds the capacity of the FortiGate unit. Since
packets must be received by the FortiGate unit before they are subject to traffic shaping, if the
FortiGate unit cannot process all of the traffic it receives, then dropped packets, delays, and
latency are likely to occur.
For more information on traffic shaping, see the Traffic Shaping chapter.
NAT mode
In NAT mode, the FortiGate unit is visible to the network that it is connected to. All of
its interfaces are on different subnets. Each interface that is connected to a network must be
configured with an IP address that is valid for that subnetwork.
You would typically use NAT mode when the FortiGate unit is deployed as a gateway between
private and public networks. In its default NAT mode configuration, the FortiGate unit functions
as a firewall. Firewall policies control communications through the FortiGate unit to both the
Internet and between internal networks. In NAT mode, the FortiGate unit performs network
address translation before IP packets are sent to the destination network. For example, a
company has a FortiGate unit as their interface to the Internet. The FortiGate unit also acts as
a router to multiple sub-networks within the company.
Figure 20:
Sender’s IP internal address translated to the FortiGate unit’s external address
When the web server sends the response, it sends it to what it believes to be the originating
address, the FortiGate wan1 address, 172.20.120.129. When the FortiGate unit receives the
information, it determines where it should go by looking at its session information. Using
firewall policies, it determines that the information should be going to the originating user at
10.10.10.2. The FortiGate changes the destination IP to the correct user and delivers the
packet.
Figure 21:
Web server sends to FortiGate external address and translated to internal address
Throughout this exchange, which occurs in nanoseconds, and because of network address
translation, the web server does not know that the originating address is really 10.10.10.2, but
172.20.120.129.
Transparent mode
In Transparent mode, the FortiGate unit is invisible to the network. All of its interfaces are on
the same subnet and share the same IP address. You only have to configure a management IP
address so that you can make configuration changes.
You would typically use the FortiGate unit in Transparent mode on a private network behind an
existing firewall or behind a router. In Transparent mode, the FortiGate unit also functions as a
firewall. Firewall policies control communications through the FortiGate unit to the Internet and
internal network. No traffic can pass through the FortiGate unit until you add firewall policies.
For example, the company has a router or other firewall in place. The network is simple enough
that all users are on the same internal network. They need the FortiGate unit to perform
antispam, antivirus and intrusion protection and similar traffic scanning. In this situation, as
shown in Figure 22, the FortiGate unit is set to transparent mode. The traffic passing through
the FortiGate unit does not change the addressing from the router to the internal network.
Firewall policies and protection profiles define the type of scanning the FortiGate unit performs
on traffic entering the network.
By default when shipped, the FortiGate unit operates in NAT mode. To use the FortiGate unit in
Transparent mode, you need to switch its mode. When switched to a different mode, the
FortiGate unit does not need to be restarted; the change is automatic.
In the following example, the steps change the FortiGate unit to Transparent mode with an IP
of 10.11.101.10, netmask of 255.255.255.0 and a default gateway of 10.11.101.1
To enable Transparent mode - web-based manager
To enable Transparent mode - CLI
config system settings
set opmode transparent
set manageip 10.11.101.10 255.255.255.0
set gateway 10.11.101.1
end
For information on unique Transparent mode firewall configurations, see “Advanced firewall
concepts”.
Note: This guide and its examples are constructed with the FortiGate unit
running in NAT mode, unless otherwise noted.
Operating mode differences
The FortiGate unit, running in either NAT or Transparent mode have essentially the
same feature set. Due to the differences in the modes, however, some features are not
available in Transparent mode. The list below outlines the key features not available in
Transparent mode:
Life of a Packet
Directed by firewall policies, a FortiGate unit screens network traffic from the IP layer
up through the application layer of the TCP/IP stack. This chapter provides a general,
high-level description of what happens to a packet as it travels through a FortiGate security
system.
Stateful inspection
With stateful inspection, the FortiGate unit looks at the first packet of a session to make
a security decision. Common fields inspected include TCP SYN and FIN flags to identity the
start and end of a session, the source/destination IP, source/destination port and protocol.
Other checks are also performed on the packed payload and sequence numbers to verify it as
a valid communication and that the data is not corrupted or poorly formed.
The FortiGate unit makes the decision to drop, pass or log a session based on what is found
in the first packet of the session. If the FortiGate unit decides to drop or block the first packet
of a session, then all subsequent packets in the same session are also dropped or blocked
without being inspected. If the FortiGate unit accepts the first packet of a session, then all
subsequent packets in the same session are also accepted without being inspected.
Proxy inspection examines the content contained a content protocol session for
security threats. Content protocols include the HTTP, FTP, and email protocols. Security
threats can be found in files and other content downloaded using these protocols. With proxy
inspection, the FortiGate unit downloads the entire payload of a content protocol sessions and
re-constructs it. For example, proxy inspection can reconstruct an email message and its
attachments. After a satisfactory inspection the FortiGate unit passes the content on to the
client. If proxy inspection detects a security threat in the content, the content is removed from
the communication stream before the it reaches its destination. For example, if proxy
inspection detects a virus in an email attachment, the attachment is removed from the email
message before its sent to the client. Proxy inspection is the most thorough inspection of all,
although it requires more processing power, and this may result in lower performance.
If you enable ICAP in a firewall policy, HTTP traffic intercepted by the policy is transferred to
the ICAP servers in the ICAP profile added to the policy. The FortiGate unit is the surrogate, or
“middle-man”, and carries the ICAP responses from the ICAP server to the ICAP client; the
ICAP client then responds back, and the FortiGate unit determines the action that should be
taken with these ICAP responses and requests.
IPsec VPN
Traffic Shaping
User Authentication
Management Traffic
SSL VPN
Intrusion Prevention
Flow-based Antivirus
Application Control
VoIP inspection
Proxy Antivirus
Email Filtering
Packet flow
After the FortiGate unit’s external interface receives a packet, the packet proceeds through a
number of steps on its way to the internal interface, traversing each of the inspection types,
depending on the firewall policy and UTM profile configuration. The diagram in Figure 26 is a
high level view of the packet’s journey.
The description following is a high-level description of these steps as a packet enters
the FortiGate unit towards its destination on the internal network. Similar steps occur for
outbound traffic.
DoS sensor
DoS scans are handled very early in the life of the packet to determine whether the traffic is
valid or port of a DoS attack. Unlike signature-based IPS which inspects all the packets within
a certain traffic flow, the DoS module inspects all traffic flows but only tracks packets that can
be used for DoS attacks (for example TCP SYN packets), to ensure they are within the
permitted parameters. Suspected DoS attacks are blocked, other packets are allowed.
Routing
The routing step determines the outgoing interface to be used by the packet as it leaves the
FortiGate unit. In the previous step, the FortiGate unit determined the real destination address,
so it can now refer to its routing table and decide where the packet must go next.
Routing also distinguishes between local traffic and forwarded traffic and selects the source
and destination interfaces used by the firewall policy engine to accept or deny the packet.
Policy lookup
The policy look up is where the FortiGate unit reviews the list of firewall policies which govern
the flow of network traffic, from the first entry to the last, to find a match for the source and
destination IP addresses and port numbers. The decision to accept or deny a packet, after
being verified as a valid request within the stateful inspection, occurs here. A denied packet is
discarded. An accepted packet will have further actions taken. If IPS is enabled, the packet will
go to Flow-based inspection engine, otherwise it will go to the Proxy-based inspection engine.
If no other UTM options are enabled, then the session was only subject to stateful inspection.
If the action is accept, the packet will go to Source NAT to be ready to leave the FortiGate unit.
Session tracking
Part of the stateful inspection engine, session tracking maintains session tables that maintain
information about sessions that the stateful inspection module uses for maintaining sessions,
NAT, and other session related functions.
User authentication
User authentication added to firewall policies is handled by the stateful inspection
engine, which is why Firewall authentication is based on IP address. Authentication takes
place after policy lookup selects a firewall policy that includes authentication. This is also
known as identify-based policies. Authentication also takes place before UTM features are
applied to the packet.
Management traffic
This local traffic is delivered to the FortiGate unit TCP/IP stack and includes communication
with the web-based manager, the CLI, the FortiGuard network, log messages sent to
FortiAnalyzer or a remote syslog server, and so on. Management traffic is processed by
applications such as the web server which displays the FortiOS web-based manager, the SSH
server for the CLI or the FortiGuard server to handle local FortiGuard database updates or
FortiGuard Web Filtering URL lookups.
Session helpers
Some protocols include information in the packet body (or payload) that must be analyzed to
successfully process sessions for this protocol. For example, the SIP VoIP protocol uses TCP
control packets with a standard destination port to set up SIP calls. To successfully process
SIP VoIP calls, FortiOS must be able to extract information from the body of the SIP packet
and use this information to allow the voice-carrying packets through the firewall.
FortiOS uses session helpers to analyze the data in the packet bodies of some protocols and
adjust the firewall to allow those protocols to send packets through the firewall.
Once the packet has passed the flow-based engine, it can be sent to the proxy
inspection engine or egress.
IPsec
If the packet is transmitted through an IPsec tunnel, it is at this stage the encryption
and required encapsulation is performed. For non-IPsec traffic (TCP/UDP) this step is
bypassed.
Source NAT (SNAT)
When preparing the packet to leave the FortiGate unit, it needs to NAT the source address of
the packet to the external interface IP address of the FortiGate unit. For example, a packet
from a user at 192.168.1.1 accessing www.example.com is now using a valid external IP
address as its source address.
Routing
The final routing step determines the outgoing interface to be used by the packet as it leaves
the FortiGate unit.
Egress
Upon completion of the scanning at the IP level, the packet exits the FortiGate unit.
Firewall components
The FortiGate unit’s primary purpose is to act as a firewall to protect your networks
from unwanted attacks and to control the flow of network traffic. The FortiGate unit does this
through the use of firewall policies. The policies you create review the traffic passing through
the device to determine if the traffic is allowed into or out of the network, if it is normal network
traffic or encrypted VPN or SSL VPN traffic, where it is going and how it should be handled.
Every firewall policy uses similar components. This section briefly describes
these components.
The following topics are included in this section:
•Interfaces
•Addressing
•Ports
•Services
•Schedules
•UTM profiles
Interfaces
Interfaces, both physical and virtual, enable traffic to flow to and from the internal network, and
the Internet and between internal networks. The FortiGate unit has a number of options for
setting up interfaces and groupings of subnetworks that can scale to a company’s growing
requirements.
Physical
FortiGate units have a number of physical ports where you connect Ethernet or optical cables.
Depending on the model, they can have anywhere from four to 40 physical ports. Some units
have a grouping of ports labelled as internal, providing a built-in switch functionality.
In FortiOS, the port names, as labeled on the FortiGate unit, appear in the web-
based manager in the Unit Operation the Dashboard. They also appear when you are
configuring the interfaces, by going to System > Network > Interface. As shown below, the
FortiGate-60C has eight interfaces
Administrative access
Interfaces, especially the public
public-facing
facing ports can be potentially accessed by those who you
may not want access to the FortiGate unit. When setting up the FortiGate unit, you can set the
type of protocol an administrator must use to access the FortiGate unit. The options include:
•HTTPS
•HTTP
•SSH
•TELNET
•PING
•SNMP
You can select as many,
any, or as few, even none, that are accessible by an administrator.
Example
This example adds an IPv4 address 172.20.120.100 to the WAN1 interface as well as
the administrative access to HTTPS and SSH. As a good practice, set the administrative
access whenn you are setting the IP address for the port.
To add an IP address on the WAN1 interface - web-based manager
To create IP address on the WAN1 interface - CLI
config system interface
edit wan1
set ip 172.20.120.100/24
set allowaccess https ssh
end
Note: When adding to, or removing a protocol, you must type the entire
list again. For example, if you have an access list of HTTPS and SSH,
and you want to add PING, typing:
Wireless
Virtual domains
Virtual domains (VDOMs) are a method of dividing a FortiGate unit into two or more
virtual units that function as multiple independent units. A single FortiGate unit is then flexible
enough to serve multiple departments of an organization, separate organizations, or to act as
the basis for a service provider’s managed security service.
VDOMs provide separate security domains that allow separate zones, user
authentication, firewall policies, routing, and VPN configurations. By default, each FortiGate
unit has a VDOM named root. This VDOM includes all of the FortiGate physical interfaces,
modem, VLAN subinterfaces, zones, firewall policies, routing settings, and VPN settings.
When a packet enters a VDOM, it is confined to that VDOM. In a VDOM, you can
create firewall policies for connections between Virtual LAN (VLAN) subinterfaces or zones in
the VDOM. Packets do not cross the virtual domain border internally. To travel between
VDOMs, a packet must pass through a firewall on a physical interface. The packet then arrives
at another VDOM on a different interface, but it must pass through another firewall before
entering the VDOM. Both VDOMs are on the same FortiGate unit. Inter-VDOMs change this
behavior in that they are internal interfaces; however their packets go through all the same
security measures as on physical interfaces.
Example
This example shows how to enable VDOMs on the FortiGate unit and the basic and create a
VDOM accounting on the DMZ2 port and assign an administrator to maintain the VDOM. First
enable Virtual Domains on the FortiGate unit. When you enable VDOMs, the FortiGate unit will
log you out.
Example
This example shows how to add a VLAN, vlan_accounting on the FortiGate unit
internal interface with an IP address of 10.13.101.101.
You can configure policies for connections to and from a zone, but not between interfaces in a
zone. Using the above example, you can create a firewall policy to go between zone 1 and
zone 3, but not between WAN2 and WAN1, or WAN1 and DMZ1.
Example
This example explains how to set up a zone on the FortiGate unit to include the
Internal interface and a VLAN.
To create a zone - web-based manager
1Go to System > Network > Interface.
2Select the arrow on the Create New button and select Zone.
3Enter a zone name of Zone_1.
Select the Internal interface and the virtual LAN interface vlan_accounting from the previous
4section.
5Select OK.
To create a zone - CLI
config system zone
edit Zone_1
set interface internal VLAN_1
end
its with continuous IP addresses in a subnet, such as 192.168.1.[2-10], or 192.168.1.* to
indicate the complete range of hosts on that subnet. Valid IP Range formats include:
•x.x.x.x-x.x.x.x, such as 192.168.110.100-192.168.110.120
•x.x.x.[x-x], such as 192.168.110.[100-120]
•x.x.x.*, such as 192.168.110.*
When representing hosts by a FQDN, the domain name can be a subdomain, such
as mail.example.com. A single FQDN firewall address may be used to apply a firewall policy to
multiple hosts, as in load balancing and high availability (HA) configurations. FortiGate units
automatically resolve and maintain a record of all addresses to which the FQDN resolves.
Valid FQDN formats include:
<host_name>.<second_level_domain_name>.<top_level_domain_name>,
•such as mail.example.com
•<host_name>.<top_level_domain_name>
Example
This example adds an IPv4 firewall address for guest users of 10.13.101.100 address
the port1 interface.
To add a firewall IP address to the port1 interface - web-based manager
1Go to Firewall > Address > Address and select Create New.
2For the Address Name, enter Guest.
3Leave the Type as Subnet/IP Range.
4Enter the IP address of 10.13.101.100/24.
5For the Interface, select port1.
6Select OK.
To add a firewall IP address to the port1 interface- CLI
config firewall address
edit Guest
set type ipmask
set subnet 10.13.101.100/24
set associated-interface port1
end
Example
This example adds an IPv4 firewall address range for guest users with the range
of 10.13.101.100 to 10.13.101.110 addresses on any interface. By setting the interface to Any,
the address range is not bound to a specific interface on the FortiGate unit.
To add a firewall IP address to the port1 interface - web-based manager
1Go to Firewall > Address > Address and select Create New.
2For the Address Name, enter Guest.
3Leave the Type as Subnet/IP Range.
4Enter the IP address range of 10.13.101.[100-110].
5For the Interface, select Any.
6Select OK.
To add a firewall IP address to the port1 interface - CLI
config firewall address
edit Guest
set type iprange
set start-ip 10.13.101.100
set end-ip 10.13.101.110
end
Based on the binary mask, it can be seen that the first three octets of the address must match
the given binary network address exactly (00000001.00000001.00000001). The last set of
numbers is made of “don't cares” (all ones). As such, all traffic that begins with 1.1.1. matches
since the last octet o the netmask is “don't care”. All IP addresses 1.1.1.1 through 1.1.1.255
are acceptable.
Wildcard masks are configured in the CLI:
config firewall address
set type wildcard
set wildcard 1.1.1.0/0.0.0.255
end
Virtual IPs
Virtual IP addresses (VIPs) can be used when configuring firewall policies to translate
IP addresses and ports of packets received by a network interface. When the FortiGate unit
receives inbound packets matching a firewall policy whose Destination Address field is a
virtual IP, the FortiGate unit applies NAT, replacing packets’ IP addresses with the virtual IP’s
mapped IP address.
IP pools, similarly to virtual IPs, can be used to configure aspects of NAT; however, IP pools
configure dynamic translation of packets’ IP addresses based on
the Destination Interface/Zone, whereas virtual IPs configure dynamic or static translation of a
packets’ IP addresses based upon the Source Interface/Zone.
To implement the translation configured in the virtual IP or IP pool, you must add it to a NAT
firewall policy.
Note: In Transparent mode, from the CLI, you can configure NAT firewall
policies that include Virtual IPs and IP pools. For more information, see
the System Administration chapter of The Handbook.
Virtual IPs can specify translations of packets’ port numbers and/or IP addresses for
both inbound and outbound connections. In Transparent mode, virtual IPs are available from
the FortiGate CLI.
Example
This simple example adds a virtual IP of 10.13.100.1 that allows users on the Internet
to connect to a web server on the DMZ IP address of 192.168.1.1. In the example, the wan1
interface of the FortiGate unit is connected to the Internet and the dmz1 interface is connected
to the DMZ network.
To add a static NAT virtual IP for a single IP address - web-based manager
1Go to Firewall > Virtual IP > Virtual IP and select Create New.
2For the Name, enter Static_NAT.
3Select the External interface of wan1
4Enter the External IP Address of 10.13.100.1.
5Enter the Mapped IP Address of 192.168.1.1.
6Select OK.
To add a static NAT virtual IP for a single IP address - CLI
config firewall vip
edit Static_NAT
set extintf wan1
set extip 10.13.100.1
set mappedip 192.168.1.1
end
Inbound connections
Virtual IPs can be used in conjunction with firewall policies whose Action is not DENY to apply
bidirectional NAT, also known as inbound NAT.
When comparing packets with the firewall policy list to locate a matching policy, if a
firewall policy’s Destination Address is a virtual IP, FortiGate units compare a packets’
destination address to the virtual IP’s external IP address. If they match, the FortiGate unit
applies the virtual IP’s inbound NAT mapping, which specifies how the FortiGate unit
translates network addresses and/or port numbers of packets from the receiving (external)
network interface to the network interface connected to the destination (mapped) IP address
or IP address range.
Virtual IP options
The following table describes combinations of PAT and/or NAT that are possible
when configuring a firewall policy with a virtual IP.
Depending on your configuration of the virtual IP, its mapping may involve port address
translation (PAT), also known as port forwarding or network address port translation (NAPT),
and/or network address translation (NAT) of IP addresses.
If you configure NAT in the virtual IP and firewall policy, the NAT behavior varies by
your selection of:
Static NAT with Port Static, one-to-one NAT mapping with port forwarding: an external IP
Forwarding address is always translated to the same mapped IP address, and
an external port number is always translated to the same mapped
port number.
A typical example of static NAT is to allow client access from a public network to a web server
on a private network that is protected by a FortiGate unit. Reduced to its essence, this
example involves only three hosts, as shown in Figure 35: the web server on a private
network, the client computer on another network, such as the Internet, and the FortiGate unit
connecting the two networks.
When a client computer attempts to contact the web server, it uses the virtual IP on
the FortiGate unit’s external interface. The FortiGate unit receives the packets. The addresses
in the packets are translated to private network IP addresses, and the packet is forwarded to
the web server on the private network.
The packets sent from the client computer have a source IP of 192.168.37.55 and
a destination IP of 192.168.37.4. The FortiGate unit receives these packets at its external
interface, and matches them to a firewall policy for the virtual IP. The virtual IP settings map
192.168.37.4 to 10.10.10.42, so the FortiGate unit changes the packets’ addresses. The
source address is changed to 10.10.10.2 and the destination is changed to 10.10.10.42. The
FortiGate unit makes a note of this translation in the firewall session table it maintains
internally. The packets are then sent on to the web server.
Figure 36: Example of packet address remapping during NAT from client to server
Note that the client computer’s address does not appear in the packets the server receives.
After the FortiGate unit translates the network addresses, there is no reference to the client
computer’s IP address, except in its session table. The web server has no indication that
another network exists. As far as the server can tell, all packets are sent by the FortiGate unit.
When the web server replies to the client computer, address translation works similarly, but in
the opposite direction. The web server sends its response packets having a source IP address
of 10.10.10.42 and a destination IP address of 10.10.10.2. The FortiGate unit receives these
packets on its internal interface. This time, however, the session table is used to recall the
client computer’s IP address as the destination address for the address translation. In the
reply packets, the source address is changed to 192.168.37.4 and the destination is changed
to 192.168.37.55. The packets are then sent on to the client computer.
The web server’s private IP address does not appear in the packets the client receives. After
the FortiGate unit translates the network addresses, there is no reference to the web server’s
network. The client has no indication that the web server’s IP address is not the virtual IP. As
far as the client is concerned, the FortiGate unit’s virtual IP is the web server.
Figure 37: Example of packet address remapping during NAT from server to client
In the previous example, the NAT check box is checked when configuring the firewall policy. If
the NAT check box is not selected when building the firewall policy, the resulting policy does
not perform full NAT; instead, it performs destination network address translation (DNAT).
For inbound traffic, DNAT translates packets’ destination address to the mapped private
IP address, but does not translate the source address. The web server would be aware of the
client’s IP address. For reply traffic, the FortiGate unit translates packets’ private network
source IP address to match the destination address of the originating packets, which is
maintained in the session table.
Outbound connections
Virtual IPs can also affect outbound NAT, even though they are not selected in an outbound
firewall policy. If no virtual IPs are configured, FortiGate units apply traditional outbound NAT
to connections outbound from private network IP addresses to public network IP addresses.
However, if virtual IP configurations exist, FortiGate units use virtual IPs’ inbound NAT
mappings in reverse to apply outbound NAT, causing IP address mappings for both inbound
and outbound traffic to be symmetric.
For example, if a network interface’s IP address is 10.10.10.1, and its bound virtual
IP’s external IP is 10.10.10.2, mapping inbound traffic to the private network IP address
192.168.2.1, traffic outbound from 192.168.2.1 will be translated to 10.10.10.2, not 10.10.10.1.
Note: A virtual IP setting with port forwarding enabled does not translate the source address of
outbound traffic. If both virtual IP (without port forwarding) and IP Pools are enabled, IP Pools is
preferred for source address translation of outbound traffic.
Address groups
Example
This example creates an address group accounting, where addresses for User_1
and User_2 have port association of Any. It is recommended to add the addresses
you want to add to the group before setting up the address group.
To create an address group - web-based manager
1Go to Firewall > Address > Group, and select Create New.
2Enter the Group Name of accounting.
From the Available Addresses list, select an address and select the down-arrow
3button to move the address name to the Members list.
Repeat step three as many times as required. You can also hold the SHIFT key
4to select a range of address names from the list.
5Select OK.
To create an address group - CLI
config firewall addrgrp
edit accounting
set member User_1
set member User_2
end
DHCP
The Dynamic Host Configuration Protocol (DHCP) enables hosts to automatically
obtain an IP address from a DHCP server. Optionally, hosts can also obtain
default gateway and DNS server settings.
Note: DHCP is not available when the FortiGate unit is operating in
Transparent mode.
DHCP options
When adding a DHCP server, you have the ability to include DHCP codes and
options. The DHCP options are BOOTP vendor information fields that provide
additional vendor-independent configuration parameters to manage the DHCP
server. For example, you may need to configure a FortiGate DHCP server that
gives out a separate option as well as an IP address. For example, an
environment that needs to support PXE boot with Windows images.
The option numbers and codes are specific to the particular application.
The documentation for the application will indicate the values to use. Option codes
are represented in a option value/HEX value pairs. The option is a value 1 and
255.
You can add up to three DHCP code/option pairs per DHCP server.
To configure option 252 with value http://192.168.1.1/wpad.dat - web-based
manager
1Go to System > Network > DHCP Server and select Create New.
2Select a Mode of Server.
3Select the blue arrow to expand the Advanced options.
4Select Options.
5Enter a Code of 252.
Enter
6the Options of 687474703a2f2f3139322e3136382e312e312f777061642e646174.
In the CLI, use the commands:
config system dhcp server
edit <dhcp_server_number>
set option1
252 687474703a2f2f3139322e3136382e312e312f777061642e646174
end
Example
This example sets up a DHCP server on the Internal interface for guests with an
IP range of 10.13.101.100 to 10.13.101.110, a default gateway of 10.13.101.2 and
address lease of 5 days.
To configure a DHCP server on the internal interface - web-based manager
1Go to Go to System > Network > DHCP Server and select Create New.
2Select the Interface of Internal.
3Select the Mode of Server.
4Enter the IP Range of 10.13.101.100 to 10.13.101.110.
5Enter a Netmask of 255.255.255.0.
6Enter a Default Gateway of 10.10.101.2.
7Select the blue arrow to expand the Advanced options.
8Set a Lease Time of five days.
9Select OK.
To configure a DHCP server on the internal interface - CLI
config system dhcp server
edit 1
config ip-range
edit 1
set start-ip 10.13.101.100
set end-ip 10.13.101.105
end
set server-type regular
set interface internal
set netmask 255.255.255.0
set default-gateway 10.13.101.2
set lease-time 432000
end
A FortiGate interface can also be configured as a DHCP relay. The interface
forwards DHCP requests from DHCP clients to an external DHCP server and
returns the responses to the DHCP clients. The DHCP server must have
appropriate routing so that its response packets to the DHCP clients arrive at the
FortiGate unit.
Example
This example sets up a DHCP relay on the internal interface from the DHCP
server located at 172.20.120.55. The FortiGate unit will send a request for an IP
address from the defined DHCP server and forward it to the requesting
connection.
IP pools
An IP pool defines a single IP address or a range of IP addresses. A single IP
address in an IP pool becomes a range of one IP address. For example, if you
enter an IP pool as 1.1.1.1, the IP pool is actually the address range, 1.1.1.1 to
1.1.1.1. Use IP pools to add NAT policies that translate source addresses to
addresses randomly selected from the IP pool, rather than the IP address
assigned to that FortiGate interface.
If a FortiGate interface IP address overlaps with one or more IP pool address
ranges, the interface responds to ARP requests for all of the IP addresses in the
overlapping IP pools.
For example, consider a FortiGate unit with the following IP addresses for the
port1 and port2 interfaces:
•port1 IP address: 1.1.1.1/255.255.255.0 (range is 1.1.1.0-1.1.1.255)
•port2 IP address: 2.2.2.2/255.255.255.0 (range is 2.2.2.0-2.2.2.255)
Select NAT in a firewall policy and then select Dynamic IP Pool. Select an IP pool
to translate the source address of packets leaving the FortiGate unit to an address
randomly selected from the IP pool.
IP pools cannot be set up for a zone. IP pools are connected to individual
interfaces.
Example
This example sets up an IP Pool with an address range of 10.13.101.100 to
10.13.101.110 for guest accounts on the network.
To configure an IP Pool - web-based manager
1Go to Firewall > Virtual IP > IP Pool and select Create New.
2Enter the Name of Guest.
3Enter the IP Range/Subnet of 10.13.101.100-10.13.101.110.
4Select OK.
To configure an IP Pool - CLI
config firewall ippool
edit Guest
set startip 10.13.101.100
set endip 10.13.101.110
end
Where IPv4 uses 32 bit addressing, IPv6 uses 128 bit addressing, effectively
providing trillions upon trillions of unique addresses, whereas IPv4 can have a a
little over 4 billion. With this larger address space, allocating addresses and
routing traffic becomes easier, and network address translation (NAT) becomes
virtually unnecessary.
Where IPv4 addresses are written numerals separated by a decimal, the IPv6
address is written with hexadecimal digits separated by a colon. For example,
fe80:218:8bff:fe84:4223.
By default, the FortiGate unit is not enabled to use IPv6 addressing. To enable
this feature, go to System > Admin > Settings and select IPv6 Support on GUI.
When enabled you can use IPv6 addressing on any of the address-dependant
components of the FortiGate unit, including firewall policies, interface addressing,
DNS servers. IPv6 addressing can be configured on the web-based manager and
in the CLI.
For further information on IPV6 in FortiOS, see “IPv6”.
Example
This example adds an IPv6 address 2001:db8:0:1234:0:567:1:1 for the WAN1
interface as well as the administrative access to HTTPS and SSH. As a good
practice, set the administrative access when you are setting the IP address for the
port.
Ports
A port is a type of address used by specific applications and processes. The
FortiGate unit uses a number of port assignments to send and receive information
for basic system operation and communication by default.
Originating traffic
Function Port(s)
DNS lookup; RBL lookup UDP 53
FortiGuard Antispam or Web Filtering rating lookup UDP 53 or
UDP 8888
FDN server list UDP 53 (default)
Source and destination port numbers vary by originating or UDP 8888, and
or reply traffic. UDP 1027 or UDP
1031
NTP synchronization UDP 123
SNMP traps UDP 162
Syslog UDP 514
All FortiOS versions can use syslog to send log
messages to remote syslog servers.
Note: If a secure connection has been configured
between a FortiGate and a FortiAnalyzer, Syslog traffic
will be sent into an IPSec tunnel. Data will be exchanged
over UDP 500/4500, Protocol IP/50.
Configuration backup to FortiManager unit or FortiGuard TCP 22
Analysis and Management Service
SMTP alert email; encrypted virus sample auto-submit TCP 25
LDAP or PKI authentication TCP 389 or TCP 636
FortiGuard Antivirus or IPS update TCP 443
When requesting updates from a FortiManager unit
instead of directly from the FDN, this port must be
reconfigured as TCP 8890.
FortiGuard Analysis and Management Service TCP 443
FortiGuard Analysis and Management Service log TCP 514
transmission (OFTP)
SSL management tunnel to FortiGuard Analysis and TCP 541
Management Service
FortiGuard Analysis and Management Service contract TCP 10151
validation
Quarantine, remote access to logs & reports on a TCP 514
FortiAnalyzer unit, device registration with FortiAnalyzer
units (OFTP)
RADIUS authentication TCP 1812
Receiving traffic
When operating in the default configuration, FortiGate units do not accept TCP or
UDP connections on any port except the default internal interface, which accepts
HTTPS connections on TCP port 443.
Function Port(s)
FortiGuard Antivirus and IPS update push UDP 9443
The FDN sends notice that an update is available. Update
downloads then occur on standard originating ports for updates.
SSH administrative access to the CLI; remote management from TCP 22
a FortiManager unit
Telnet administrative access to the CLI; HA synchronization TCP 23
(FGCP L2)
Changing the telnet administrative access port number also
changes the HA synchronization port number.
HTTP administrative access to the web-based manager TCP 80
HTTPS administrative access to the web-based manager; TCP 443
remote management from a FortiManager unit; user
authentication for policy override
SSL management tunnel from FortiGuard Analysis and TCP 541
Management Service (FortiOS v3.0 MR6 or later)
HA heartbeat (FGCP L2) TCP 703
User authentication keep alive and logout for policy override TCP 1000
(default value of port for HTTP traffic)
This port is closed until enabled by the auth-keepalive command.
User authentication keepalive and logout for policy override TCP 1003
(default value of port for HTTPS traffic)
This port is closed until enabled by the auth-keepalive command.
Windows Active Directory (AD) Collector Agent TCP 8000
User authentication for policy override of HTTP traffic TCP 8008
FortiClient download portal TCP 8009
This feature is available on FortiGate-1000A, FortiGate-3600A,
and
FortiGate-5005FA2.
User authentication for policy override of HTTPS traffic TCP 8010
VPN settings distribution to authenticated FortiClient installations TCP 8900
SSL VPN TCP 10443
HA ETH 8890
(Layer 2)
Port 113
TCP port 113 (Ident/Auth) is an exception to the above rule. By default, FortiGate
units receiving an IDENT request on this port respond with a TCP RST, which
resets the connection. This prevents delay that would normally occur if the
requesting host were to wait for the connection attempt to time out.
This port is less commonly used today. If you do not use this service, you can
make your FortiGate unit less visible to probes. You can disable TCP RST
responses to IDENT requests and subject those requests to firewall policies, and
thereby close this port.
For each network interface that should not respond to ident requests on TCP port
113, enter the following CLI commands:
config system interface
edit <port_name>
set ident-accept enable
end
For example, to disable ident responses on a network interface names port1, enter
the following commands:
config system interface
edit port1
set ident-accept enable
end
Port 541
By default, FortiGate units use this port to initiate an SSL-secured management
tunnel connection to centralized device managers such as the FortiGuard Analysis
and Management Service.
If you do not use centralized management you can make your FortiGate unit less
visible to probes. You can disable the management tunnel feature, and thereby
close this port using the following CLI command:
config sys central-management
set status disable
end
Services
Services represent typical traffic types and application packets that pass through
the FortiGate unit. Firewall services define one or more protocols and port
numbers associated with each service. Firewall policies use service definitions to
match session types. You can organize related services into service groups to
simplify your firewall policy list.
Many well-known traffic types have been predefined in firewall services and
protocols on the FortiGate unit. These predefined services and protocols are
defaults, and cannot be edited or removed. However, if you require different
services, you can create custom services.
To view the predefined servers, go to Firewall > Service > Predefined.
Custom service
Should there be a service that does not appear on the list, or you have a unique
service or situation, you can create your own custom service. You need to know
the port(s), IP addresses or protocols the particular service or application uses to
create the custom service.
Example
This example creates a custom service for the “Widget” application, which
communicates on TCP port 9620 for source traffic and between ports 4545 and
4550 for destination traffic.
To create a custom service - web-based manager
1Go to Firewall > Service > Custom and select Create New.
2Enter the following and select Add:
Name Widget
Protocol Type TCP/UDP/SCTP
Protocol TCP
Source Port
Low 9620
Hi 9620
Destination Port
Low 4545
High 4550
3Select OK.
To create a custom service - CLI
config firewall service custom
edit Widget
set protocol TCP/UDP/SCTP
set tcp-portrange 9620:4545-4550
end
Schedules
When you add firewall policies on a FortiGate unit, those policies are always on,
policing the traffic through the device. Firewall schedules control when policies are
in effect, that is, when they are on. You can create one-time schedules which are
schedules that are in effect only once for the period of time specified in the
schedule. You can also create recurring schedules that are in effect repeatedly at
specified times of specified days of the week.
You can create a recurring schedule that activates a policy during a specified
period of time. For example, you might prevent game playing during office hours
by creating a recurring schedule that covers office hours.
If a recurring schedule has a stop time that is earlier than the start time, the
schedule will take effect at the start time but end at the stop time on the next day.
You can use this technique to create recurring schedules that run from one day to
the next. For example, to prevent game playing except at lunchtime, you might set
the start time for a recurring schedule at 1:00 p.m. and the stop time at 12:00
noon. To create a recurring schedule that runs for 24 hours, set the start and stop
times to 00.
Example
This example creates a schedule for surfing the Internet at lunch time. The
company restricts the amount of surfing on company time, but over lunch, the
restrictions are lifted. For this schedule, a firewall policy would be created to
enable all services for a limited amount of time. This example sets up the time
frame.
Example
This example creates a one-time schedule for a firewall policy. In this example, a
company is shut down over the Christmas holidays. To prevent employees from
coming to work to use the internet connection, the company sets up a one-time
firewall policy to block most internet traffic during this time period. A schedule
needs to be created to limit internet traffic between December 25 and January 1.
To create a one-time firewall schedule - web-based manager
1Go to Firewall > Schedule > One-time, and select Create New.
2Enter the schedule Name of Xmas-Shutdown.
3Enter the following and select OK.
/Start
Year 2009
Month 12
Day 25
Hour 00
Minute 00
Stop
Year 2010
Month 01
Day 01
Hour 23
Minute 00
To create a firewall schedule - CLI
config firewall schedule onetime
edit Xmas-Shutdown
set start 00:00 2009/12/25
set end 23:00 2010/01/01
end
Schedule groups
You can organize multiple firewall schedules into a schedule group to simplify your
firewall policy list. For example, instead of having five identical policies for five
different but related firewall schedules, you might combine the five schedules into
a single schedule group that is used by a single firewall policy.
Schedule groups can contain both recurring and one-time schedules. Schedule
groups cannot contain other schedule groups.
Example
This example creates a schedule group for the schedules created in the
previous schedule examples. The schedule group enables you to have one
firewall policy that covers both schedules, rather than creating two separate
policies.
Schedule expiry
The schedule in a firewall policy enables certain aspects of network traffic to occur
for a specific length of time. What it does not do however, is police that time. That
is, the policy is active for a given time frame, and as long as the session is open,
traffic can continue to flow.
For example, in an office environment, Skype use is allowed between noon and
1pm. During that hour, any Skype traffic continues. As long as that session is
open, after the 1pm end time, the Skype conversations can continue, yet new
sessions will be blocked. Ideally, the Skype session should close at 1pm.
Using a CLI command you can set the schedule to terminate all sessions when
the end time of the schedule is reached. Within the config firewall command enter
the command:
set schedule-timeout enable
By default, this is set to disable.
Identity-based policies
Equally, if no authentication is used, and a user logs in at 12:45, the schedule will
log them out at 1:00 (45 minutes later). If they log in at 12:55, they will also be
logged out at 1:00 (5 minutes later). The following table illustrates this point:
UTM profiles
Where firewall policies provide the instructions to the FortiGate unit as to what
traffic is allowed through the device, the Unified Threat Management (UTM)
profiles provide the screening that filters the content coming and going on the
network. The UTM profiles enable you to instruct the FortiGate unit what to look
for in the traffic that you don’t want, or want to monitor, as it passes through the
device.
A UTM profile is a group of options and filters that you can apply to one or more
firewall policies. UTM profiles can be used by more than one firewall policy. You
can configure sets of UTM profiles for the traffic types handled by a set of firewall
policies that require identical protection levels and types, rather than repeatedly
configuring those same UTM profile settings for each individual firewall policy.
For example, while traffic between trusted and untrusted networks might need
strict antivirus protection, traffic between trusted internal addresses might need
moderate antivirus protection. To provide the different levels of protection, you
might configure two separate protection profiles: one for traffic between trusted
networks, and one for traffic between trusted and untrusted networks.
UTM profiles are available for various unwanted traffic and network threats. Each
are configured separately and can be used in different groupings as needed. You
configure UTM profiles in the UTM menu and applied when creating a firewall
policy by selecting the UTM profile type.
The UTM profiles can be identified by two categories: profiles (VoIP, antivirus, web
filter and email filter) and sensors (intrusion prevention, application control and
data leak prevention). Profiles are a group of identifiers to filter unwanted email
such as spam, web content and provide virus detection. Sensors are a grouping of
common or custom signature information that the FortiGate unit uses to identify, or
sense, an intrusion or data leak and prevent it from occurring. FortiOS includes a
selection of common sensors, and you can create custom ones as well.
For both categories, you create a unique set of criteria for the profile or sensor and
select it for the firewall policy. When traffic passes through the FortiGate unit, the
FortiGate unit compares the traffic information to see if the policy is valid. If it is, it
then applies the profiles and sensors to the traffic to determine if the traffic is an
attack, virus, spam or unwanted web content and either blocks or allows the traffic
through depending on how the sensor or policy was configured.
FortiOS includes a selection default UTM profiles and sensors. The defaults
provide varying levels of security from very strict, monitoring or blocking
everything, to very light allowing most traffic through. You can use these default
protection profiles as is to quickly configure your network security or as the bases
for creating your own.
Example
This example creates an antivirus profile that will scan all email traffic for viruses.
The new profile will be called email_scan.
To create a antivirus profile for email - web-based manager
Go to UTM > AntiVirus > Profile and select the plus sign in the upper right corner
1of the window.
2Enter the Name of email_scan.
3For the Virus Scan row, select IMAP, POP3 and SMTP.
4Select OK.
To create a antivirus profile for email - CLI
config antivirus profile
edit email_scan
config imap
set options scan
end
config smtp
set options scan
end
config pop3
set options scan
end
end
Firewall Policies
Firewall policies control all traffic attempting to pass through the FortiGate unit,
between FortiGate interfaces, zones, and VLAN subinterfaces.
Firewall policies are instructions the FortiGate unit uses to decide connection
acceptance and packet processing for traffic attempting to pass through. When the
firewall receives a connection packet, it analyzes the packet’s source address,
destination address, and service (by port number), and attempts to locate a
firewall policy matching the packet.
Firewall policies can contain many instructions for the FortiGate unit to follow
when it receives matching packets. Some instructions are required, such as
whether to drop or accept and process the packets, while other instructions, such
as logging and authentication, are optional.
Policy instructions may also include UTM profiles, which can specify application-
layer inspection and other protocol-specific protection and logging, as well as IPS
inspection at the transport layer.
This chapter describes what firewall policies are and how they affect all traffic to
and from your network. It also describes how to configure some key policies; these
are basic policies you can use as a building block to more complex policies, but
they enable you to get the FortiGate unit running on the network quickly.
This chapter contains the following topics:
•Policy order
•Creating basic policies
•Firewall policy examples
You configure firewall policies to define which sessions will match the policy and
what actions the FortiGate unit will perform with packets from matching sessions.
Sessions are matched to a firewall policy by considering these features of both the
packet and policy:
•Source Interface/Zone
•Source Address
•Destination Interface/Zone
•Destination Address
•Schedule and time of the session’s initiation
•Service and the packet’s port numbers.
If the initial packet matches the firewall policy, the FortiGate unit performs the
configured Action and any other configured options on all packets in the session.
FTP connections would immediately match the deny policy, blocking the
connection. Other kinds of services do not match the FTP policy, and so policy
evaluation would continue
ntinue until reaching the matching general policy. This policy
order has the intended effect. But if you reversed the order of the two policies,
positioning the general policy before the policy to block FTP, all connections,
including FTP, would immediatel
immediately y match the general policy, and the policy to block
FTP would never be applied. This policy order would not have the intended effect.
Figure 39: Example: Blocking FTP — Incorrect policy order
Similarly, if specific traffic requires authentication, IPSec VPN, or SSL VPN, you
would position those policies above other potential matches in the policy list.
Otherwise, the other matching policies would always take precedence, and the
required authentication, IPSec VPN, or SSL VPN might never occur.
Note: A default firewall policy may exist which accepts all connections.
You can move, disable or delete it. If you move the default policy to the
bottom of the firewall policy list and no other policy matches the packet,
the connection will be accepted. If you disable or delete the default policy
and no other policy matches the packet, the connection will be dropped.
You can arrange the firewall policy list to influence the order in which policies
are evaluated for matches with incoming traffic. When more than one policy has
been defined for the same interface pair, the first matching firewall policy will be
applied to the traffic session.
Blocking an IP address
This example describes how to create a firewall policy to block a specific IP
address. Any traffic from the configured IP address will be dropped at the point of
hitting the FortiGate unit. To block an IP address, you need to create an address
entry before creating a firewall policy to block the address.
Add an Address
First create the address which the FortiGate will identify to be blocked. In this
example, the address will be 172.20.120.29 for the address name of Blocked_IP.
To add an address entry - web-based manager
1Go to Firewall > Address > Address and select Create New.
2Enter a Name of Blocked_IP.
3Enter the IP address and subnet of 172.20.120.29/255.255.255.255.
The subnet is set to 255.255.255.255 to block the specific address. If you wanted
to block the entire subnet enter 172.20.120.0/255.255.255.0.
To add an address entry - web-based CLI
config firewall address
edit Blocked_IP
set subnet 172.20.120.29/32
end
On weekdays, allow all users to fully access the Internet during lunchtime and
•after business hours
Allow full access to the Internet without any restriction for users from a specific
•IP range, called Admin_PCs
During business hours, allow only access to www.example.com
•and www.example2.com for the other users
•No restriction during the weekend
It should be noted that a Firewall Policy is inactive outside of its schedule and that
the schedule relies upon the date/time that is configured on the FortiGate unit.
In this example all users are connected to the Internal interface and that the
Internet access is connected to WAN1.
Note: If the stop time is set earlier than the start time, the stop time will
be considered as the next day. If the start time is equal to the stop time,
the schedule will run for 24 hours.
Troubleshooting
When the firewall policies are in place and traffic is not flowing, or flowing more
than it should, there may be an issue with the one or more firewall policies. This
chapter outlines some troubleshooting tips and steps to diagnose where the traffic
is not getting through, or letting too much traffic through. For more troubleshooting
options and methods, see the Troubleshooting Guide chapter of The Handbook.
This chapter includes the topics:
•Basic policy checking
•Verifying traffic
•Using log messages to view violation traffic
•Traffic trace
•Packet sniffer
Note: For accelerated traffic, NP2 ports the count does not reflect the real
traffic count. Only the start of a session packet will be counted. For non-
accelerated traffic, all packets are counted.
Traffic trace
Traffic tracing enables you to follow a specific packet stream. View the
characteristics of a traffic session though specific firewall policies using the CLI
command diagnose system session, trace per-packet operations for flow tracing
using diagnose debug flow and trace per-Ethernet frame using diagnose sniffer
packet.
Session table
The FortiGate session table can be viewed from the web-based manager or the
CLI. The most useful troubleshooting data comes from the CLI. The session table
in web-based manager also provides some useful summary information,
particularly the current policy number that the session is using.
Sessions only are appear if a session was established. If a packet is dropped,
then no session will appear in the table. Using the CLI command diagnose debug
flow can be used to identify why the packet was dropped.
To view the session table in the web-based manager
1Go to System > Dashboard > Status.
2Select Add Content > Top Sessions.
3In the Top Sessions pane, select Details.
The Policy ID displays which firewall policy matches the session. The sessions
that do not have a Policy ID entry originate from the FortiGate unit.
To view the session table in the CLI
diagnose sys session list
The session table output using the CLI is very verbose. You can use filters to
display only the session data of interest. An entry is placed in the session table for
each traffic session passing through a firewall policy.
Sample output
session info: proto=6 proto_state=05 expire=89 timeout=3600 flags=00000000
av_idx=0 use=3
bandwidth=204800/sec guaranteed_bandwidth=102400/sec traffic=332/sec
prio=0 logtype=session ha_id=0 hakey=4450
tunnel=/
state=log shape may_dirty
statistic(bytes/packets/err): org=3408/38/0 reply=3888/31/0 tuples=2
orgin->sink: org pre->post, reply pre->post
oif=3/5 gwy=192.168.11.254/10.0.5.100
hook=post dir=org act=snat 10.0.5.100:1251-
>192.168.11.254:22(192.168.11.105:1251)
hook=pre dir=reply act=dnat 192.168.11.254:22-
>192.168.11.105:1251(10.0.5.100:1251)
pos/(before,after) 0/(0,0), 0/(0,0)
misc=0 domain_info=0 auth_info=0 ftgd_info=0 ids=0x0 vd=0 serial=00007c33
tos=ff/ff
Filter options enable you to view specific information from this command:
diagnose sys session filter <option>
The <option> values available include the following:
clear clear session filter
dport dest port
dst destination IP address
negate inverse filter
policy policy ID
proto protocol number
sport source port
src source IP address
vd index of virtual domain. -1 matches all
Even though UDP is a sessionless protocol, the FortiGate unit still keeps track of
the following two different states:
•UDP reply not seen with a value of 0
•UDP reply seen with a value of 1
The table below shows the firewall session states from the session table:
State Meaning
log Session is being logged.
local Session is originated from or destined for local stack.
ext Session is created by a firewall session helper.
may_dirty Session is created by a policy. For example, the session for ftp
control channel will have this state but ftp data channel will not. This
is also seen when NAT is enabled.
ndr Session will be checked by IPS signature.
nds Session will be checked by IPS anomaly.
br Session is being bridged (TP) mode.
Sample output
entry used by table firewall.address:name '10.98.23.23_host’
entry used by table firewall.address:name 'NAS'
entry used by table firewall.address:name 'all'
entry used by table firewall.address:name 'fortinet.com'
entry used by table firewall.vip:name 'TORRENT_10.0.0.70:6883'
entry used by table firewall.policy:policyid '21'
entry used by table firewall.policy:policyid '14'
entry used by table firewall.policy:policyid '19'
In this example, the interface has dependent objects, including four address
objects, one VIP, and three firewall policies.
Flow trace
To trace the flow of packets through the FortiGate unit, use the command
diagnose debug flow trace start
Follow the packet flow by setting a flow filter using the command:
diagnose debug flow filter <option>
Filtering options include:
addr IP address
clear clear filter
daddr destination IP address
dport destination port
negate inverse filter
port port
proto protocol number
saddr source IP address
sport source port
vd index of virtual domain, -1 matches all
Enable the output to in the console:
diagnose debug flow show console enable
Start flow monitoring with a specific number of packets using the command:
diagnose debug flow trace start <N>
Stop flow tracing at any time using:
diagnose debug flow trace stop
Sample output
This an example shows the flow trace for the device at the IP
address 203.160.224.97.
diag debug enable
diag debug flow filter addr 203.160.224.97
diag debug flow show console enable
diag debug flow show function-name enable
diag debug flow trace start 100
Sniffer Basics
Filter Functionality
Introduction
All FortiGate units have a powerful packet sniffer on board. If you know tcpdump
you should feel comfortable using the FortiGate Sniffer.
See the related article "Packet capture (sniffer) tips" for additional sniffer tips.
Sniffer Basics
The packet sniffer "sits" in the FortiGate and can sniff traffic on a specific
Interface or on all Interfaces. There are 3 different Level of Information, also
known as Verbose Levels 1 to 3, where verbose 1 shows less information and
verbose 3 shows the most information. Verbose 4, 5 and 6 would additionally
provide the interface details
This article walks through some examples and different levels of verbosity to
show the different possibilities for debugging.
Where...
If you don't enter a <count> value, the Sniffer runs forever until you stop it with
<CTRL C>
Hint: For further investigation it's always a good idea to log to a file. If you're
using Putty (a free SSH client for Windows) you can easily log all Output to a file
which you can search/sort/process.
Notice the in/ out parameter after internal interface that will confirm the direction
of the packet entering or leaving the interface.
Use of absolute time stamp in sniffer trace will report the absolute system time
(no time zone) in packet summary:
Hint: Below is the format that Technical Support will usually request when
attempting to analyze a problem as it includes full packet content, as well as
absolute time stamp, in order to correlate packets with other system events.
Filter Functionality
As already mentioned: diag sniffer includes a powerful filter functionality that will
be described here.
If a second host is specified, only the traffic between the 2 hosts will be displayed.
Imagine you only want to sniff the traffic from one PC to another PC. Without
Filter the sniffer will display all packets which is far too much and painful to
debug.
To see what's going on between two PCs (or a PC and a FortiGate),(Don't forget
to put your filter expressions in single quotes ' ' ):
# diag sniffer packet internal 'src host 192.168.0.130 and dst host 192.168.0.1' 1
Assuming there is a lot of traffic on the wire, this filter command will only display
traffic (but all traffic) from Source 192.168.0.130 to Destination 192.168.0.1. It will
NOT show traffic to 192.168.0.130 (for example the ICMP reply) because we said
' src host 192.168.0.130 and dst host 192.168.0.1'
As you can see we also captured some other things like ICMP or DNS queries
from a PC. If we're just interested in a specific type of traffic (let's say TCP Traffic
only) we need to change our filter command slightly like this:
# diag sniffer packet internal 'src host 192.168.0.130 and dst host 192.168.0.1
and tcp' 1
Though ICMP (ping) was also running, the trace only shows the TCP part. As we
can see the Destination is: 192.168.0.1.23 which is IP 192.168.0.1 on Port 23.
Apparently we found a Telnet Session to 192.168.0.1 right during initial setup.
In this example we're sniffing for ICMP only, to and from 192.168.0.130
Another useful feature is logical combination. Let us assume you want to sniff for
ICMP and TCP only (but not for UDP, ARP, etc). You can combine protocols in
the following manner:
This sniff will display all tcp or icmp traffic to and from host 192.168.0.30, in
verbose 1 level.
We want to sniff traffic between 2 hosts, but only TCP and only port 80.
# diag sniffer packet internal 'host 192.168.0.130 and 192.168.0.1 and tcp port
80' 1
Even if telnet and ssh is running between the two hosts, we only see port 80 TCP
traffic.
Match TTL = 1
# diagnose sniffer packet port2 "ip[8:1] = 0x01"
Also attached is the fgt2eth.pl script that will convert a verbose level 3 or 6 sniffer
output, into a file readable and decodable by Ethereal/Wireshark.
The fgt2eth.exe file is also attached to this article, this file is outdated and is not
supported but may provide some guidance.
Note: The attached script is provided "as is", it is not supported by Technical
Support.
$ ./fgt2eth.pl
Version : Dec 19 2014
Usage : fgt2eth.pl -in <input_file_name>
diagnose sniffer packet internal 'src host 192.168.0.130 and dst host
192.168.0.1' 1
The resulting output is:
192.168.0.130.3426 -> 192.168.0.1.80: syn 1325244087
192.168.0.1.80 -> 192.168.0.130.3426: syn 3483111189
ack 1325244088
192.168.0.130.3426 -> 192.168.0.1.80: ack 3483111190
192.168.0.130.3426 -> 192.168.0.1.80: psh 1325244088 ack 3483111190
192.168.0.1.80 -> 192.168.0.130.3426: ack 1325244686
192.168.0.130.1035 -> 192.168.0.1.53: udp 26
192.168.0.130.1035 -> 192.168.0.1.53: udp 42
192.168.0.130.1035 -
> 192.168.0.1.53: udp 42
192.168.0.130 -> 192.168.0.1: icmp: echo request
192.168.0.130.3426 -
> 192.168.0.1.80: psh 1325244686 ack 3483111190
192.168.0.1.80 ->
192.168.0.130.3426: ack 1325244735
192.168.0.130 -> 192.168.0.1: icmp: echo
request
Assuming there is a lot of traffic, this filter command will only display traffic (but all
traffic) from the source IP 192.168.0.130 to the destination IP 192.168.0.1. It will
not show traffic to 192.168.0.130 (for example the ICMP reply) because the
command included:
'src host 192.168.0.130 and dst host 192.168.0.1'
Additional information such as ICMP or DNS queries from a PC are included. If
you only require a specific type of traffic, for example, TCP traffic only, you need to
change the filter command as below:
Protect the internal network Enable IPS, antivirus, and spam filters.
from attacks, intrusions,
viruses, and spam.
Provide secure access for Configure secure IPSec VPN tunnels for remote
remote workers with static access employees. Use Dynamic Domain Name
or dynamic IP addresses. Server (DDNS) VPN for users with dynamic IP
Use a secure VPN client addresses. Use the FortiClient software to establish
solution. a secure connection between the FortiGate unit and
the home-based worker.
Serve the web site and Place the web and email servers on the DMZ
email from a DMZ to further network and create appropriate policies.
protect internal data.
See “Configuring the web server”.
Severely limit web access Create a schedule that covers business hours,
for certain employees (help create a custom web access solution, and include
desk) during work hours. these in a firewall policy for specific addresses.
Topology
Figure 40 shows the The Example Corporation network configuration after
installation of the FortiGate-100A.
Figure 40: SOHO network topology with FortiGate-100A
First steps
First steps includes creating a network plan and configuring the basic FortiGate
settings.
• Configuring FortiGate network interfaces
• Adding the default route
• Removing the default firewall policy
• Configuring DNS forwarding
• Setting the time and date
• Registering the FortiGate unit
• Scheduling automatic antivirus and attack definition updates
• Configuring administrative access and passwords
Configuring FortiGate network interfaces
The Example Corporation assigns IP addresses to the three FortiGate interfaces
to identify them on their respective networks. It is important to limit administrative
access to maintain security. The Example Corporation configures administrative
access for each interface as follows:
Note: If you want to set the update time to something other than the top
of the hour, you must use the CLI command.
To check server access and enable daily and push updates - CLI
config system autoupdate push-update
set status enable
end
config system autoupdate schedule
set frequency daily
set status enable
set time 05:30
end
Administrator admin_2
Password <psswrd>
Confirm <psswrd>
Password
Trusted Host #1 10.11.101.60 / 255.255.255.255 (administrator’s
computer)
Trusted Host #2 10.11.101.51 / 255.255.255.255 (lab computer)
Admin Profile admin_monitor
8Select OK.
To configure a new access profile and administrator account - CLI
config system accprofile
edit admin_monitor
set admingrp read
set authgrp read
set avgrp read
set fwgrp read
set ipsgrp read
set loggrp read
set mntgrp read
set netgrp read
set routegrp read
set spamgrp read
set sysgrp read
set updategrp read
set vpngrp read
set webgrp read
end
config system admin
edit admin2
set accprofile admin_monitor
set password <psswrd>
set trusthost1 192.168.100.60 255.255.255.255
set trusthost2 192.168.100.51 255.255.255.255
end
To change the admin password - web-based manager
1Go to System > Admin > Administrators.
2Select the check box for the admin name and select Change Password.
3Enter the new password and enter it again to confirm.
4Select OK.
To change the admin password - CLI
config system admin
edit <admin_name>
set password <psswrd>
end