Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
pfSense 2.x Cookbook
pfSense 2.x Cookbook

pfSense 2.x Cookbook: Manage and maintain your network using pfSense , Second Edition

eBook
$9.99 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

pfSense 2.x Cookbook

Initial Configuration

In this chapter, we will cover the following recipes:

  • Applying basic settings to General Setup
  • Identifying and assigning interfaces
  • Configuring a WAN interface
  • Configuring a LAN interface
  • Configuring optional interfaces
  • Enabling SSH access
  • Generating authorized RSA keys
  • Configuring SSH RSA authentication
  • Accessing the SSH
  • Configuring VLANs
  • Assigning interfaces from the console
  • Configuring a WAN interface from the console
  • Configuring a LAN interface from the console
  • Configuring optional interfaces from the console
  • Configuring VLANs from the console

Introduction

pfSense is open source software that can be used to turn a computer into a firewall/router. Its origins can be traced to the FreeBSD packet-filtering program known as PF, which has been part of FreeBSD since 2001. As PF is a command-line utility, work soon began on developing software that would provide a graphical frontend to PF. The m0n0wall project, which provides an easy-to-use, web-based interface for PF, was thus started. The first release of m0n0wall took place in 2003. pfSense began as a fork of the m0n0wall project.

Version 1.0 of pfSense was released on October 4, 2006, and version 2.0 was released on September 17, 2011. A key point in the development of pfSense took place with the release of Version 2.3 on April 12, 2016. This version phased out support for legacy technologies such as Point to Point Tunneling Protocol (PPTP), Wireless Encryption Protocol (WEP), and Single DES, and also provided a face-lift for the web GUI. Version 2.4, released on October 12, 2017, continues this trend of phasing out support for legacy technologies while also adding features. Support for 32 bit x86 architectures has been deprecated, while support for Netgate Advanced RISC Machines (ARM) devices has been added. A new pfSense installer (based on FreeBSD’s bsdinstall) has been incorporated into pfSense, and there is support for the ZFS filesystem, as well as the Unified Extensible Firmware Interface (UEFI). pfSense now supports multiple languages; the web GUI has been translated into 13 different languages.

This chapter will cover the basic configuration steps common to virtually all deployments. Once you have completed the recipes in this chapter, you will have a fully functional router/firewall. By following the recipes in subsequent chapters, you can enhance that functionality by adding specific firewall rules, enabling traffic shaping, adding load balancing and multi-WAN capabilities, and much more.

Applying basic settings to General Setup

This recipe describes how to configure core pfSense settings from the web GUI.

Getting ready

All that is required for this recipe is a fresh install of pfSense and access to the web GUI.

On a new install, the default login credentials are Username: admin and Password: pfsense

How to do it...

  1. In the web GUI, navigate to System | General Setup.
  2. In the first section of the page (System), enter a Hostname. This name can be used to access the firewall instead of the IP address:
  1. In the next field, enter the Domain:

  1. The next field is DNS Servers. By default, pfSense will act as the primary DNS server; however, you can specify alternate DNS servers here. The Add DNS Server button causes an additional edit box to appear, into which you can enter another DNS server; you can add as many alternate DNS servers as is necessary:

  1. Check the Allow DNS server list to be overridden by DHCP/PPP on WAN checkbox (it should be checked by default). This ensures that any DNS requests that cannot be processed internally will be passed on to the external DNS servers, as specified by your ISP:

  1. In the Localization section, specify a Timezone and leave Timeservers at the default value of 0.pfsense.pool.ntp.org. Specify the appropriate Language (the default is English):

  1. In the webConfigurator section, I’d recommend the default Theme of pfSense. You can set Top Navigation to either Scrolls with page (appropriate for all screen sizes) or Fixed (designed for large screens only). You may also set the number of Dashboard Columns (the default is 2):

  1. When done, click on the Save button.

See also

  • The Configuring the DNS Forwarder recipe in Chapter 2, Essential Services.

Identifying and assigning interfaces

This recipe describes how to identify interfaces on a network configuration and how to assign them in pfSense.

Getting ready

You need to identify the MAC addresses for each Ethernet port on your pfSense system before attempting to assign them.

