Launching an Instance in a VPC

In the Amazon EC2 Management Console, launch a new instance of the pfSense® firewall and VPN appliance. This process is the same as the one for launching an EC2 (non-VPC) instance, up until step 11, which details the values to enter for the Configure Instance Details screen in order to specify the instance should be created in your VPC.

  1. Select the region to run the instance in using the tab at the upper right corner of the page.

    ../_images/aws-vpc-guide-9.jpg
  2. Launch a new instance by clicking on the Launch Instance button under the Create Instance section of the EC2 dashboard.

    ../_images/aws-vpc-guide-10.jpg
  3. Select AWS Marketplace on the Create a New Instance menu. Type Netgate pfSense Firewall/VPN/Router in the search box and press enter (or click on the Search button next to the text box).

    ../_images/aws-vpc-guide-11.jpg
  4. Click on the link for the Netgate pfSense Firewall/VPN/Router appliance in the search results.

    ../_images/aws-vpc-guide-12.jpg
  5. Click on the Continue button on the info page for the Netgate pfSense Firewall/VPN/Router.

    ../_images/aws-vpc-guide-13.jpg
  6. Click on the Launch with EC2 Console tab

    ../_images/aws-vpc-guide-14.jpg
  7. If the license terms haven’t been accepted, click on the Accept Terms button.

    ../_images/aws-vpc-guide-15.jpg
  8. A message should be displayed indicating that the subscription is being processed.

    ../_images/aws-vpc-guide-16.jpg
  9. Select the version of the image to run under the popup menu labeled Select a Version. Generally the most recently issued version should be selected. Identify which region to launch the instances in and click on the Launch in EC2 Console button to the right of that region.

    ../_images/aws-vpc-guide-17.jpg
  10. Choose the instance type to run on. Click Next: Configure Instance Details.

    ../_images/aws-vpc-guide-18.jpg
  11. On the Configure Instance Details page, under the Network field, select the VPC that was created. For the Subnet field that appears right below the Network field, select the public subnet that was created earlier. In our examples, this is 10.2.0.0/24.

    ../_images/aws-vpc-guide-19.jpg
  12. Scroll down to the Network Interfaces heading. A single interface named eth0 should be displayed by default. Click on the Add Device button underneath eth0. Select the private subnet that was created (10.2.1.0/24 in our example). Pick an IP address within the range of the private subnet and enter it in the Private IP field. Keep in mind that the first 3 or 4 IP addresses are reserved. For this example, we will use 10.2.1.5.

    ../_images/aws-vpc-guide-20.jpg

    Optionally, expand the Advanced Details section and set parameters as text in the User Data field. The available options are:

    password

    Setting a value via a directive like password=abcdefg will set the password for the administrative account to the specified value - abcdefg in this example. If no value is set here, a random password will be assigned in order to keep administrative access from being exposed to the internet with a default password.

    mgmtnet

    Setting a value via a directive like mgmtnet=10.0.1.0/24 will restrict management access (http, https, ssh) to the specified network - 10.0.1.0/24 in this example. This will cause the firewall rule on the instance (not on Amazons access lists, but on the Netgate appliance’s own firewall) to restrict management traffic for the instance to the specified source network. The default behavior is to allow management from any host.

    These directives can be set by placing them on a single line in the User Data field and separating them with colons. Specify both parameters, by typing a statement similar to:

    password=abcdefg:mgmtnet=10.0.1.0/24
    

    Click Next: Add Storage after optionally setting these parameters.

    Note

    If setting a password using the password parameter listed above, the password is retrieved by the instance via an unencrypted HTTP request when the system is configured the first time it boots. The request is made to an Amazon Web Services-operated server on the local LAN that stores metadata about each instance running. The data for an instance is only made available to that instance, but is available to be queried from the instance without providing any authentication credentials.

    It is advised to change the admin password via the pfSense webGUI after the instance comes up, or choose not to set the password at all and let a random password be set.

    ../_images/aws-vpc-guide-21.jpg
  13. Click Next: Tag Instance to accept the Storage Device Configuration.

    ../_images/aws-vpc-guide-22.jpg
  14. Optionally, a tag can be set on the instance to differentiate this instance from other VM’s that were started by entering a value for the Name tag. Click Next: Configure Security Group after setting any desired tags.

    ../_images/aws-vpc-guide-23.jpg
  15. Select a security group to launch the instance with. The recommended settings for a security group should allow at least the following traffic:

    • TCP port 443 from 0.0.0.0/0 - HTTPS - This is the port that the management web GUI listens on.

    • TCP port 22 from 0.0.0.0/0 - SSH - This port can be used to connect to a command prompt with an ssh client.

    • UDP port 1194 from 0.0.0.0/0 - OpenVPN - The OpenVPN server that is configured by default is bound to this port.

    • UDP port 500 from 0.0.0.0/0 - IKE for IPsec VPN.

    • UDP port 4500 from 0.0.0.0/0 - IPsec/NAT-T for IPsec VPN.

    ../_images/aws-vpc-guide-24.jpg

    If you have an existing security group that includes this access, select Select an existing security group, then select the group(s) to use and click Continue. Otherwise, select Create a new security group, and add rules for this access by filling in the form for each rule and clicking the Add Rule button. When all of the rules have been added, click Review and Launch.

  16. Verify the details for the instance and click Launch.

    ../_images/aws-vpc-guide-25.jpg
  17. Select an existing key pair or create a new key pair to connect to the instance with. Do not select Proceed Without a Key Pair. Click the checkbox that indicates you acknowledge having access to the selected private key file and then click Launch Instance.

    ../_images/aws-vpc-guide-26.jpg
  18. In order to reach the instance from the Internet, associate an Elastic IP with the WAN interface of the instance. In the VPC Management Console, go to the Elastic IPs view by clicking on Elastic IPs on the left side of the page. Click on the Allocate New Address button. Select that you want the EIP used in VPC and click on the Yes, Allocate button in the box that pops up. After the Elastic IP address is allocated, associate the address with the WAN interface of the Netgate appliance by clicking on the Associate Address button.

    A box will pop up that will either let you specify the instance and Private IP address of the interface or the Network Interface and the Private IP Address of the interface. Use one of these methods to select the correct interface and click on the Yes, Associate button. The instance should now be reachable via ssh or https.

    ../_images/aws-vpc-guide-27.jpg
  19. In order for traffic to be allowed to be routed from the private subnet through the public interface of the instance, the Source/Dest AddressCheck on the private interfaces needs to be disabled. In the EC2 Management Console, go to the “Network Interfaces” view by clicking on Network Interfaces in the menu on the lefthand side of the page.

    Click the checkbox to the left of the private/LAN interface on the Netgate appliance instance. Click on the Actions button at the top of the page and select Change Source/Desk Check on the popup menu. Select the radio button labeled Disabled on the box that pops up and click on the Save button.

    Non-local traffic from the private subnet should now be sent through the private/LAN interface on the Netgate appliance instance.

    ../_images/aws-vpc-guide-28.jpg