Netgate is offering COVID-19 aid for pfSense software users, learn more.
Launching an Instance in a VPC¶
In the Amazon EC2 Management Console, launch a new instance of the Netgate® 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.
Select the region to run the instance in using the tab at the upper right corner of the page.
Launch a new instance by clicking on the Launch Instance button under the Create Instance section of the EC2 dashboard.
Select AWS Marketplace on the Create a New Instance menu. Type
Netgate pfSense Firewall/VPN/Routerin the search box and press
enter(or click on the Search button next to the text box).
Click on the link for the Netgate pfSense Firewall/VPN/Router appliance in the search results.
Click on the Continue button on the info page for the Netgate pfSense Firewall/VPN/Router.
Click on the Launch with EC2 Console tab
If the license terms haven’t been accepted, click on the Accept Terms button.
A message should be displayed indicating that the subscription is being processed.
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.
Choose the instance type to run on. Click Next: Configure Instance Details.
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.
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.
Optionally, expand the Advanced Details section and set parameters as text in the User Data field. The available options are:
Setting a value via a directive like
password=abcdefgwill 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.
Setting a value via a directive like
mgmtnet=10.0.1.0/24will 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:
Click Next: Add Storage after optionally setting these parameters.
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.
Click Next: Tag Instance to accept the Storage Device Configuration.
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.
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 webGUI 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.
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.
Verify the details for the instance and click Launch.
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.
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.
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.