Changes between Initial Version and Version 1 of Cnbp2022/Agenda/pfSenseSetup


Ignore:
Timestamp:
Feb 19, 2022, 7:01:03 PM (3 years ago)
Author:
geethike
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Cnbp2022/Agenda/pfSenseSetup

    v1 v1  
     1= Basic Firewall Setup =
     2== First Boot ==
     3In our previous Lab setup you have already imported preinstalled pfSense VM. In this tutorial we will go ahead with the pfSense basic setup which will be required to continue with future lab sessions. To start the pfSense lab go to Virtual Box and give a normal start to the pfSene VM. After  booting you will get a console screen with available options and summaries. pfSense console configuration interface has the basic configuration options in pfSense. You can select these options by typing their index number and pressing enter.
     4
     5=== Assign Interfaces ===
     6In this pfSense installation, we will have three networks connected to the pfSense firewall as WAN, LAN, and DMZ. Further, at the pfSense console you will see three network interfaces as '''em0''' , '''em1''' and '''em2''' just above the console configuration options. Here em0,em1 and em2 are consecutively the adapter 1, adapter 2 and adapter 3 in pfSense VM. At the Lab setup, we have already connected em1 to DMZ and em2 to LAN (FAC1) through UDP tunnels. Further em0 connected to the WAN side. By now we will have a network setup as follows. ( You may vefiry these by cross checking the mac addresses shown in the console against the addresses assigned in the virtualbox vm settings network tab. )
     7
     8* Adapter 1 --> em0 --> WAN
     9* Adapter 2 --> em1 --> DMZ
     10* Adapter 3 --> em2 --> LAN
     11
     12[[Image(Network1.jpg,85%,border=1, center)]]
     13
     14But please notice that within pfSense configuration still, we have not assigned any of the above em0,em1,em2 interfaces to any of WAN, LAN or DMZ networks yet.
     15
     16* To assign interfaces to networks press '''1''' and enter
     17* It will ask you to assign VLANs, press '''N''' as we don't need it now.
     18* Then it will ask which interface to use as '''WAN''' interface. To select '''em0''' as WAN interface type '''em0''' and press '''enter'''
     19* Next, it will ask which interface to use as LAN interface. In this setup, we are going to assign em1 as DMZ interface. But by default pfSense installation we will not have an interface called DMZ by default. For an example, multi-port pfSense will have interfaces WAN, LAN, OPT1, OPT2 .. etc. Since our pfSense have three interfaces it will have interfaces WAN, LAN, and OPT1.  To create a DMZ interface we will have to log in to web configurator of the pfSense. In order to do that we will use a GUI machine which is connected to DMZ. With initial pfSense setup, only LAN connected machines are allowed to access pfSense web configurator. Due to this reason temporarily we will assign em1 as the pfSense LAN interface so that we can log in pfSense web configurator through GUI. To select em1 as LAN interface type '''em1''' and press '''enter'''.
     20* Next we will avoid assigning em2 to any interface. Later from pfsense web configurator, we will assign em1 as DMZ interface and em2 as LAN interface. For now, just enter to skip the step.
     21    • Do you want to proceed? press '''y''' to say yes and '''enter'''
     22
     23=== Assign WAN IP addresses ===
     24    • To change the interface IP address press '''2''' and '''enter'''
     25    • WAN IP is set by DHCP by default. To change the WAN interface IP Address press '''1''' and '''enter'''.
     26    • We are going to have a static IP for WAN Interface. So press n and enter to avoid pfSense to configure the interface IP by DHCP.
     27    • Enter the '''WAN IP address''' assigned to you as '''192.248.7.PQ''' and enter. Give a subnet mask as '''24''' and gateway in the next steps. You can find your IP allocation from the [wiki:Cnbp2019/Agenda/IpAllocation IP table], WANv4 gateway for the lab is '''192.248.7.254'''
     28    • Next, you will be asked to configure WAN Ipv6 address via DHCP. Press '''n''' and enter to avoid DHCP address.
     29    • In the next step enter the Ipv6 address of WAN interface. Enter '''2401:dd00:2000::ffXY''' as your WAN Ipv6 address and '''64''' as subnet mask. In the next step enter WANv6 gateway for lab as '''2401:dd00:2000::ffff'''
     30    • Press '''n''' and enter to disable http on WAN interface
     31    • You will be prompted back to main interface after pressing '''Enter''' when it prompts.
     32
     33=== Assign DMZ IP addresses ===
     34    • To change the interface IP address press '''2''' and '''enter'''
     35    • To change the LAN interface IP Address press '''2''' and '''enter'''.
     36    • Enter the LAN IP address as '''192.168.XY.254'''. Enter the subnet mask as '''24'''. We are going to have this IP address as our DMZ's gateway IP. Do not give any parameters to the gateway on LAN. Just press enter.
     37    • Enter the LAN IPv6 address as '''2401:DD00:20XY:0::FFFF'''. Enter the subnet mask as 64. We are going to have this IP address as our LAN's gateway IPv6. Do not give any parameters to the gateway on LAN. Just press enter.
     38    • To enable DHCP server on DMZ press '''y''' and press enter
     39    • For this workshop, our DMZ DHCP range is '''192.168.XY.10 to 192.168.XY.50'''. Give start and end IP addresses in the next steps.
     40    • When it asks to enable DHCP for IPv6 press '''n''' as we are not to enable dhcpv6 at this time
     41    • Press '''n''' and enter to disable http on WAN interface
     42    • You will be prompt back to the main interface.
     43
     44You have now set up both WAN and DMZ IP addresses.
     45
     46=== Reset WEB Configurator password ===
     47This step is optional as This step will reveal you the default user name and password for the web configurator. Press '''3''' and '''enter'''.
     48
     49Above the line 'Do you want to proceed' you will see the default username and password on the web access. Note down the default password and Press '''n'''
     50 
     51=== WebUI and Basic Configurations ===
     52pfSense by default allows you to do the configuration through its web user interface. Initially, LAN segment hosts are allowed to log in and therefore you need to have a device connected to its LAN.
     53 
     54Please double check your VM network connections before powering on the GUI vm. If all settings are satisfying, power on Virtual Machine.
     55Now log in to your GUI vm and from your GUI desktop firefox app, browse to http://<pfSense-DMZ-address>
     56
     57Default admin / pass are admin / pfsense
     58
     59The first visit to the WebGUI will be redirected to the setup wizard, which is also accessible at System > Setup Wizard. Proceed through the wizard as follows:
     60* Step 1: Next
     61* Step 2:
     62   * Hostname: pfsense
     63   * Domain: instXY.ac.lk
     64   * Primary DNS Server: 192.248.7.254
     65   * unset Overide DNS option
     66* Step 3:
     67   * Time Server hostname: 192.248.1.161
     68   * Timezone: !Asia/Colombo
     69* Step 4: Next
     70* Step 5: Next
     71* Step 6: Change admin password to the class password given for the lab
     72* Step 7: Reload
     73* Finish
     74* Accept
     75
     76After that, you will be directed to the Dashboard.
     77
     78=== Adding Firewall rule to allow connectivity from Lab ===
     79By default only hosts from pfSense LAN connected network is allowed to connect pfSense Web configurator. No connections will be allowed from any other interface. To allow connections from our Lab network (WAN side) we will add the below firewall rule.
     80
     81go to Firewall > Rules > WAN > Add to end
     82    • Action: pass
     83    • Interface: WAN
     84    • Address Family: IPv4
     85    • Protocol: TCP
     86    • Source: Network : 192.248.7.0/24
     87    • Destination: WAN address
     88    • Destination Port: Any, Any
     89    • Log: ticked
     90    • Description: Allow pfSense access from lab
     91
     92Save and Apply Changes
     93
     94Now you can use your host machine's web browser to log in to your pfSense web configurator using its WAN address.
     95
     96
     97=== Switch the LAN interface to back to DMZ ===
     98
     99Now we have assigned the em1 interface to pfSense LAN interface. Since we can now login to pfSense web configurator through host machine we will again switch LAN and DMZ networks. In order to do that we have to Rename LAN interface to DMZ. Now Login to pfSense through host machine using WAN IP address.
     100Go to Interfaces -> LAN
     101Change the description LAN to DMZ. Save and apply changes.
     102
     103=== Adding the LAN interface ===
     104Now pfSense do not have a LAN interface. The remaining interface em2 is assigned to an interface called OPT1. We will now rename the OPT1 to LAN.
     105
     106Go to Interfaces -> OPT1
     107
     108Change the description to LAN. Save and apply changes.
     109Now we have all the em0, em1 and em2 assigned to pfSense's WAN, DMZ and LAN respectively.
     110
     111=== Assign IP address to LAN ===
     112
     113Now we can assign LAN interface an IP from web interface.
     114
     115Go to Interfaces -> LAN
     116* Tick the '''enable'''
     117* Ipv4 Configuration Type : Static IPV4
     118* Ipv6 Configuration Type : Static IPV6
     119* Ipv4 Address : 10.XY.0.2 , Prefix length : 30
     120* Ipv4 Upstream gateway : none
     121* Ipv6 Address : 2401:dd00:20XY:1::ffff , Prefix length : 64
     122* Ipv6 Upstream gateway: none
     123
     124=== Add internal route ===
     125
     126Add internal route allow connectivity to LAN network, Before add an internal route we will need to add a Gateway to use for the route.
     127
     128go to System > Routing and go to Gateways tab. Click add button to add a  gateway.
     129
     130    • Interface: LAN
     131    • Address Family: IPv4
     132    • Name : LAN_GW
     133    • Gateway : 10.XY.0.1
     134    • Description : Gateway for LAN
     135 
     136[[span(style=color: #A00000,  ''' Again Click add button to add an IPv6 route ''' )]]
     137
     138    • Interface: LAN
     139    • Address Family: IPv6
     140    • Name : LAN_GWv6
     141    • Gateway : 2401:dd00:20XY:1::FFFE
     142    • Description : Gateway for LANv6
     143
     144 
     145go to System > Routing and go to static routes tab. Click add button to add a  route.
     146    • Destination network: 10.XY.0.0 , and select 16 as prefix length
     147    • Gateway: Select above-created 10.XY.0.1 gateway from drop-down list.
     148    • Description: LAN Network
     149
     150[[span(style=color: #A00000,  '''  Again Click add button to add an IPv6 route  ''' )]]
     151
     152    • Destination network: 2401:dd00:20XY:: , and select 48 as prefix length
     153    • Gateway: Select above-created 2401:dd00:20XY:1::FFFE gateway from drop-down list.
     154    • Description: LAN Network v6
     155
     156
     157=== Add a firewall rule to allow from LAN to outside ===
     158
     159go to Firewall > Rules > LAN > Add to end
     160    • Action: pass
     161    • Interface: LAN
     162    • Address Family: IPv4
     163    • Protocol: any
     164    • Source: Network : 10.XY.0.0/16
     165    • Destination: any
     166    • Log: ticked
     167    • Description: Allow outside from LAN
     168
     169[[span(style=color: #A00000,  '''  It is also required to allow IPv6 traffic from LAN to outside,  ''' )]]
     170
     171go to Firewall > Rules > LAN > Add to end
     172    • Action: pass
     173    • Interface: LAN
     174    • Address Family: IPv6
     175    • Protocol: any
     176    • Source: Network : 2401:dd00:20XY::/48
     177    • Destination: any
     178    • Log: ticked
     179    • Description: Allow outside from LAN for IPv6 Traffic
     180
     181go to Firewall > Rules > WAN > Add to end
     182    • Action: pass
     183    • Interface: WAN
     184    • Address Family: IPv6
     185    • Protocol: any
     186    • Source: any
     187    • Destination: Network : 2401:dd00:20XY::/48
     188    • Log: ticked
     189    • Description: Allow outside from LAN for IPv6 Traffic
     190
     191=== Dashboard ===
     192
     193The pfSense dashboard is the main page of the firewall, and it makes monitoring various aspects of the system easy. Returning to the dashboard can be accomplished by clicking the logo in the upper left, or by navigating to Status > Dashboard.
     194The Dashboard is composed of Widgets, each of which display information about a different area of the firewall including,
     195
     196    • Firewall Logs
     197    • Gateways
     198    • Interface Statistics
     199    • RSS Feed
     200    • Services Status
     201    • System Information
     202    • Thermal Sensors
     203    • Traffic Graphs
     204    • Wake on LAN
     205
     206A widget can be added to the dashboard by clicking + at the top of the screen, then choosing the widget from the list. Once the widget appears, its placement may be changed by dragging its title bar to another location on the screen. The widget will snap into place in one of two columns, and can be reordered as desired.
     207
     208Click Save Settings at the top of the screen after making any widget layout changes.
     209
     210Some widgets will have their own settings, which may be accessed by pressing the wrench icon in their title bar. To save these settings use the Save button inside the widget, not the button at the top of the page.
     211
     212==== General Setup ====
     213
     214Some basic/common settings are available under System > General Setup. Some useful settings are,
     215    • Hostname: The name by which this pfSense router is known. Should only include the portion before the first “.”.
     216    • Domain: The domain name in which this pfSense is used. Together with the hostname, this will form the Fully Qualified Domain Name (FQDN) of the firewall.
     217    • DNS Servers:
     218      The gateway selection for DNS servers is primarily used for Using Multiple IPv4 WAN Connections.
     219    • Time Zone:
     220    • NTP Time Server:
     221    • Language: The language to use for the GUI. Default is English
     222    • Theme: Changes the look and feel of the pfSense GUI, but not the functionality
     223
     224==== Interfaces ====
     225In this menu we can re-do assigning interfaces, assigning IP addresses etc. As we have already done that using CLI, we will skip this.