How to do it...

  1. Navigate to Interfaces | Interface Assignments.
  2. Assign a WAN interface, first by selecting the correct MAC address from the drop-down list for the WAN interface:
  1. Repeat this process for the LAN interface, selecting the correct MAC address from the drop-down list for the LAN interface. If necessary, add the LAN interface to the list by following this process:
    1. Click on the Add button in the Available network ports column.
    2. Click on the name of the newly created interface in the Interfaces column (it should be OPT1).
    3. When the configuration page for the interface loads, change Description to LAN.
    4. Click on the Save button at the bottom of the page.
    5. Navigate back to Interfaces | Interface Assignments.
  2. If you want to add optional interfaces, you can do so by repeating step 3 and substituting the name of the optional interface (for example, DMZ) for LAN.
  3. When you are done assigning interfaces, click on the Save button.

See also

  • The Assigning interfaces at the console recipe

Configuring a WAN interface

This recipe describes how to configure the Wide Area Network (WAN) interface, which provides access to external networks on our pfSense system.

Getting ready

The WAN interface is your connection to external networks (in most cases, the public internet). You will need a properly configured WAN interface and an internet connection. In this example, we will connect to the internet via an Internet Service Provider (ISP) and a cable modem.

How to do it...

  1. Navigate to Interfaces | WAN.
  2. Check the Enable Interface checkbox (it should be checked by default):
  1. Choose an IPv4 Configuration Type (usually DHCP).
  2. Choose an IPv6 Configuration Type, or leave it set to None.
  3. Leave MAC Address blank. Manually entering a MAC address here is known as MAC address spoofing. You can enter a MAC address here if you want to force your ISP to hand you a different IP address, or a different set of DNS servers. Be warned, however, that the MAC address entered must have a valid manufacturer’s prefix or it won’t work.
  4. Leave MTU, MSS, Hostname, and Alias IP address blank.
  1. Check the Block private networks and loopback addresses checkbox (it should be checked by default). This will block RFC 1918 private addresses from being sent out over the public internet.
  2. Check the Block bogon networks checkbox (it should be checked by default). This will block packets from IP addresses not yet assigned by IANA from being sent or received:
  1. Click on the Save button when done.

How it works...

We must first establish a connection to the internet before we can configure pfSense to allow other networks to access it. The example we provided is a typical WAN configuration for a Small Office/Home Office (SOHO) environment. By setting up the WAN interface as the only interface with direct access to the internet, we are securing the network behind the firewall and establishing complete control over our networks. All networks behind the firewall must now abide by the rules we create.

There's more...

Now that we have configured the WAN interface, we can connect the cable modem to the WAN port on pfSense and check the status of the WAN port by navigating to Status | Interfaces.

See also

  • The Identifying and assigning interfaces recipe in this chapter
  • The Configuring a LAN interface recipe in this chapter
  • The Configuring optional interfaces from the console recipe in this chapter

Configuring a LAN interface

This recipe describes how to configure the Local Area Network (LAN) internal interface of our pfSense firewall.

Getting ready

The LAN interface is the interface to the internal network through which our nodes will be able to securely connect to other internal nodes and to the internet. An assigned LAN interface is required.

How to do it...

  1. Navigate to Interfaces | LAN.
  2. Check the Enable Interface checkbox:
  1. Choose an IPv4 Configuration Type (usually Static IPv4).
  2. Choose an IPv6 Configuration Type (or leave it set to None).
  3. Enter an IPv4 Address in the appropriate field, and the correct CIDR in the adjacent drop-down box. Leave IPv4 Upstream gateway set to None.
  4. If you enabled IPv6 by setting the IPv6 Configuration Type, enter an IPv4 Address in the appropriate field and the correct CIDR in the adjacent drop-down box.
  5. Leave Block private networks and Block bogon networks unchecked (they should be unchecked by default).
  6. When you are done making changes, click on the Save button. When the page reloads, click on the Apply Changes button.

How it works...

You have just defined your first internal network. If you have been following these recipes in order, you now have met the minimal requirements for a fully functional network. You can now either continue adding networks, or start configuring the rules to regulate traffic between the networks.

There's more...

You can now connect a switch to the LAN port of your pfSense system, and connect nodes to the LAN network.

See also

  • The Identifying and assigning interfaces recipe in this chapter
  • The Configuring a WAN interface recipe in this chapter
  • The Configuring optional interfaces from the console recipe in this chapter

Configuring optional interfaces from the console

