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 13:31] – 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**. | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE**: | ||
- | DNS Resolver is enabled | + | * **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 ===== |
- | - **Login** | + | Navigate |
- | - **Click** on **Interfaces | + | |
- | - **Click** on **VLANs** (link on the upper menu) | + | |
- | - **Click** on the Green **Add** button | + | |
- | - Fill out this information below on the VLAN Configuration | + | |
- | - Parent Interface: **em1** (typically this is the LAN port) | + | |
- | - VLAN Tag: **20** | + | |
- | - VLAN Priority: **0** | + | |
- | - Description: | + | |
- | - **Click** on the blue **Save** button | + | |
- | - **Click** on **Interfaces Assignments** | + | |
- | - For **“Available network ports”**: **Click** the drop down arrow and Choose **VLAN 20 on em1** | + | |
- | - **Click** on the green **Add** | + | |
- | - **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.** | + | Against **Available network ports**, click the drop down arrow and Choose |
- | It’s on VLAN 20 and it’s IP interface is set to 192.168.20.1. | + | * Click **Add**. |
+ | * 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. | + | Click the interface link for **OPT1**. |
- | 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. | + | In **General Configuration**: |
- | Now in order for this VLAN interface to start issuing | + | * Enable: |
+ | * Description: | ||
+ | * IPv4 Configuration Type: **Static IPv4**. | ||
+ | * IPv6 Configuration Type: **None**. | ||
+ | |||
+ | |||
+ | In **Static IPv4 Configuration**: | ||
+ | |||
+ | * IPv4 Address: | ||
+ | * Click the drop-down | ||
+ | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * It has a VLAN ID of 20. | ||
+ | * It has an IP address of 192.168.20.1. | ||
+ | * Notice that the IP Address and VLAN ID both have a **20**. | ||
+ | * This is simply used for convenience, | ||
+ | * However just because the VLAN ID is 20 does NOT mean that the IP also has to have a **20** in it. The IP can be any internal IP. | ||
+ | |||
+ | </ | ||
---- | ---- | ||
Line 57: | Line 67: | ||
===== DHCP Server for VLAN 20 ===== | ===== DHCP Server for VLAN 20 ===== | ||
- | - **Login** | + | Navigate |
- | - **Click** on **Services -> DHCP Server** | + | |
- | - **Click** on **Opt1VLAN20** (link on the upper menu) | + | |
- | - Enable: **Checked** | + | |
- | - Range: **168.20.100** to **192.168.20.150** (We’re simply going to issue 50 leases out for this VLAN. You can change this if you need more DHCP IP addresses) | + | |
- | - **Click** on the blue **Save** | + | |
- | **Perfect! | + | |
+ | |||
+ | In **General Options**: | ||
- | However, we have to create some firewall rules to get out to the Internet. | + | * Enable: **Checked**. |
+ | * Range: **192.168.20.100** | ||
+ | * Click **Save**. | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | Change this as needed. | ||
+ | |||
+ | </ | ||
---- | ---- | ||
Line 72: | Line 88: | ||
===== Firewall Rules ===== | ===== Firewall Rules ===== | ||
- | There are a few rules we need to setup for VLAN 20. | + | To allow the VLAN to get out to the Internet a firewall rule is needed. |
- | Most importantly, | + | Additional restrictions can be set against client of the VLAN with additional firewall rules. |
- | Perhaps you want to restrict clients on VLAN from accessing devices on the LAN. We need a rule for that. | + | ---- |
- | What about NOT allowing clients on VLAN 20 to even get to the pfSense web interface. | + | ===== Allowing |
- | So below are some rules you may need to configure depending on what you want VLAN 20 to have access to. | + | Navigate |
+ | * Select the VLAN Name along the top. For this example select **VLAN20** or whatever name you gave the VLAN. | ||
+ | |||
+ | * Click on an **Add** button. | ||
+ | * Action: **Pass**. | ||
+ | * Interface: | ||
+ | * Protocol: **Any** | ||
+ | * Source: | ||
+ | * Invert Match: | ||
+ | * Source: **Any** | ||
+ | * Description: | ||
+ | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | |||
+ | <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 93: | 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 119: | Line 135: | ||
===== Denying VLAN 20 Clients to the pfSense Web GUI ===== | ===== Denying VLAN 20 Clients to the pfSense Web GUI ===== | ||
- | Often times when setting up VLANs you are doing this for a reason. | + | ===== Add an Alias for the pfSense GUI ===== |
- | You are restricting VLAN clients from accessing certain things on your network. | + | Navigate to **Firewall –> Aliases**. |
- | Typically, we use VLANs for our Wireless Guest Clients. | + | * **Click** on the green **Add** |
+ | * Name: **pfSenseGUI** | ||
+ | * Description: | ||
+ | * Type: **Hosts(s)** | ||
+ | * IP or FQDN: **Enter the IP of the actual pfSense**. | ||
- | It’s fine for them to have Internet. | + | ---- |
- | However, you probably don’t want them even seeing the pfSense web GUI….why should they? So let’s block them from getting to the pfSense Web GUI when on VLAN 20. | + | ==== Firewall Rules ==== |
+ | Navigate to **Firewall –> Rules**. | ||
+ | |||
+ | * Select **Floating**: | ||
+ | * **Click** on a green **Add** button. | ||
+ | * Action: **Block**. | ||
+ | * Quick: **Checked**. | ||
+ | * Interface: | ||
+ | * Direction: **in**. | ||
+ | * Address family: | ||
+ | * Protocol: **TCP\UDP**. | ||
+ | * Source: | ||
+ | * Invert Match: | ||
+ | * Source: **any** | ||
+ | * Destination: | ||
+ | * Invert Match: | ||
+ | * Destination: | ||
+ | * **Single host or alias** | ||
+ | * Destination Address: | ||
+ | * Destination Port Range: | ||
+ | * From: **HTTPS (443)**. | ||
+ | * To: **HTTPS (443)**. | ||
+ | * Description: | ||
+ | * Click **Save**. | ||
+ | * Click **Apply Changes** at the top. | ||
<WRAP info> | <WRAP info> | ||
- | **Keep in mind: | + | **NOTE: |
- | However, if this is in the HTTPS setting we will need to change | + | To ensure that access |
</ | </ | ||
- | |||
- | - **Click** on **Firewall –> Aliases** | ||
- | - **Click** on the green **Add** | ||
- | - Fill out this information below: | ||
- | - Properties | ||
- | - Name: **pfSenseGUIAccess** | ||
- | - Description: | ||
- | - Type: **Hosts(s)** | ||
- | - Host(s) | ||
- | - IP or FQDN: **this will be the IP of pfSense**. | ||
- | - **Note: | ||
- | - IP or FQDN: **168.20.1** (this is the IP of the VLAN 20 we used earlier) | ||
- | - **Click** on the blue **Save** | ||
- | - **Click** on the green **Apply Changes** button at the top. | ||
- | - **Click** on **Firewall –> Rules** | ||
- | - **Click** on **Floating** (link on the upper menu) | ||
- | - **Click** on the green **Add** | ||
- | - Fill out this information below: | ||
- | - Edit Firewall Rule | ||
- | - Action: **Block** | ||
- | - Quick: **Checked** | ||
- | - Interface: **Click** on **OPT1VLAN20** to select it | ||
- | - Protocol: **TCP\UDP** | ||
- | - Direction: **in** | ||
- | - Source | ||
- | - Source: **any** | ||
- | - Destination | ||
- | - Destination: | ||
- | - **Single host or alias** | ||
- | - **pfSenseGUIAccess** (you have to type that in) | ||
- | - Destination Port Range: | ||
- | - From: **HTTP (80)** (Keep in mind, if pfSense is set to HTTPS this needs to be HTTPS (443) | ||
- | - To: **HTTP (80)** (Keep in mind, if pfSense is set to HTTPS this needs to be HTTPS (443) | ||
- | - Extra Options | ||
- | - Description: | ||
- | - **Click** on the blue **Save** | ||
- | - **Click** on the green **Apply Changes** button at the top. | ||
---- | ---- | ||
===== Block Access to LAN when on VLAN 20 ===== | ===== Block Access to LAN when on VLAN 20 ===== | ||
+ | |||
+ | Navigate to **Firewall -> Rules** | ||
+ | |||
+ | * 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. | ||
<WRAP important> | <WRAP important> | ||
- | **IMPORTANT NOTE: | + | **IMPORTANT NOTE: |
- | The unmanaged switch | + | * An unmanaged switch |
+ | * Trying to restrict a client on a VLAN from accessing a device on the LAN has nothing | ||
+ | * A managed switch | ||
- | When we setup Wireless Access Points that have VLAN capabilities they have managed switches built into them. We often use Ubiquiti Wireless Access Points. | + | This limitation does not necessarily apply to Wireless Access Points that have VLAN capabilities |
</ | </ | ||
- | |||
- | - **Click** on **Firewall -> Rules** | ||
- | - **Click** on **Opt1VLAN20** (link on the upper menu) | ||
- | - **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 | ||
- | * Description: | ||
- | - **Click** on the blue **Save** button. | ||
- | - **Click** on the green **Apply Changes** button at the top. | ||
- | |||
- | |||
pfsense/vlan_virtual_lan/set_up_a_vlan.1613482286.txt.gz · Last modified: 2021/02/16 13:31 by peter