Configuring the FortiGate
- Log into FortiOS.
- Create the IPsec tunnel:
- Go to VPN > IPsec Tunnels, then click Create New.
- Configure the basic settings:
- In the Name field, enter the desired name.
- For Template Type, select Custom.
- Click Next.
- Configure the network settings:
- In the IP Address field, enter the VPN gateway's IP address as provided by Alibaba Cloud (AliCloud) in step 5 of Configuring the Alibaba Cloud (AliCloud) VPN gateway.
- From the Interface dropdown list, select an Internet-facing interface, such as wan1.
- If you want to automatically check the available of the remote VPN gateway, set Dead Peer Detection to On Idle.
- Configure authentication:
- Authentication, from the Method dropdown list, select Pre-shared Key.
- In the Pre-Shared Key field, enter the pre-shared key entered for the Alibaba Cloud (AliCloud) VPN gateway in step 7 of Configuring the Alibaba Cloud (AliCloud) VPN gateway.
- For IKE Version, select 2.
- Under Diffie-Hellman Groups, select 2. The Alibaba Cloud (AliCloud) VPN gateway's default DH group is 2. Leave the other parameters as-is.
- For Local Address, select Subnet from the dropdown list, then enter the LAN subnet address.
- For Remote Address, select Subnet, then enter the VPC subnet address on Alibaba Cloud (AliCloud).
- Under Advanced, also select 2 under Diffie-Hellman Groups. Leave the other parameters as-is, then click OK.
- To pass traffic to and from the IPsec tunnel, you must create a policy that allow transaction between the FortiGate and Alibaba Cloud (AliCloud). You must first create an address object which represents the subnet on your VPC:
- Go to Policy & Objects > Addresses, then click Create New > Address.
- In the Name field, enter the address object's name.
- From the Type dropdown list, select Subnet.
- In the Subnet/IP Range field, enter the VPC subnet address.
- Enable Static Route Configuration. This allows you to use this address object as a static route destination in a later step.
- Create a policy that permits outgoing sessions to the IPsec tunnel.
- Go to Policy & Objects > IPv4 Policy, then click Create New.
- In the Name field, enter the desired policy name.
- In the Incoming Interface field, select your local LAN interface.
- In the Outgoing Interface field, select the IPsec tunnel created in step 2.
- For Source, select all, or specify any address objects if you want to allow access only from specific addresses.
- For Destination, select the address object created for your VPC subnet in step 3.
- For Service, select all or specify any services you want to allow.
- Ensure that NAT is not enabled.
- Click OK.
- Create a policy for incoming sessions from the VPC. Repeat the steps above, except for the following:
- In the Incoming Interface field, select the IPsec tunnel created in step 2.
- In the Outgoing Interface field, select your local LAN interface.
- For Source, select subnets on your VPC.
- To avoid packet drops and fragmentation, it is recommended to limit the TCP maximum segment size (MSS) being sent and received. For both firewall policies, configure the following in the CLI console:
config firewall policy
set tcp-mss-sender 1350
set tcp-mss-receiver 1350
- Go to Monitor > IPsec Monitor. If all configuration is complete as desired, the IP tunnel displays as being up.
Otherwise, you must review and correct your settings.
- Create a static route to forward traffic from the LAN to Alibaba Cloud (AliCloud):
- Go to Network > Static Routes, then select Create New.
- For Destination, select Named Address. From the list, select your remote subnet.
- From the Interface dropdown list, select the IPsec tunnel created in step 2.
- Click OK.
FortiOS is now connected to Alibaba Cloud (AliCloud) via IPsec. You should see the traffic counter in Monitor > IPsec Monitor.