This recipe describes how to configure optional interfaces (for example, a DMZ network) to pfSense.

Getting ready

The optional network you will create in this network will be a DMZ, which is short for the DeMilitarized Zone. The idea of a DMZ is to have a network where some traffic is allowed to pass and some traffic is not. Typically, traffic in the DMZ is allowed to pass to and from the internet but not to other internal networks. Traffic is allowed to pass from internal networks to the DMZ. Thus, the flow of traffic looks like this:

Internet <<>> DMZ << Internal networks

Unsafe internet traffic, for example, is allowed to enter a web server in the DMZ. LAN traffic is allowed to enter the DMZ as well, for example, if someone on the LAN wants to access the web server as well. However, the key lies in the fact that no DMZ traffic is allowed to access the internal networks.

To configure a DMZ, you will need at least one spare interface, and you will have to have added it using the procedure outlined in the Identifying and assigning interfaces recipe. We will assume that you have added at least one such interface (named OPT1).

How to do it...

  1. Navigate to Interfaces | OPT1.
  2. Check the Enable Interface checkbox:
  1. Set Description to DMZ.
  2. Set IPv4 Configuration Type to Static IPv4.
  3. Enter an IPv4 Address and the CIDR. In our case, we will use 192.168.2.1 and select 24 from the CIDR dropdown list.
  4. Leave IPv4 Upstream gateway set to None.
  5. Leave the Block private networks and Block bogon networks checkboxes unchecked (they should be unchecked by default).
  6. When you are done making changes, click on the Save button. When the page reloads, click on the Apply Changes button.

How it works...

Your DMZ network will now allow external (WAN) access. Your LAN network will now be able to access the DMZ, but the DMZ will not be able to access the LAN.

There's more...

You can now attach a switch to your DMZ port to allow you to attach multiple nodes to your DMZ network. If you have been following the recipes in this chapter in order, your network will now look like this:

See also

  • The Identifying and assigning interfaces recipe
  • The Configuring a WAN interface recipe
  • The Configuring a LAN interface recipe

Enabling SSH access

This recipe describes how to enable the Secure Shell service in pfSense, thus making remote console login possible.

SSH is a networking protocol that allows encrypted communication between two nodes. Enabling SSH will allow you to gain access to the pfSense console remotely, as if you were at the console.

How to do it...

  1. Navigate to System | Advanced.
  2. In the Secure Shell section of the page, check the Enable Secure Shell checkbox:
  1. With the current settings, you will be prompted for a username and password when logging into the console remotely. But by changing the SSHd Key Only setting to Public Key Only, you can set it so that only logins with a public key will be allowed. See the next recipe for details on how to generate an RSA public key.
  2. Leave SSH port set to the default, port 22.
  3. When you are done, click on the Save button.

How it works...

Enabling Secure Shell in pfSense turns on pfSense’s internal SSH server, which causes pfSense to listen for login attempts on the SSH port (in this case, port 22).

There's more...

Using RSA keys for SSH login is an effective way of securing your system. You can also change the SSH port; this should result in fewer unauthorized login attempts, though you will have to remember the new SSH port.

See also

  • The Generating authorized RSA keys recipe in this chapter
  • The Enabling RSA key authentication recipe in this chapter

Generating authorized RSA keys

This recipe describes how to create an authorized RSA key so the user can log in to the pfSense console without using a password.

Getting ready

Linux and macOS users will need the ssh-keygen utility (installed by default in most cases). Windows users will need the puttygen utility.

How to do it...

For Linux/macOS users:

  1. In a Terminal window, type ssh-keygen and press Enter
  2. Enter the name of the file in which to save the public key (or just accept the default value)
  3. Enter a passphrase for the new key (not necessary, but recommended)
  1. Enter the passphrase a second time for confirmation
  2. The program will now generate an RSA public key and save it to the file

For Windows users:

  1. Start the puttygen utility.
  2. In the Actions section, click on the Generate button to generate a public/private key pair:
  1. Move your mouse over the top section of the puttygen dialog box to generate random activity, as per puttygen's instructions.
  2. Enter a passphrase (not necessary, but recommended).
  3. Click on the Save private key button and specify a filename for the private key (for example, MyPrivateKey.ppk).
  4. Highlight the public key that was created in the textbox and save it to a file (for example, MyPublicKey.txt). Do not use the Save public key button because it adds potentially incompatible text to the file.

