Very good response to the puzzle, and lot of people sent me answers. The most common answer was that we should connect the two diagonals, which 2*sqrt(2) = 2.82 km. However, as it so happens, there is an answer which can do it in a shorter way than the diagonals. Abhinav Jain was the first one to send the correct answer. Other people to send the right answers included Vikas and Shray Vats combo and Suman Saraf. Very well done!
In the graphic below is the configuration that is the optimal way to do it. The answer does require knowledge of calculus, and therefore my apologies to younger folks who do not know calculus (I do not remember either!).
A good way to understand the answer can be through this video:
Also attaching a link to the more generic discussion on how to connect multiple points in the shortest way. The general class of problems is called the Stenier Trees.
Hope you enjoyed the puzzle!