P2P VPN (without server)

Would it be possible to connect to each other via a virtual lan network using a peer to peer network? There are some ā€œfreeā€ opportunities like hamachi but none of them are really free.
I did some research but everything i can find are p2p encrypted vpnā€™s.

Would it be possible to code a tool which makes this possible?