How it works...

RSA has become a standard for securing client/server connections. A client generates a public/private key pair—a private key file and a public key file, and a possible passphrase for additional security. Any server can then request the client’s public key and add it to their system; that client can then authenticate without typing in a password.

See also

  • The Enabling SSH access recipe
  • The Configuring SSH RSA key authentication recipe

Configuring SSH RSA key authentication

This recipe describes how to configure pfSense to use an RSA key rather than a username/password combination for authentication.

Getting ready

Make sure you have enabled SSH access and generated an RSA key (if you completed the last two recipes, you have).

How to do it...

  1. Navigate to System | Advanced.
  2. Make sure SSHd Key Only is set to Public Key Only:
  1. Navigate to System | User Manager. Click on the Users tab (it should be selected by default).
  2. Click on the Edit icon (the pencil) for the admin account.
  3. In the Keys section, paste the client's public RSA key (that can be the RSA key you created in the previous recipe). When pasted, the key should appear as a single line. Make sure your text editor does not insert any line feeds, or authentication may fail:
  1. When done, click on the Save button.

How it works...

When you connect using an SSH client, instead of asking for a username and password, the SSH server will now use your public RSA key to send a challenge to you. The challenge can only be read if you have the matching private RSA key.

There’s more...

RSA private keys can also be stored encrypted to the client’s computer. The SSH client will prompt you for the decryption password. Once entered, it will be able to use the private key for authentication.

See also

  • The Enabling SSH access recipe
  • The Generating authorized RSA keys recipe
  • The Accessing the SSH recipe

Accessing the SSH

This recipe describes how to access the console from any Linux, macOS, or Windows computer.

Getting ready

The SSH server must be enabled and configured on your pfSense box. You must have an SSH client on your computer. An SSH client is installed by default on Linux and macOS. If you are using Windows, you need to install an SSH client such as PuTTY.

How to do it...

In Linux or macOS, follow these steps:

  1. Launch a Terminal window and type the following: ssh admin@192.168.1.1.
  2. If you are using the default configuration, you will be prompted for a password.
  3. If you are using RSA key authentication, the client will directly connect to the server, or you may be asked for a passphrase. If asked for a passphrase, use the one you created when creating the RSA key.
  4. If you configured SSH to use a different port, you can specify it using the -p option; for example, ssh -p 12345 admin@192.168.1.1.

In Windows, follow these steps:

  1. Launch PuTTY and, on the initial screen, enter the hostname or IP address of pfSense:

  1. Specify an alternate port if necessary.
  1. If you are using RSA key authentication, navigate to Connection | SSH | Auth | Private key file for authentication:
  1. You'll connect and be prompted for a username.
  2. You will then be prompted for a password, or if RSA authentication is used, you will connect directly, or be prompted for a passphrase.

How it works...

SSH allows access to the pfSense console from any computer or device that has an SSH client installed on it.

See also

  • The Enabling SSH access recipe
  • The Generating authorized RSA keys recipe
  • The Configuring SSH RSA auhentication recipe

Configuring VLANs

This recipe describes how to set up a Virtual LAN (VLAN) from the pfSense web GUI. For example, we could set up a VLAN for developers.

Getting ready

In order to complete this recipe, you must have at least one unassigned interface to use as the parent interface.

How to do it...

  1. Navigate to Interfaces | Assignments, and click on the VLANs tab.
  2. Click on the Add button.
  3. Choose a Parent Interface from the drop-down menu; this should be a currently unassigned interface:
  1. Enter a VLAN Tag from 2 to 4094 (1 is reserved as the default VLAN tag and should not be used).
  2. Enter a VLAN Priority level from 0 to 7 (or just leave it at the default value of 0).
  3. Enter a brief Description.
  4. When you are done, click on the Save button.
  5. Click on the Interface Assignments tab.
  6. In the Available network ports column, select the newly created VLAN in the drop-down box, and click on the Add button:
  1. To configure the VLAN, click on the interface name in the Interface column.
  2. On the Interfaces configuration page, check the Enable Interface checkbox.
  3. Change the Description to an appropriate one for the VLAN (for example, DEV).
  4. Set the IPv4 Configuration Type to an appropriate value (usually Static IPv4).
  5. Set the IPv6 Configuration Type, or leave it set to None.
  6. If you set the IPv4 Configuration Type to Static IPv4, you must enter the IPv4 Address and CIDR for the new VLAN. Use a subnet that has not yet been used (for example, 192.168.10.1/24).
  1. Leave the IPv4 Upstream gateway set to None.
  2. If you set the IPv6 Configuration Type to Static IPv6, you must enter the IPv6 Address and CIDR for the new VLAN.
  3. Leave the IPv6 Upstream gateway set to none.
  4. Leave the Block private networks and Block bogon networks checkboxes unchecked.
  5. When you are done making changes, click on the Save button, and then, when the page reloads, click on the Apply Changes button.

