> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Example Configuration for FortiGate VM in AWS

> In this document, we provide an example to set up the FortiGate Next Generation Firewall instance for you to validate that packets are sent to the FortiGate Next Generation Firewall for VPC-to-VPC and from VPC-to-Internet traffic inspection.

In this document, we provide an example to set up the FortiGate Next Generation
Firewall instance for you to validate that packets are sent to the FortiGate
Next Generation Firewall for VPC-to-VPC and from VPC-to-Internet traffic
inspection.

<Note>
  You must first [create a Transit FireNet in AWS](https://legacy.docs.aviatrix.com/documentation/latest/security/transit-firenet-create-aws.html), and <a href={"/docs/enterprise/" + "10.1" + "/guides/security/firenet/firewall-launch-attach"}>deploy a Fortinet FortiGate firewall</a> in that Transit FireNet.

  If you do not use Aviatrix vendor integration, you can manually configure
  Fortinet route table entries. For AWS that does not use the AWS Native Load
  Balancer, the RFC 1918 routes should point to the Aviatrix FireNet Gateway LAN
  interface IP.
</Note>

After you launch a FortiGate Next Generation Firewall instance, the FireNet >
Firewall tab displays the public IP address of the firewall's management/egress
interface. You click this to access the firewall UI.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-aws-management.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=419a648ee5da92c0c264a6430c544ff1" alt="fortigate aws management" width="2094" height="764" data-path="images/reference/security/firenet/fortigate-aws-management.png" />

Here is the Firewall information in this example for your reference. Adjust it
depending on your requirements.

| **Example setting**      | **Example value**                                           |
| ------------------------ | ----------------------------------------------------------- |
| Firewall Image           | Fortinet FortiGate Next-Generation Firewall                 |
| Firewall Image Version   | 6.2.3                                                       |
| Firewall Instance Size   | c5.xlarge                                                   |
| Egress Interface Subnet  | Select the subnet whose name contains "FW-ingress-egress."  |
| Key Pair Name (Optional) | The .pem file name for SSH access to the firewall instance. |
| Attach                   | Check                                                       |

<Note>
  The FortiGate Next Generation Firewall instance has two interfaces as
  described below. Additionally, firewall instance eth1 is on the same subnet as
  FireNet gateway eth2 interface.
</Note>

| **Fortigate VM instance interfaces**            | **Description**               | **Inbound Security Group Rule** |
| ----------------------------------------------- | ----------------------------- | ------------------------------- |
| eth0 (on subnet -Public-FW-ingress-egress-AZ-a) | Egress or Untrusted interface | Allow ALL                       |
| eth1 (on subnet -dmz-firewall)                  | LAN or Trusted interface      | Allow ALL (Do not change)       |

Below are the steps for initial setup.

## Vendor Integration (Optional)

Click
[here](https://legacy.docs.aviatrix.com/documentation/latest/security/fortigate-vendor-integration.html)
for information on vendor integration.

## Configuring FortiGate Next Generation Firewall port1 with WAN

After logging in with the new password, go to the page Network > Interfaces to
configure Physical Interface port1 as per the following screenshot.

Select the interface with port 1 and click **Edit**.

Enter an Alias (i.e.: WAN) for the interface.

Specify appropriate role (WAN).

Enable DHCP to ensure FW retrieve private IP information from the AWS console.

Enable **Retrieve default gateway from server**.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-interface-wan.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=beafa7c3891c130b8740cfd5dee39bb1" alt="v2_fortigate_interface_wan" width="2832" height="1898" data-path="images/reference/security/firenet/fortigate-interface-wan.png" />

## Configuring FortiGate Next Generation Firewall port2 with LAN

Go to the page Network > Interfaces to configure Physical Interface port2 as per
the following screenshot.

Select the interface with port 2 and click **Edit**.

Enter an Alias (i.e.: LAN) for the interface.

Specify appropriate role (LAN).

Enable DHCP to ensure FW retrieve private IP information from AWS console.

Enable Administrative Access: IPv4 > HTTPS.

Disable **Retrieve default gateway from server**.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-interface-lan.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=a1fd2df49ba944da0d40eac6c799aa47" alt="v2_fortigate_interface_lan" width="2782" height="1906" data-path="images/reference/security/firenet/fortigate-interface-lan.png" />

## Creating Static Routes for Routing of Traffic VPC to VPC

Packets to and from TGW VPCs, as well as on-premises, will be hairpinned off the
LAN interface. As such, you need to configure appropriate route ranges that you
expect traffic for packets that need to be forward back to TGW. For simplicity,
you can configure the FW to send all RFC 1918 packets to LAN port, which sends
the packets back to the TGW.

In this example, we configure all traffic for RFC 1918 to be sent out of the LAN
interface.

In the FortiGate UI, go to Network > Static Routes to create a Static Route as
the following screenshot.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-static-routes.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=258de2c91a668c8d6a5846049cff28ab" alt="v2_fortigate_static_routes" width="2416" height="1608" data-path="images/reference/security/firenet/fortigate-static-routes.png" />

Click **Create New**.

Enter the destination route in **Destination**.

In **Gateway Address**, you will need to enter the AWS default gateway IP on
subnet -dmz-firewall.

<Note>
  The subnet CIDR for -dmz-firewall is 10.66.0.96/28, thus the AWS default
  gateway IP on this subnet is 10.66.0.97.
</Note>

The interface will be the LAN (port2).

Configure an appropriate admin distance if you expect overlapping routes that
need to be prioritized.

Enter comments as necessary.

Repeat the steps above for RFC 1918 routes.

Those static routes can also be reviewed by navigating to Monitor > Routing
Monitor.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-static-routes-review.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=ff627caeb158a3cfb4db54ef7ea498c2" alt="v2_fortigate_static_routes_review" width="2886" height="1704" data-path="images/reference/security/firenet/fortigate-static-routes-review.png" />

## Configuring Basic Traffic Policy to Allow Traffic VPC-to-VPC

In this step, you will configure a basic traffic security policy that allows
traffic to pass through the firewall. Given that Aviatrix Gateways will only
forward traffic from the TGW to the LAN port of the Firewall, you can set your
policy condition to match any packet that is going in/out of the LAN interface.

In the Fortigate UI, navigate to Policy & Objects > IPv4 Policy > Create New /
Edit to configure the policy as shown in the following table.

| Field              | Value                              |
| ------------------ | ---------------------------------- |
| Name               | Configure any name for this policy |
| Incoming Interface | LAN (port2)                        |
| Outgoing Interface | LAN (port2)                        |
| Source             | Click on the + sign and add all    |
| Destination        | Click on the + sign and add all    |
| Schedule           | always                             |
| Service            | ALL                                |
| Action             | ACCEPT                             |
| NAT                | Disabled                           |

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-policy-vpc.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=19e18a69587709f7589e5e923b822b32" alt="v2_fortigate_policy_vpc_to_vpc" width="1090" height="871" data-path="images/reference/security/firenet/fortigate-policy-vpc.png" />

After validating that your TGW traffic is being routed through your firewall
instances, you can customize the security policy to your requirements.

## (Optional) Configuring Basic Traffic Policy to Allow Traffic from a VPC to the Internet

In this step, we will configure a basic traffic security policy that allows
Internet traffic to pass through the firewall. Given that Aviatrix Gateways will
only forward traffic from the TGW to the LAN port of the Firewall, you can set
your policy condition to match any packet that is going into the LAN interface
and going out of the WAN interface.

First you enable egress inspection:

In CoPilot, select FireNet on the left.

On the FireNet Gateways tab, select a Transit FireNet in the list and click the
pencil (Edit) icon.

In the Edit FireNet dialog, under FireNet Configuration, toggle the Egress
slider to **On**.

On the FireNet tab, verify the Egress status by making sure that the Egress
column reads yes.

You then create the new traffic policy in the FortiGate UI:

Navigate to Policy & Objects > IPv4 Policy > Create New / Edit to configure the
policy as per the following table.

| Field              | Value                              |
| ------------------ | ---------------------------------- |
| Name               | Configure any name for this policy |
| Incoming Interface | LAN (port2)                        |
| Outgoing Interface | WAN (port1)                        |
| Source             | Click on the + sign and add all    |
| Destination        | Click on the + sign and add all    |
| Schedule           | always                             |
| Service            | ALL                                |
| Action             | ACCEPT                             |
| NAT                | Enable                             |

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-policy-internet.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=219aec7f25abd04e4303ab6ba89f9ad7" alt="v2_fortigate_policy_vpc_to_internet" width="1078" height="869" data-path="images/reference/security/firenet/fortigate-policy-internet.png" />

<Note>
  The NAT function needs to be enabled on this VPC to Internet policy.
</Note>

After validating that your TGW traffic is being routed through your firewall
instances, you can customize the security policy to your requirements.

## Packet Inspection and Attaching VPC to AWS TGW

Now your firewall instance is ready to receive packets.

The next step is to specify which Network Domain needs packet inspection by
defining a
[connection policy](https://legacy.docs.aviatrix.com/documentation/latest/security/transit-firenet-inspection-policy.html)
that connects to the Firewall Domain. In addition, attach VPC to TGW by

<a href={"/docs/enterprise/" + "10.1" + "/guides/connectivity/tgw/tgw-overview"}>Step 1</a>
in the TGW Orchestrator Build workflow.

For example, deploy Spoke-1 VPC in Network\_Domain\_1 and Spoke-2 VPC in
Network\_Domain\_2. Build a connection policy between the two domains. Build a
connection between Network\_Domain\_2 to Firewall Domain.

## Viewing the Traffic Log

You can view if traffic is forwarded to the firewall instance by logging in to
the FortiGate Next Generation Firewall console. Go to FortiView > Destinations.

## VPC-to-VPC Traffic

Launch one instance in Spoke-1 VPC and one in Spoke-2 VPC. Start pinging packets
from an instance in Spoke-1 VPC to the private IP of another instance in Spoke-2
VPC where one or both of the Network Domains are connected to Firewall Network
Domain. The ICMP traffic should go through and be inspected on the firewall.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-view-vpc.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=500acee54689e0a83daefef097bb9168" alt="v2_fortigate_view_traffic_log_vpc_to_vpc" width="3260" height="1318" data-path="images/reference/security/firenet/fortigate-view-vpc.png" />

## \[Optional] VPC to Internet Traffic

Launch a private instance in the Spoke VPC (i.e. Spoke-2 VPC) where the Network
Domain (i.e. Network\_Domain\_2) is connected to Firewall Network Domain. Start
pinging packets from the private instance to the Internet service to verify
egress function. The ICMP traffic should go through and be inspected on the
firewall.

<img src="https://mintcdn.com/aviatrix-14b37c43/-mwrdwN2SbwuEu52/images/reference/security/firenet/fortigate-view-internet.png?fit=max&auto=format&n=-mwrdwN2SbwuEu52&q=85&s=85af2a1a0fd8c1d135dadc80d423b0ff" alt="v2_fortigate_view_traffic_log_vpc_to_internet" width="3266" height="1388" data-path="images/reference/security/firenet/fortigate-view-internet.png" />
