pfsense:vlan_virtual_lan:set_up_a_vlan
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pfsense:vlan_virtual_lan:set_up_a_vlan [2021/02/16 14:07] – peter | pfsense:vlan_virtual_lan:set_up_a_vlan [2021/02/16 14:58] (current) – [Block Access to LAN when on VLAN 20] peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PFSense - VLAN (Virtual LAN) - Set up a VLAN ====== | ====== PFSense - VLAN (Virtual LAN) - Set up a VLAN ====== | ||
+ | ===== Create the VLAN ===== | ||
- | <WRAP info> | + | Navigate to **Interfaces -> Assignments**. |
- | **NOTE:** A few things to keep in mind: | + | |
- | VLAN 20 will be used in this example. You can substitute a different VLAN but for the purposes of this tutorial VLAN 20 is used. | + | Select **VLANs**. |
- | VLAN 20 will be assigned | + | * Click the **Add** button. |
+ | * Parent Interface: | ||
+ | * VLAN Tag: **20**. Use any unique number from 2 to 4096. Here 20 is used as an example. | ||
+ | * VLAN Priority: **0**. | ||
+ | * Description: | ||
+ | * Click **Save**. | ||
- | DNS Resolver is enabled for ALL interfaces (Services –> DNS Resolver). | + | <WRAP info> |
+ | **NOTE**: | ||
+ | |||
+ | * **VLAN Tag**: | ||
+ | * VLAN 0 is used when a device needs to send priority-tagged frames but does not know in which particular VLAN it resides. | ||
+ | * VLAN 1 is the default native VLAN for the LAN, and used for untagged traffic. | ||
+ | * **VLAN Priority**: | ||
</ | </ | ||
Line 15: | Line 26: | ||
---- | ---- | ||
- | ===== Steps to setup VLAN ===== | + | ===== Setup an Interface for the VLAN ===== |
- | ==== Create the VLAN ==== | + | Navigate to **Interfaces Assignments**. |
- | Navigate to **Interfaces -> Assignments**. | + | Against |
- | Select | + | |
+ | * Click **Save**. | ||
- | * * Click on the **Add** button. | + | Click the interface link for **OPT1**. |
- | * Parent Interface: **em1**. Typically this is the LAN port. | + | |
- | * VLAN Tag: **20**. | + | In **General Configuration**: |
- | * VLAN Priority: **0**. | + | |
- | * Description: **VLAN 20**. | + | * Enable: **Checked**. |
+ | * Description: **VLAN20**. | ||
+ | * IPv4 Configuration Type: **Static IPv4**. | ||
+ | * IPv6 Configuration Type: **None**. | ||
+ | |||
+ | |||
+ | In **Static IPv4 Configuration**: | ||
+ | |||
+ | * IPv4 Address: **192.168.20.1**. | ||
+ | * Click the drop-down for the Subnet Mask and select **24**. | ||
* Click **Save**. | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
<WRAP info> | <WRAP info> | ||
- | **NOTE: | + | **NOTE:** The VLAN interface is now created. |
- | * **VLAN | + | * It has a VLAN ID of 20. |
- | * VLAN 0 is used when a device needs to send priority-tagged frames but does not know in which particular | + | |
- | * VLAN 1 is the default native VLAN for the LAN, and used for untagged traffic. | + | |
- | | + | * This is simply |
+ | * However just because the VLAN ID is 20 does NOT mean that the IP also has to have a **20** in it. | ||
</ | </ | ||
Line 42: | Line 65: | ||
---- | ---- | ||
- | Navigate to **Interfaces Assignments**. | + | ===== DHCP Server for VLAN 20 ===== |
- | - For **“Available network ports”**: **Click** the drop down arrow and Choose **VLAN 20 on em1** | + | Navigate to **Services |
- | | + | |
- | - **Click** on the blue **Save** | + | |
- | - **Click** on the interface link for **OPT1** | + | |
- | - Fill out this information below: | + | |
- | - General Configuration | + | |
- | - Enable Interface: **checked** | + | |
- | - Description: | + | |
- | - IPv4 Configuration Type: **Static IPv4** | + | |
- | - Static IPv4 Configuration | + | |
- | - IPv4 Address: 192.168.20.1 | + | |
- | - **Click** the **dropdown** for the Subnet Mask and select **24**. | + | |
- | - **Click** on the blue **Save** | + | |
- | - **Click** on the green **Apply Changes** button at the top. | + | |
- | **Great! You’ve got a VLAN.** | + | |
+ | |||
+ | In **General Options**: | ||
- | It’s on VLAN 20 and it’s IP interface is set to 192.168.20.1. | + | * Enable: **Checked**. |
+ | * Range: **192.168.20.100** | ||
+ | * Click **Save**. | ||
- | Keep in mind, just because it’s VLAN 20 doesn’t mean the subnet has to contain the “20” in it’s IP of 192.168.20.1. | + | <WRAP info> |
+ | **NOTE: | ||
- | We just find it makes it easier to keep the numbers the same as it’s easier in identifying particular settings and connected clients later. | + | Change this as needed. |
- | Now in order for this VLAN interface to start issuing IP addresses we need to configure a DHCP Server for it. Read on. | + | </ |
---- | ---- | ||
- | ===== DHCP Server for VLAN 20 ===== | + | ===== Firewall Rules ===== |
- | - **Login** to **pfSense** (you’re probably still in pfSense but just in case you’re not you gotta log back in) | + | To allow the VLAN to get out to the Internet a firewall rule is needed. |
- | - **Click** on **Services -> DHCP Server** | + | |
- | - **Click** on **Opt1VLAN20** (link on the upper menu) | + | |
- | - Enable: **Checked** | + | |
- | - Range: **168.20.100** | + | |
- | - **Click** on the blue **Save** | + | |
- | **Perfect! | + | Additional restrictions can be set against client of the VLAN with additional |
- | + | ||
- | However, we have to create some firewall rules to get out to the Internet. | + | |
---- | ---- | ||
- | ===== Firewall Rules ===== | + | ===== Allowing VLAN 20 Clients Internet Access |
- | There are a few rules we need to setup for VLAN 20. | + | Navigate |
- | Most importantly, | + | * Select the VLAN Name along the top. For this example select **VLAN20** or whatever name you gave the VLAN. |
- | Perhaps you want to restrict clients on VLAN from accessing devices | + | * Click on an **Add** button. |
+ | * Action: **Pass**. | ||
+ | * Interface: | ||
+ | * Protocol: **Any** | ||
+ | * Source: | ||
+ | * Invert Match: | ||
+ | * Source: **Any** | ||
+ | * Description: | ||
+ | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
- | What about NOT allowing | + | <WRAP info> |
+ | **NOTE: | ||
+ | </ | ||
- | So below are some rules you may need to configure depending on what you want VLAN 20 to have access to. | ||
+ | <WRAP info> | ||
+ | **NOTE: | ||
- | **One hugely important thing about Firewall Rules**. | + | The reason: |
* Let’s say a device is on the VLAN20 network and it is constantly accessing something on the LAN. | * Let’s say a device is on the VLAN20 network and it is constantly accessing something on the LAN. | ||
Line 109: | Line 129: | ||
* When you do this any and all open states that exist will be broken. | * When you do this any and all open states that exist will be broken. | ||
- | ---- | + | </WRAP> |
- | + | ||
- | ===== Allowing VLAN 20 Clients Internet Access ===== | + | |
- | + | ||
- | - **Login** to **pfSense** (once again, you’re probably still in pfSense but just in case you’re not you know the drill) | + | |
- | - **Click** on **Firewall –> Rules** | + | |
- | - **Click** on **Opt1VLAN20** (link on the upper menu) | + | |
- | - **Click** on the green **Add** button | + | |
- | - Fill out this information below: | + | |
- | - Edit Firewall Rule | + | |
- | - Action: **Pass** | + | |
- | - Interface: **OPT1VLAN20** | + | |
- | - Protocol: **Any** | + | |
- | - Source | + | |
- | - Source: **Any** | + | |
- | - Extra Options | + | |
- | - Description: | + | |
- | - **Click** on the blue **Save** | + | |
- | - **Click** on **Apply Changes**. | + | |
- | + | ||
- | At this point, clients on VLAN 20 that are issued IP addresses on the 192.168.20.0 subnet should be able to get out to the Internet. | + | |
---- | ---- | ||
Line 184: | Line 184: | ||
===== Block Access to LAN when on VLAN 20 ===== | ===== Block Access to LAN when on VLAN 20 ===== | ||
- | <WRAP important> | + | Navigate to **Firewall -> Rules** |
- | **IMPORTANT NOTE:** If you use an **unmanaged switch** this will not work as trying to restrict a client on VLAN 20 from accessing a device on the LAN doesn’t have anything to do with pfSense at that point. | + | |
- | The unmanaged switch is “before” pfSense. | + | * Click on **VLAN20**: |
+ | * Click the **Add** button (up arrow), so this needs to be the first rule in the list. | ||
+ | * Action: | ||
+ | * Interface: **VLAN20**. | ||
+ | * Protocol: **Any**. | ||
+ | * Source: | ||
+ | * Source: | ||
+ | * Destination: | ||
+ | * Description: | ||
+ | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
- | When we setup Wireless Access Points that have VLAN capabilities they have managed switches built into them. We often use Ubiquiti Wireless Access Points. | + | < |
- | </WRAP> | + | **IMPORTANT NOTE:** |
- | + | ||
- | - **Click** on **Firewall -> Rules** | + | |
- | - **Click** | + | |
- | - **Click** on the green **Add** button (up arrow), so this needs to be the first rule in the list. | + | |
- | - Fill out this information below: | + | |
- | - Edit Firewall Rule | + | |
- | * Action: **Block** | + | |
- | * Interface: **OPT1VLAN20** | + | |
- | * Protocol: **Any** | + | |
- | - Source | + | |
- | * Source: **OPT1VLAN20 net** | + | |
- | * Destination: | + | |
- | - Extra Options | + | |
- | | + | |
- | - **Click** on the blue **Save** button. | + | |
- | - **Click** on the green **Apply Changes** button at the top. | + | |
+ | * An unmanaged switch just does not have the capability built into it to handle VLAN traffic. | ||
+ | * Trying to restrict a client on a VLAN from accessing a device on the LAN has nothing to do with pfSense at that point. | ||
+ | * A managed switch is needed for this. | ||
+ | This limitation does not necessarily apply to Wireless Access Points that have VLAN capabilities (such as Ubiquiti Wireless Access Points); as they have managed switches built into them. | ||
+ | </ | ||
pfsense/vlan_virtual_lan/set_up_a_vlan.1613484476.txt.gz · Last modified: 2021/02/16 14:07 by peter