How it works...

Up to now, we have contemplated networks that correspond to a single network interface. Sometimes, however, we want to decouple logical network groupings from physical interfaces. We may want to have more than one network on a single interface—or, less commonly, have a network span multiple interfaces. We can accomplish this with virtual LANs, or VLANs. By attaching a special header to an Ethernet frame, known as an 802.1Q tag, we can have VLANs. Since the VLAN tag is an integer from 1 to 4094, it would seem that we are limited to 4094 VLANs (or 4093, since we are not supposed to use 1 as a tag), but by using QinQ tagging, we can nest VLAN tags, making it possible to have a much greater number of VLANs on our private network (in fact, a much greater number of VLANs than we would probably ever need).

In step 5 of this recipe, we referenced the VLAN priority level. This is a feature added to pfSense with version 2.3 that allows you to define a class of service for your VLAN. It is a 3 bit field from 0 to 7. Somewhat counter-intuitively, 1 is the lowest priority level (background), while 7 is the highest, and 0 is best effort treatment, which is one step above the lowest priority level.

There's more...

In order to utilize VLANs on your network, you need one or more managed switches. These are switches that recognize 802.1Q tags placed in the Ethernet frame by pfSense, and which will forward the frames to the correct port. Managed switches are never plug and play, they always involve some configuration, so consult your switch’s documentation for details on how to configure it.

See also

  • The Configuring VLANs from the console recipe

Assigning interfaces from the console

This recipe describes how to assign interfaces using the console menu.

Getting ready

In order to complete this recipe, you will need at least one unassigned interface.

How to do it...

  1. On the console menu, press 1 and press Enter.
  2. The first option will be for setting up VLANs. Since we don’t want to set up VLANs now, press n and Enter:
  1. You will be prompted to enter the WAN interface name. Here, you must enter the device name for the interface that will be the WAN interface (for example, eth0, eth1, em0, em1, and so on). Enter the appropriate device name and press Enter.
  2. You will be prompted to enter the LAN interface name, or nothing if finished. You only need to assign the WAN interface (in which case you will be able to log into pfSense using the WAN IP address). However, if you want to assign an interface to LAN, enter the device name and press Enter. Otherwise, just press Enter.
  3. If there are more than two network interfaces, you can assign optional interfaces at the console. To do so, enter the device name and press Enter. Otherwise, just press Enter.
  4. The interface assignments will be listed, and you will be asked whether you want to proceed. Pressing n and Enter will result in no changes being made, while pressing y and Enter will commit the changes.
  5. If you pressed y and Enter, the changes will be written and the settings will be reloaded. You will then be returned to the console menu.

How it works...

In this recipe, we were able to assign interfaces (which was done earlier in the chapter via the web GUI) from the console. Many configurations can be done from the console—we can even restore earlier configurations and run utilities—and in this book, we will take advantage of this functionality.

See also

  • The Configuring a WAN interface from the console recipe
  • The Configuring a LAN interface from the console recipe
  • The Configuring optional interfaces from the console recipe
  • The Configuring VLANs from the console recipe

Configuring a WAN interface from the console

This recipe describes how to configure the WAN interface from the Console menu.

Getting ready

In order to complete this recipe, the WAN interface must have previously been assigned to one of the available network interfaces.

