The Pfsense Book
Total Page:16
File Type:pdf, Size:1020Kb
The pfSense Book Netgate Aug 08, 2018 Copyright © 2018 Electric Sheep Fencing LLC CONTENTS 1 Preface 1 1.1 Copyright Notice.............................................1 1.2 Acknowledgements...........................................1 1.3 Feedback.................................................3 1.4 Typographic Conventions........................................3 1.5 Authors..................................................5 2 Foreword 6 3 Introduction 7 3.1 What does pfSense stand for/mean?...................................7 3.2 Why FreeBSD?..............................................7 3.3 Common Deployments..........................................8 3.4 Interface Naming Terminology.....................................9 3.5 Finding Information and Getting Help.................................. 10 3.6 Project Inception............................................. 11 4 Networking Concepts 12 4.1 Understanding Public and Private IP Addresses............................. 12 4.2 IP Subnetting Concepts......................................... 13 4.3 IP Address, Subnet and Gateway Configuration............................. 13 4.4 Understanding CIDR Subnet Mask Notation.............................. 14 4.5 CIDR Summarization.......................................... 15 4.6 Broadcast Domains............................................ 16 4.7 IPv6.................................................... 16 4.8 Brief introduction to OSI Model Layers................................. 29 5 Hardware 30 5.1 Minimum Hardware Requirements................................... 30 5.2 Hardware Selection........................................... 30 5.3 Hardware Sizing Guidance........................................ 31 5.4 Hardware Tuning and Troubleshooting................................. 34 5.5 Hardware Compatibility......................................... 35 6 Installing and Upgrading 37 6.1 Download Installation Media...................................... 37 6.2 Prepare Installation Media........................................ 39 6.3 Connect to the Console.......................................... 45 6.4 Perform the Installation......................................... 48 6.5 Assign Interfaces............................................. 51 6.6 Alternate Installation Techniques.................................... 54 i 6.7 Installation Troubleshooting....................................... 55 6.8 Upgrading an Existing Installation.................................... 57 6.9 Filesystem Tweaks............................................ 59 7 Configuration 61 7.1 Setup Wizard............................................... 61 7.2 Interface Configuration.......................................... 68 7.3 Managing Lists in the GUI........................................ 70 7.4 Quickly Navigate the GUI with Shortcuts................................ 70 7.5 General Configuration Options...................................... 71 7.6 Advanced Configuration Options.................................... 73 7.7 Console Menu Basics.......................................... 95 7.8 Time Synchronization.......................................... 101 7.9 Troubleshooting............................................. 104 7.10 pfSense XML Configuration File.................................... 107 7.11 What to do when locked out of the WebGUI.............................. 107 7.12 Connecting to the WebGUI....................................... 112 8 Interface Types and Configuration 113 8.1 Interface Groups............................................. 113 8.2 Wireless................................................. 115 8.3 VLANs.................................................. 115 8.4 QinQs................................................... 115 8.5 Bridges.................................................. 115 8.6 OpenVPN................................................ 115 8.7 PPPs................................................... 116 8.8 GRE (Generic Routing Encapsulation)................................. 119 8.9 GIF (Generic tunnel InterFace)..................................... 119 8.10 LAGG (Link Aggregation)........................................ 120 8.11 Interface Configuration.......................................... 122 8.12 IPv4 WAN Types............................................. 124 8.13 IPv6 WAN Types............................................. 126 8.14 Physical and Virtual Interfaces...................................... 128 9 User Management and Authentication 130 9.1 User Management............................................ 130 9.2 Authentication Servers.......................................... 133 9.3 External Authentication Examples.................................... 136 9.4 Troubleshooting............................................. 138 9.5 Support Throughout pfSense....................................... 140 10 Certificate Management 141 10.1 Certificate Authority Management.................................... 141 10.2 Certificate Management......................................... 144 10.3 Certificate Revocation List Management................................ 148 10.4 Basic Introduction to X.509 Public Key Infrastructure......................... 151 11 Backup and Recovery 152 11.1 Making Backups in the WebGUI..................................... 152 11.2 Using the AutoConfigBackup Package................................. 152 11.3 Alternate Remote Backup Techniques.................................. 155 11.4 Restoring from Backups......................................... 156 11.5 Backup Files and Directories with the Backup Package......................... 159 11.6 Caveats and Gotchas........................................... 160 11.7 Backup Strategies............................................ 161 ii 12 Firewall 162 12.1 Firewalling Fundamentals........................................ 162 12.2 Ingress Filtering............................................. 164 12.3 Egress Filtering.............................................. 164 12.4 Introduction to the Firewall Rules screen................................ 167 12.5 Aliases.................................................. 171 12.6 Firewall Rule Best Practices....................................... 176 12.7 Rule Methodology............................................ 179 12.8 Configuring firewall rules........................................ 185 12.9 Floating Rules.............................................. 191 12.10 Methods of Using Additional Public IP Addresses........................... 193 12.11 Virtual IP Addresses........................................... 196 12.12 Time Based Rules............................................ 198 12.13 Viewing the Firewall Logs........................................ 200 12.14 How Do I Block access to a Web Site?................................. 204 12.15 Troubleshooting Firewall Rules..................................... 205 13 Network Address Translation 208 13.1 Port Forwards.............................................. 208 13.2 1:1 NAT................................................. 214 13.3 Ordering of NAT and Firewall Processing................................ 217 13.4 NAT Reflection.............................................. 219 13.5 Outbound NAT.............................................. 222 13.6 Choosing a NAT Configuration..................................... 225 13.7 NAT and Protocol Compatibility..................................... 226 13.8 IPv6 Network Prefix Translation (NPt)................................. 229 13.9 Troubleshooting............................................. 231 13.10 Default NAT Configuration....................................... 235 14 Routing 236 14.1 Gateways................................................. 236 14.2 Gateway Settings............................................. 237 14.3 Gateway Groups............................................. 240 14.4 Static Routes............................................... 240 14.5 Routing Public IP Addresses....................................... 244 14.6 Routing Protocols............................................ 247 14.7 Route Troubleshooting.......................................... 249 15 Bridging 253 15.1 Creating a Bridge............................................. 253 15.2 Advanced Bridge Options........................................ 253 15.3 Bridging and Interfaces......................................... 256 15.4 Bridging and firewalling......................................... 258 15.5 Bridging Two Internal Networks..................................... 259 15.6 Bridging interoperability......................................... 260 15.7 Types of Bridges............................................. 261 15.8 Bridging and Layer 2 Loops....................................... 262 16 Virtual LANs (VLANs) 263 16.1 Terminology............................................... 263 16.2 VLANs and Security........................................... 264 16.3 pfSense VLAN Configuration...................................... 265 16.4 Switch VLAN Configuration....................................... 269 16.5 pfSense QinQ Configuration....................................... 279 16.6 Requirements............................................... 281 iii 17 Multiple WAN Connections 283 17.1 Multi-WAN Terminology and Concepts................................. 283 17.2 Policy Routing, Load Balancing and Failover Strategies........................ 285 17.3 Multi-WAN Caveats and Considerations................................. 286 17.4 Summary of Multi-WAN Requirements................................