The Pfsense Book Copyright © 2019 Electric Sheep Fencing LLC
Total Page:16
File Type:pdf, Size:1020Kb
The pfSense Book Copyright © 2019 Electric Sheep Fencing LLC Netgate Sep 30, 2019 CONTENTS 1 Preface 2 1.1 Copyright Notice.............................................2 1.2 Acknowledgements...........................................2 1.3 Feedback.................................................4 1.4 Typographic Conventions........................................4 1.5 Authors..................................................6 2 Foreword 7 3 Introduction 8 3.1 What does pfSense stand for/mean?...................................8 3.2 Why FreeBSD?..............................................8 3.3 Common Deployments..........................................9 3.4 Interface Naming Terminology..................................... 10 3.5 Finding Information and Getting Help.................................. 11 3.6 Project Inception............................................. 12 4 Networking Concepts 13 4.1 Understanding Public and Private IP Addresses............................. 13 4.2 IP Subnetting Concepts......................................... 14 4.3 IP Address, Subnet and Gateway Configuration............................. 14 4.4 Understanding CIDR Subnet Mask Notation.............................. 15 4.5 CIDR Summarization.......................................... 16 4.6 Broadcast Domains............................................ 17 4.7 IPv6.................................................... 17 4.8 Brief introduction to OSI Model Layers................................. 30 5 Hardware 31 5.1 Minimum Hardware Requirements................................... 31 5.2 Hardware Selection........................................... 31 5.3 Hardware Sizing Guidance........................................ 32 5.4 Hardware Tuning and Troubleshooting................................. 35 5.5 Hardware Compatibility......................................... 36 6 Installing and Upgrading 38 6.1 Download Installation Media...................................... 38 6.2 Prepare Installation Media........................................ 40 6.3 Connect to the Console.......................................... 46 6.4 Perform the Installation......................................... 49 6.5 Assign Interfaces............................................. 52 6.6 Alternate Installation Techniques.................................... 55 i 6.7 Installation Troubleshooting....................................... 56 6.8 Upgrading an Existing Installation.................................... 58 6.9 Filesystem Tweaks............................................ 60 7 Configuration 62 7.1 Setup Wizard............................................... 62 7.2 Interface Configuration.......................................... 69 7.3 Managing Lists in the GUI........................................ 71 7.4 Quickly Navigate the GUI with Shortcuts................................ 71 7.5 General Configuration Options...................................... 72 7.6 Advanced Configuration Options.................................... 74 7.7 Console Menu Basics.......................................... 96 7.8 Time Synchronization.......................................... 102 7.9 Troubleshooting............................................. 105 7.10 pfSense XML Configuration File.................................... 108 7.11 What to do when locked out of the WebGUI.............................. 108 7.12 Connecting to the WebGUI....................................... 113 8 Interface Types and Configuration 114 8.1 Interface Groups............................................. 114 8.2 Wireless................................................. 116 8.3 VLANs.................................................. 116 8.4 QinQs................................................... 116 8.5 Bridges.................................................. 116 8.6 OpenVPN................................................ 116 8.7 PPPs................................................... 117 8.8 GRE (Generic Routing Encapsulation)................................. 120 8.9 GIF (Generic tunnel InterFace)..................................... 120 8.10 LAGG (Link Aggregation)........................................ 121 8.11 Interface Configuration.......................................... 123 8.12 IPv4 WAN Types............................................. 125 8.13 IPv6 WAN Types............................................. 127 8.14 Physical and Virtual Interfaces...................................... 129 9 User Management and Authentication 131 9.1 User Management............................................ 131 9.2 Authentication Servers.......................................... 134 9.3 External Authentication Examples.................................... 138 9.4 Troubleshooting............................................. 139 9.5 Support Throughout pfSense....................................... 141 10 Certificate Management 142 10.1 Certificate Authority Management.................................... 142 10.2 Certificate Management......................................... 145 10.3 Certificate Revocation List Management................................ 149 10.4 Basic Introduction to X.509 Public Key Infrastructure......................... 152 11 Backup and Recovery 153 11.1 Making Backups in the WebGUI..................................... 153 11.2 Using the AutoConfigBackup Package................................. 153 11.3 Alternate Remote Backup Techniques.................................. 156 11.4 Restoring from Backups......................................... 157 11.5 Backup Files and Directories with the Backup Package......................... 160 11.6 Caveats and Gotchas........................................... 161 11.7 Backup Strategies............................................ 162 ii 12 Firewall 163 12.1 Firewalling Fundamentals........................................ 163 12.2 Ingress Filtering............................................. 165 12.3 Egress Filtering.............................................. 165 12.4 Introduction to the Firewall Rules screen................................ 168 12.5 Aliases.................................................. 172 12.6 Firewall Rule Best Practices....................................... 177 12.7 Rule Methodology............................................ 180 12.8 Configuring firewall rules........................................ 186 12.9 Floating Rules.............................................. 192 12.10 Methods of Using Additional Public IP Addresses........................... 194 12.11 Virtual IP Addresses........................................... 197 12.12 Time Based Rules............................................ 199 12.13 Viewing the Firewall Logs........................................ 201 12.14 How Do I Block access to a Web Site?................................. 205 12.15 Troubleshooting Firewall Rules..................................... 206 13 Network Address Translation 209 13.1 Port Forwards.............................................. 209 13.2 1:1 NAT................................................. 215 13.3 Ordering of NAT and Firewall Processing................................ 218 13.4 NAT Reflection.............................................. 220 13.5 Outbound NAT.............................................. 223 13.6 Choosing a NAT Configuration..................................... 226 13.7 NAT and Protocol Compatibility..................................... 227 13.8 IPv6 Network Prefix Translation (NPt)................................. 230 13.9 Troubleshooting............................................. 232 13.10 Default NAT Configuration....................................... 236 14 Routing 237 14.1 Gateways................................................. 237 14.2 Gateway Settings............................................. 238 14.3 Gateway Groups............................................. 241 14.4 Static Routes............................................... 241 14.5 Routing Public IP Addresses....................................... 245 14.6 Routing Protocols............................................ 248 14.7 Route Troubleshooting.......................................... 250 15 Bridging 254 15.1 Creating a Bridge............................................. 254 15.2 Advanced Bridge Options........................................ 254 15.3 Bridging and Interfaces......................................... 257 15.4 Bridging and firewalling......................................... 259 15.5 Bridging Two Internal Networks..................................... 260 15.6 Bridging interoperability......................................... 261 15.7 Types of Bridges............................................. 262 15.8 Bridging and Layer 2 Loops....................................... 263 16 Virtual LANs (VLANs) 264 16.1 Terminology............................................... 264 16.2 VLANs and Security........................................... 265 16.3 pfSense VLAN Configuration...................................... 266 16.4 Switch VLAN Configuration....................................... 270 16.5 pfSense QinQ Configuration....................................... 280 16.6 Requirements............................................... 282 iii 17 Multiple WAN Connections 284 17.1 Multi-WAN Terminology and Concepts................................. 284 17.2 Policy Routing, Load Balancing and Failover Strategies........................ 286 17.3 Multi-WAN Caveats and Considerations................................. 287 17.4 Summary of Multi-WAN Requirements................................