How to do it...

  1. On the console menu, type 2 and press Enter.
  2. pfSense will prompt you for the number of the interface you want to configure. For the WAN interface, this will be 1, so type 1 and press Enter.
  1. pfSense will ask you if you want to configure the IPv4 WAN address through DHCP. In most cases, you will want to type y, because the WAN interface address will be assigned by your ISP via DHCP. Type y and press Enter. If you enter n, pfSense will prompt you for a WAN IPv4 address, and then the subnet bit count:
  1. pfSense will ask you whether you want to configure the IPv6 WAN address through DHCP6. You can type y if your ISP supports IPv6 addressing, or type n, in which case IPv6 addressing for the WAN interface will be disabled.
  2. pfSense will ask you whether you want to revert to HTTP for the webConfigurator protocol. Unless you have a reason for not using HTTPS for the web GUI, type n and press Enter.
  3. The configuration process is now complete. The settings will be saved and pfSense will reload them.

How it works...

This recipe describes how to configure the WAN interface via the console instead of through the web GUI. Note that the options are much more limited than they are in the web GUI. For example, you only have the option to configure an IPv4 address via DHCP or use a static address. None of the other options, such as PPP or PPPoE are available. Also, with IPv6, the only option is DHCP6. If you require more options that are available here, use the web GUI.

See also

  • The Assigning interfaces from the console recipe
  • The Configuring a LAN interface from the console recipe
  • The Configuring optional interfaces from the console recipe
  • The Configuring VLANs from the console recipe
  • The Configuring a WAN interface recipe

Configuring a LAN interface from the console

This recipe describes how to configure the LAN interface from the Console menu.

Getting ready

In order to complete this recipe, the LAN interface must have previously been assigned to one of the available network interfaces.

How to do it...

  1. On the console menu, type 2 and press Enter.
  2. pfSense will prompt you for the number of the interface you want to configure. For the LAN interface, this will be 2, so type 2 and press Enter.
  3. pfSense will prompt you for the new LAN IPv4 address. Enter the new address and press Enter:

  1. pfSense will prompt you for the subnet bit count (the CIDR). Enter the bit count and press Enter.
  2. pfSense will prompt you for the new LAN IPv4 upstream gateway address. You don’t need to specify an upstream gateway, so just press Enter.
  3. pfSense will prompt you for the new LAN IPv6 address. If you want to specify an IPv6 address, type it here; otherwise, just press Enter.
  4. If you entered an IPv6 address, pfSense will prompt you for the subnet bit count (CIDR). Enter the bit count and press Enter.
  1. If you entered an IPv6 address, pfSense will prompt you for the new LAN IPv6 upstream gateway address. You don’t need to specify an upstream gateway, so just press Enter.
  2. pfSense will ask whether you want to enable the DHCP server on LAN. If you enter y, you will then be prompted for the start and end addresses of the IPv4 client address range. You can enter y and type the start and end addresses, or just enter n and set up DHCP later on (recommended).
  3. If you entered an IPv6 address, pfSense will ask if you want to enable the DHCP6 server on LAN. If you enter y, you will then be prompted for the start and end addresses of the IPv6 client address range. You can enter y and type the start and end addresses, or just enter n and set up DHCP6 later on (recommended).
  4. pfSense will ask you whether you want to revert to HTTP for the webConfigurator protocol. Unless you have a reason for not using HTTPS for the web GUI, type n and press Enter.
  5. The configuration process is now complete. The settings will be saved and pfSense will reload them.

How it works...

This recipe described how to set up a LAN interface’s IP address using the console instead of the web GUI. Note that this option also allows you to set up the DHCP (or DHCP6) server, although it does not provide as many options as the web GUI. As with configuring a WAN interface, you may find it necessary to do the configuration via the web GUI, as the console only provides limited options.

See also

  • The Assigning interfaces from the console recipe
  • The Configuring a WAN interface from the console recipe
  • The Configuring optional interfaces from the console recipe
  • The Configuring VLANs from the console recipe
  • The Configuring a LAN interface recipe

Configuring optional interfaces from the console

This recipe describes how to configure optional interfaces from the console menu.

Getting ready

In order to complete this recipe, at least one optional interface must have previously been assigned to one of the available network interfaces.

