Ion mediated interactions between nucleic acid helices are essential for their efficient packaging within tight spaces such as viral capsids, and nucleosomes. Understanding the fundamental rules governing these interactions is the key to design engineering tools in different length scales to achieve supramolecular architectures, leading to novel therapeutics, biosensors, and catalysis. As one of the building blocks for biology and biotechnology, DNA deserves special attention. However, the underlying physical principles governing DNA interactions with itself and its environment are still lacking. In this study, the mechanism of DNA attraction in the presence of divalent ions is investigated. The counter ion distributions and the conformational ensemble of parallel DNA strands are explored by conventional molecular dynamics and metadynamics simulations. Metadynamics simulation allows computing the free energy surface, providing a thermodynamic view to the DNA-DNA interaction. Our analysis reveals a strong correlation between the structure of the counterion atmosphere and inter-DNA interactions. The interaction energy is found to be mediated by the ions that bridge between the two DNA strands. In summary, computer simulations offer unprecedented detail into the dynamics and thermodynamics of DNA interactions that can potentially help to understand the biological DNA and also develop novel DNA based nanotechnologies.