I used XBee in a plane farm and it worked only with 2 km of distance. There's something wrong. What can I do?

I have a Xbee Pro S3B, I used a 5 dBi 900 MHz omni antenna.
I need a larger distance.

How is your line-of-sight? Any obsticles. You can try raising them up higher too. Keep in mind that the fresnel zone isn’t as tight as a pencil:

You can also try unidirectional antennas for better range.

My line-of-sight don’t have obstacles.
What do you mean with “isn’t as tight as a pencil”?

The fresnel can be quite wide. it’s usually not as narrow as a beam (pencil).

Also make sure you’ve got the radio settings to their highest level:

You can also try doing a range test and see if you get any data at all.