How to do it...

  1. On the console menu, type 2 and press Enter.
  2. pfSense will prompt you for the number of the interface you want to configure. Type the appropriate number and press Enter.
  3. pfSense will prompt you for the new LAN IPv4 address. Enter the new address and press Enter.
  4. pfSense will prompt you for the subnet bit count (the CIDR). Enter the bit count and press Enter.
  5. pfSense will prompt you for the new LAN IPv4 upstream gateway address. You don’t need to specify an upstream gateway, so just press Enter.
  6. pfSense will prompt you for the new LAN IPv6 address. If you want to specify an IPv6 address, type it here; otherwise, just press Enter.
  7. If you entered an IPv6 address, pfSense will prompt you for the subnet bit count (CIDR). Enter the bit count and press Enter.
  8. If you entered an IPv6 address, pfSense will prompt you for the new LAN IPv6 upstream gateway address. You don’t need to specify an upstream gateway, so just press Enter.
  9. pfSense will ask whether you want to enable the DHCP server on LAN. If you enter y, you will then be prompted for the start and end addresses of the IPv4 client address range. You can enter y and type the start and end addresses, or just enter n and set up DHCP later on (recommended).
  1. If you entered an IPv6 address, pfSense will ask whether you want to enable the DHCP6 server on LAN. If you enter y, you will then be prompted for the start and end addresses of the IPv6 client address range. You can enter y and type the start and end addresses, or just enter n and set up DHCP6 later on (recommended).
  2. pfSense will ask you if you want to revert to HTTP for the webConfigurator protocol. Unless you have a reason for not using HTTPS for the web GUI, type n and press Enter.
  3. The configuration process is now complete. The settings will be saved and pfSense will reload them. Repeat the process for as many optional interfaces as you wish to configure.

How it works...

This recipe describes how to set up interfaces such as an interface for a DMZ.

See also

  • The Assigning interfaces from the console recipe
  • The Configuring a WAN interface from the console recipe
  • The Configuring a LAN interface from the console recipe
  • The Configuring VLANs from the console recipe
  • The Configuring optional interfaces recipe

Configuring VLANs from the console

This recipe describes how to add a VLAN from the console menu.

Getting ready

In order to complete this recipe, there must be at least one interface that was not previously assigned.

Do not use the console if you don’t want to have to reassign all the interfaces (for example, WAN, LAN, and any optional interfaces), because the only way to create VLANs from the console is to use the Assign Interfaces option.

How to do it...

  1. From the console menu, type 1 and press Enter.
  2. pfSense will ask if VLANs should be created now. Type y and press Enter.
  3. pfSense will next warn you that if you proceed, all existing VLANs will be cleared. Type y and press Enter:
  1. pfSense will list all the VLAN-capable interfaces. Although, technically, you can make a previously-assigned interface into the parent interface of a VLAN, it is not recommended. Type the name of one of the unassigned interfaces (for example, eth0, eth1, em0, or em1) and press Enter.
  2. pfSense will next prompt you for the VLAN tag. Type the VLAN tag and press Enter.
  3. Repeat steps 4 and 5 for as many VLANs as you wish to create. When you are done, press Enter.
  4. pfSense will prompt you for the name of the WAN interface; type in the name and press Enter.
  5. pfSense will prompt you for the name of the LAN interface; type in the name and press Enter.
  6. pfSense will prompt you for the name of the Optional 1 interface. You can create a VLAN by using the name of the VLAN interface(s) assigned in steps 4 and 5. The name of the interface will have two numbers separated by a period. The first number will be the device number of the interface; the second number (after the period) will be the VLAN tag. Thus if the device name is em, and em2 is the parent interface of a VLAN tag of 3, the interface name will be em2.3. Type the interface name and press Enter.
  7. When you are done assigning interfaces, press Enter.
  8. pfSense will ask you whether you want to proceed. Type y and press Enter. Take note of the name of the newly created VLAN (for example, OPT1).
  9. You now have assigned a VLAN, but the VLAN doesn’t have an IP address. To set the VLAN’s IP address, type 2 and press Enter.
  10. Find the newly created VLAN in the list of interfaces and type the appropriate number and press Enter.
  11. pfSense will prompt you for the VLAN’s IPv4 address. Type in the address and press Enter.
  12. pfSense will prompt you for the subnet bit count (CIDR) of the address. Type in the bit count and press Enter.
  13. pfSense will prompt you for the IPv4 upstream gateway address. Since you don't need one, press Enter.
  14. PfSense will prompt you for the VLAN’s IPv6 address. You can type in an IPv6 address or just press Enter.
  15. If you entered an IPv6 address, pfSense will prompt you for the subnet bit count (CIDR). Enter the bit count and press Enter. If you didn’t enter an IPv6 address, skip to step 20.
  1. If you entered an IPv6 address, pfSense will prompt you for the IPv6 upstream gateway address. Since you don't need one, press Enter.
  2. pfSense will ask you whether you want to enable the DHCP server on the VLAN. Type y if you want to enable the DHCP server, and then type the range of available addresses. Otherwise, type n and press Enter.
  3. If you entered an IPv6 address pfSense will ask you whether you want to enable the DHCP6 server on the VLAN. Type y if you want to enable the DHCP6 server, and then type the range of available addresses. Otherwise, type n and press Enter.
  4. pfSense will ask you whether you want to revert to HTTP for the webConfigurator protocol. Unless you have a reason for not using HTTPS for the web GUI, type n and press Enter.
  5. pfSense will save the changes, and reload them. VLAN configuration is now complete.

