Many factors can affect the ability of your node to find and maintain peers. Your network router, machine environment, and node configuration are all important. If you have peering issues, start by configuring your ports and managing peers.
"Why can’t I find enough peers to sync?"
One or more of the following may be the cause:
- Your hardware doesn't have enough CPU, disk IOPS, or bandwidth to handle all the peers.
- Your ports aren't open in your firewall and/or router.
- Your node is sending large numbers of DNS requests. See issue #4375.
- You're using checkpoint sync, which doesn't download all historical block data, so your peers may disconnect you when fetching those blocks.
- Your node is experiencing the normal behavior of peers connecting and disconnecting. This is especially normal soon after you start your node.
You can try the following to find more peers:
p2p-hostto your external IP address to allow inbound connections.
- Restart Besu. This can take a while to build up again.
true(only for private networks).
-Xp2p-peer-lower-boundto a minimum number of peers.
- Delete the node key (which is autogenerated in your data directory). There are two reasons that this might help find more peers:
- Your node (identified by the address associated with this key) has been put onto other peers' bad peer lists for some reason.
- Peer discovery is influenced by the value of the node key. This is related to the node "distance" in the discovery algorithm.
You can read the Prysm EL and CL peering documentation for more information.
"What network or router/modem settings should I check?"
Check the following settings:
- Your machine and router's specified DNS should support TCP. You can check your DNS online for TCP support. Google and Cloudflare, 220.127.116.11 and 18.104.22.168, support TCP over port 853. Other DNS might as well.
- The appropriate ports should be open on your router, or your router should have UPNP enabled. See the next FAQ for more information on router settings.
- If you use Docker or virtualization, the container should be able to create outbound connections on the host machine.
"How do I open/forward my ports?"
If you’re behind NAT, you probably need to set up port forwarding in your router. You might also need to configure your firewall. Forward and open
30303 (if using the default p2p port) for both UDP and TCP. If your router supports UPNP, you can set
"How do I test that my ports are open?"
You can use this open port checker.
"What's the ideal number of peers for Besu?"
The default maximum is 25. Increasing the number of peers increases the bandwidth, CPU, and disk access Besu uses to respond to peers. Hardware with low specifications might result in low peer numbers. You'll experience diminishing returns with a larger number of peers (>100).
"What's the benefit of increasing the number of peers?"
Increasing the number of max peers won't speed up Besu syncing, because the bottleneck during sync is disk IO and CPU.
Note that Besu's peers are only used for the initial sync and transaction gossip, neither of which affects attestation performance. The beacon node connectivity controls how quickly you receive blocks and how attestations are published. Increasing Besu's peer count increases the load on your node, which may hurt attestations.
Capture metrics to gain insights into peering behavior over time.
To enable Prometheus to access Besu, open the metrics port or metrics push port to Prometheus or the Prometheus push gateway on TCP.