- pfSense 2 Cookbook
- Matt Williamson
- 654字
- 2021-04-09 21:16:41
Configuring the DHCP server
This recipe describes how to configure the DHCP service in pfSense. The DHCP service assigns an IP address to any client who requests one.
Getting ready
PfSense can only be configured as a DHCP server for interfaces configured with a static IP address. Using the examples in this book, that includes the LAN and DMZ interfaces but not the WAN. This example recipe will configure the DHCP server for your DMZ interface.
How to do it...
- Browse to Services | DHCP Server.
- Choose the DMZ tab.
- Check Enable DHCP server on DMZ interface:
- Choose a Range of IP addresses for DHCP clients to use. This range must be contiguous and within the Available range listed above the Range:
- Save the changes and the DHCP service will be started.
- Apply the changes, if necessary.
How it works...
A DHCP server accepts requests from clients and assigns them an available IP address.
There’s more...
A DHCP server fulfills a client request by handing out the first available IP address. This means that it’s very likely that a client will receive a different IP address with every request.
In order to ensure that a client always receives the same IP address, we can create static DHCP mapping. See the next recipe, Creating static DHCP mappings, for more information.
Deny Unknown Clients
Enabling this option ensures that only clients with static DHCP mappings will receive an IP address. DHCP requests from all other clients will be ignored.
This is different from Enable static ARP entries where unknown clients will receive an IP address, although they won’t be able to communicate with the firewall (on that interface) in anyway.
DNS Servers
Specify any DNS server to be automatically assigned to our DHCP clients. If left blank, pfSense will automatically assign DNS servers to our clients in one of the following two ways:
- If DNS Forwarder is enabled, then the IP address of the interface is used. This is because the DNS Forwarder turns the pfSense machine itself into a DNS server, so the IP of the pfSense machine (that is, the gateway, which varies by interface) is assigned to each client.
- If DNS Forwarder isn’t enabled, then the DNS Servers configured on the General Setup page are used. And of course if, Allow DNS server list to be overridden by DHCP/PPP on WAN is enabled in General Setup, then the DNS servers obtained through the WAN will be used instead.
Gateway
The interface gateway will be provided to clients by default (that is, the static IP of the interface), but can be overridden here if necessary.
Domain Name
The domain name specified in General Setup is used by default, but an alternative can be specified here.
Default Lease Time
An alternative lease time can be specified here for clients who do not request a specific expiration time. The default is 7200 seconds.
Maximum Lease Time
An alternative maximum lease time can be specified for clients that ask for a specific expiration time. The default is 86400 seconds.
Failover Peer IP
CARP-configured systems can specify a fail-over IP address here. See CARP configuration in the Configuring CARP firewall failover recipe in Chapter 6, Redundancy, Load Balancing, and Failover for more information.
Static ARP
Enabling static ARP entries will only allow clients with DHCP mappings to communicate with the firewall on this interface. Unknown clients will still receive an IP address, but all communication to the firewall will be blocked.
This is different from Deny Unknown Clients where unknown clients won’t even receive an IP address.
Additional BOOTP/DHCP Options
Enter any custom DHCP option here. Visit http://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xml for a list of options.
See also
- The Creating static DHCP mappings recipe
- The Configuring CARP firewall failover recipe in Chapter 6, Redundancy, Load Balancing, and Failover
- Excel圖表與表格實戰技巧精粹
- ASP.NET MVC 1.0 Quickly
- Final Cut Pro短視頻剪輯入門教程
- 中文版Illustrator CC 2018基礎培訓教程
- Tomcat 6 Developer's Guide
- Photoshop CS6實戰基礎培訓教程(全視頻微課版)
- NHibernate 3.0 Cookbook
- Adobe創意大學Illustrator CS5 產品專家認證標準教材
- 碼上學會:中文版Creo 3.0機械設計全能一本通(雙色版)
- 新編AutoCAD制圖快捷命令速查一冊通
- 攝影師的后期必修課(調色篇)
- Magento: Beginner's Guide
- Cinema 4D基礎與實戰教程
- Science Teaching with Moodle 2.0
- 零基礎學后期:Lightroom 6-CC數碼照片處理從新手到高手