How it works...

This recipe describes how to set up VLANs from the console. The process is somewhat cumbersome, but if you need to create a VLAN and don't have access to the web GUI, it can be done.

See also

  • The Configuring VLANs recipe

Left arrow icon Right arrow icon

Key benefits

  • Build a high-availability fault-tolerant security system with pfSense 2.x
  • Leverage the latest version of pfSense to secure your cloud environment
  • A recipe-based guide that will help you enhance your on-premise and cloud security principles

Description

pfSense is an open source distribution of the FreeBSD-based firewall that provides a platform for ?exible and powerful routing and firewalling. The versatility of pfSense presents us with a wide array of configuration options, which makes determining requirements a little more difficult and a lot more important compared to other offerings. pfSense 2.x Cookbook – Second Edition starts by providing you with an understanding of how to complete the basic steps needed to render a pfSense firewall operational. It starts by showing you how to set up different forms of NAT entries and firewall rules and use aliases and scheduling in firewall rules. Moving on, you will learn how to implement a captive portal set up in different ways (no authentication, user manager authentication, and RADIUS authentication), as well as NTP and SNMP configuration. You will then learn how to set up a VPN tunnel with pfSense. The book then focuses on setting up traffic shaping with pfSense, using either the built-in traffic shaping wizard, custom ?oating rules, or Snort. Toward the end, you will set up multiple WAN interfaces, load balancing and failover groups, and a CARP failover group. You will also learn how to bridge interfaces, add static routing entries, and use dynamic routing protocols via third-party packages.

Who is this book for?

This book is intended for all levels of network administrators. If you are an advanced user of pfSense, then you can flip to a particular recipe and quickly accomplish the task at hand; if you are new to pfSense, on the other hand, you can work through the book chapter by chapter and learn all of the features of the system from the ground up.

What you will learn

  • Configure the essential pfSense services (namely, DHCP, DNS, and DDNS)
  • Create aliases, firewall rules, NAT port-forward rules, and rule schedules
  • Create multiple WAN interfaces in load-balanced or failover configurations
  • Configure firewall redundancy with a CARP firewall failover
  • Configure backup/restoration and automatic configuration-file backup
  • Configure some services and perform diagnostics with command-line utilities
Estimated delivery fee Deliver to Indonesia

Standard delivery 10 - 13 business days

$12.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 17, 2018
Length: 298 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789806427
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Indonesia

Standard delivery 10 - 13 business days

$12.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Publication date : Dec 17, 2018
Length: 298 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789806427
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Mastering pfSense
$54.99
pfSense 2.x Cookbook
$48.99
Learn pfSense 2.4
$48.99
Total $ 152.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Initial Configuration Chevron down icon Chevron up icon
Essential Services Chevron down icon Chevron up icon
Firewall and NAT Chevron down icon Chevron up icon
Additional Services Chevron down icon Chevron up icon
Virtual Private Networking Chevron down icon Chevron up icon
Traffic Shaping Chevron down icon Chevron up icon
Redundancy, Load Balancing, and Failover Chevron down icon Chevron up icon
Routing and Bridging Chevron down icon Chevron up icon
Services and Maintenance Chevron down icon Chevron up icon
Backing Up and Restoring pfSense Chevron down icon Chevron up icon
Determining Hardware Requirements Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Robert P. Dec 25, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Greatest book on pfsense on the internet. The author really knows what he’s talking about and makes it easy to understand. Would recommend for anyone to read interested in this topic
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela