🌐 이 글의 한국어 원문이 있습니다.한국어 원문 보기 →

· 5 min read

Troubleshooting pfSense DHCP High Availability

When you set up DHCP redundancy (High Availability), the key is making sure the two nodes can correctly recognize each other's state.

I hadn't gotten that part right, so every time I enabled high availability for DHCP, it kept falling into a failure state.

I figured a troubleshooting checklist for this would come in handy, so here it is.

The environment is as follows:

  • Virtual IP: 10.10.10.1
  • Primary Interface IP: 10.10.10.2
  • Secondary Interface IP: 10.10.10.3

Based on the VIP 10.10.10.1, the Primary and Secondary get the trailing numbers 2 and 3 respectively. The checklist below assumes that IP addresses have already been assigned correctly on each pfSense box (if you're not sure, add the assigned IPs to your checklist first).

Virtual IP(VIP)

Primary

Secondary

Checklist

  • Address (VIP address and range) matches
  • Password matches
  • VHID Group matches
  • Advertising frequency Base matches
  • Advertising frequency Skew (Primary: below 20, Second: above 20)

The Advertising frequency setting is the important one. Advertising frequency is the interval at which each node advertises that its IP is alive.

Base is usually left at 1 (it can be tuned in special cases).

Skew adds a multiple of ( seconds) to the base. pfSense then uses the Base+Skew value to decide who is Primary. For DHCP in particular, the Primary's Skew must be below 20. Conversely, the Secondary must be set to a number above 20.

If both numbers are below 20, or both are above 20, DHCP will treat both nodes as Primary, or both as Secondary (in my case, I had set both above 20, so each one considered itself Secondary and they ended up just listening to each other).

DHCP

Primary

Secondary

Checklist

  • Gateway matches the VIP
  • Failover peer IP (Primary: 10.10.10.3, Secondary: 10.10.10.2)

Next up are the DHCP settings.

First, check that the Gateway matches the VIP.

Then look at the Failover peer IP. This field asks for the real IP of the other service that forms the DHCP failover pair with this one. In other words, the IP it wants is the “other side’s” IP, so you have to enter the IP of the opposite peer.

If both of these are configured correctly, Status > DHCP Leases should show something like this:

If either side shows something other than normal, check the logs.

Checking Logs and Status

DHCP Logs

Go to Status > System Logs > DHCP to see the current state of DHCP. Open the logs on both pfSense boxes and look at how they're behaving.

Firewall Logs

Go to Status > System Logs > Firewall. In the upper right there's a Filter icon; clicking it brings up the log filter settings shown below.

Check Block and enter the name of the Interface you want to inspect. The Port number is 519. This is the port DHCP uses to communicate with its peer to check each other's state.

If you see blocks here, you need to review your firewall rules. Again, this has to be done on both sides.

Service Listening Status

Go to Diagnostics > Command Prompt and you can run commands directly. Enter the following:

 sockstat -4 | grep 519

This queries the socket state on port 519, so you can see whether DHCP has the socket open.

netstat -na | grep 519

Next is the network status.

In my case, this was the step where I found the problem.

I had DHCP running on four interfaces, and you can see that all but one are in the SYN_SENT state. A SYN was sent to start TCP communication, but no response ever came back. This was happening on both pfSense boxes, and I realized it was a problem with how Primary/Seconday was assigned. pfSense decides Primary and Secondary from the skew value, and my mistake was setting both sides to a value above 20.

References

https://docs.netgate.com/pfsense/en/latest/firewall/virtual-ip-addresses.html

Related posts

Home