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

Arrow left icon
Profile Icon David Zientara
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Dec 2018 298 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon David Zientara
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Dec 2018 298 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 [email protected].
  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 [email protected].

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

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 a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

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
€18.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
€189.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
€264.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 115.97
Mastering pfSense
€41.99
pfSense 2.x Cookbook
€36.99
Learn pfSense 2.4
€36.99
Total 115.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 included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.