As iguer pointed out, private mode would be one reason to cause this. But to elaborate, this happens mostly because private mode nodes are less favorable for a peer node to connect to as the private node is basically a leech to the network. It will not try to bootstrap other nodes. Private nodes will mostly just monitor to get the blockchain and fill its mempool, only sometimes occasionally share an operation like baking or transaction.
Fundamentally, a private node does not allow others to connect to it. For the same reason, if your public node does not allow others to connect to it, it will share the "too few connections" symptoms. It's not a node requirement to allow others to connect because the node itself can try to connect to known peers and bootstrap the chain that way. But my theory is that nodes that does not allow connections from others are also considered less favorable, hence some nodes might drop or refuse your node as a peer because it doesn't help expand their reach to the network. I would certainly check to make sure your port 9732
is connectable through your firewall or router or whatever. (Official documentations says it's port 19732
, but I believe that's wrong based on my experience.)
Third reason why too few connections
may happen is rare but should be pointed out. If you are on the wrong network or fork/chain or protocol, you will only connected to compatible nodes. All the nodes you are connected will be also on the same setup. Things to watch out for is to make sure to compile your binaries with mainnet
branch, not master
. Also, remember to run the correct binaries (currently at 003
protocol) and keep your binaries up to date by recompiling every so often(or notified to do so on Riot or Slack).