n2n_v2(7)

πŸ“¦ version 2.1.0, in fedora 43

πŸ’– n2n_v2(7) πŸ’–

okay so this is the n2n_v2 manual page, section 7, filed under Background β€” and bestie, it's the glow-up era of n2n and I'm obsessed πŸ’…


✨ NAME ✨

N2n Version 2 β€” version 2 of the n2n decentralised peer-to-peer network overlay VPN. that's it, that's the vibe πŸ¦‹


🌈 DESCRIPTION 🌈

N2n is a peer-to-peer network overlay, aka a VPN system, and it does layer 2 over layer 3 encapsulation with data transform capabilities like encryption and compression. literally iconic.

This guide is here to walk you through the differences of version 2 (aka n2n) versus version 1. no cap, there are some real ones in here πŸ‘‘


πŸ¦‹ PROTOCOLS πŸ¦‹

N2n-2 uses a whole different set of messages to talk to edges and supernodes. the n2n-2 messages are not compatible with n2n-1. there is no backward compatibility for n2n-1. periodt πŸ’€


πŸ” ENCRYPTION πŸ”

N2n-2 serves up a brand-new way of handling encryption compared to n2n-1. n2n-1 gave you a single community password with no expiration. in n2n-2 that method is preserved, but a new mechanism got added on top using a key schedule file. two options, both slay ✨

πŸ”‘ Key Schedule πŸ”‘

A key schedule file lists a number of keys, and for each one it has:

  • the period for which that key is valid
  • the encryption type identifier
  • the actual key value

this lets you define up to 32 keys in advance, with a pre-set time at which the keys will change. and the key schedule file can be reloaded while the edge is running, so you can load in new keys and expunge the unused ones. main character energy fr fr πŸŽ€

⏰ Timing Requirements ⏰

When a key rolls over to the next one in the schedule, the new key is used for all transmitted packets. but β€” and this is the good part β€” any packets received using an older key can still be decoded, because the keys from the key schedule are still known. so edges do not need accurate time synchronisation. how much synchronisation you actually need depends to a large degree on the key schedule itself: rapid key roll-overs require more accurate time synchronisation. iykyk πŸ•°οΈ

N2n-2 provides the following encryption ciphers, and more can be added as required:

  1. NULL β€” data is encapsulated unchanged. useful for testing and for high-performance, low sensitivity applications.
  2. TF β€” Twofish AES candidate.
  3. AES-CBC β€” AES in CBC mode with 256-bit key.
  4. LZO β€” LZO compression of data (no encryption).
  5. TF-LZO β€” TF cipher with LZO compression of data prior to encryption.
  6. AES-CBC-LZO β€” AES-CBC cipher with LZO compression of data prior to encryption.
🚨 heads up bestie: ciphers (3) AES-CBC, (4) LZO, (5) TF-LZO and (6) AES-CBC-LZO are specified but not yet implemented. they're on the mood board, not in the closet πŸ™ˆ

🌸 EXTENSIBILITY 🌸

N2n-2 decouples the data transform system from the core of the edge operation, which makes adding new data transform operations way easier. it reserves 64 standard transform identifiers (things like TwoFish encryption), but it allocates transform identifiers 64 - 65536 for user-defined transforms. so literally anyone can add new private transforms to n2n without breaking compatibility with the standard offering. that's the dream πŸ’–


πŸ‘‘ MULTIPLE SUPERNODES πŸ‘‘

N2n-2 introduces the capability of multiple supernodes being used by an edge. and it offers supernode in several flavours:

  • Stand-alone supernode β€” same concept as from n2n-1. the supernode is a small, efficient C program which operates in isolation.
  • Federated supernodes β€” a cluster of supernodes which share information. edges registered to any of the cooperating supernodes can relay packets through the supernode federation and switch supernodes if required. supernodes can send PACKET or REGISTER messages to other supernodes to try and find the destination edge.

The n2n-2 edge implementation lets you specify multiple supernodes on the command line. edges monitor the current supernode for responses to REGISTER_SUPER messages. if 3 responses are missed, then the edge starts looking for a new supernode. it cycles through the list of supernodes you specified until it finds a working one. resilient queen 🌈


πŸ“ EFFICIENCY πŸ“

The n2n-2 message formats have been made more efficient. the amount of data overhead has been reduced by making sure the messages contain only the data fields required. some optional fields don't consume data at all if they're not present. skinny legend ✨


🧚 DAEMON OPERATION 🧚

The supernode and edge use daemon mode of operation by default. and yes, this sense is inverted from n2n-1, where they ran in the foreground by default. they can be made to run in the foreground so tools such as DJB's daemontools can work with them. see the -f option πŸ’…


πŸ’œ MANAGEMENT CONSOLE πŸ’œ

Edge and supernode in n2n-2 provide a UDP-based management console. both listen on the localhost address 127.0.0.1. commands can be sent to the programs by sending to the UDP socket, and responses are returned to the socket from which commands were issued. this only works from the computer on which the programs are running. statistics can be retrieved and commands issued. the netcat utility is all that is required, but more sophisticated tools could be built on the interface. lowkey a whole vibe πŸŽ€


πŸ™ˆ SUPERNODE AUTHENTICATION πŸ™ˆ

(To be implemented) β€” space has been reserved in the supernode registration messages for an authentication mechanism. it's giving coming soon, not yet bestie πŸ¦‹


πŸ“¨ MESSAGE SUMMARY πŸ“¨

The following message types work within n2n-2:

  • REGISTER_SUPER β€” sent from an edge to its local supernode to register its MAC with the community.
  • REGISTER_SUPER_ACK β€” sent from a supernode to an edge to confirm registration. this also carries the definition of the edge socket as seen at the supernode, so NAT can be detected and described.
  • REGISTER_SUPER_NAK β€” supernode refusing to register an edge.
  • PACKET β€” encapsulated ethernet packets sent between edges. supernodes forward or broadcast these, and edges send them direct in peer-to-peer mode.
  • REGISTER β€” a peer-to-peer mode registration request from one edge to another. supernodes forward these to facilitate NAT crossing introductions.
  • REGISTER_ACK β€” complete peer-to-peer mode setup between two edges. these messages need to travel direct between edges.
  • FEDERATION β€” federated supernodes exchanging community information.

🌈 OTHER DIFFERENCES 🌈

  • HTTP Tunneling β€” this experimental feature (the -t option in n2n_v1) of n2n_v1 has been removed entirely from n2n_v2. gone, deceased, not coming back πŸ’€

πŸ’œ AUTHORS πŸ’œ

  • Richard Andrews β€” andrews (at) ntop.org β€” main author of n2n-2
  • Luca Deri β€” deri (at) ntop.org β€” code inherited from n2n-1

⭐ SEE ALSO ⭐

ifconfig(8) edge(8) supernode(1)


and that's the whole page bestie, go forth and overlay some networks 🫢 this was revision 3909, dated Sep 21, 2009 β€” yeah she's an elder but she still ate πŸ’…βœ¨

πŸ“¦ where this page comes from