Connecting to Kademlia in eMule

March 23, 2008 by sharky

Kademlia (KAD or Kad) is a serverless network used primarily to index files shared by eMule clients. Clients can connect to the eDonkey network and use it to find sources for files, without the need for mediary intervention (in this case, “servers”) to track down and find files among connected peers.

The Kademlia Network & its Significance

Since KAD is a decentralized (DHT) network, eMule users don’t have to rely on the validity of eDonkey (eD2k) servers. Think of it as a ‘direct connection’ to other peers on the eDonkey network - without the (otherwise necessary) interaction of a centralized eDonkey server.

KAD is a viable implementation, for the reason that it nullifies the dependency upon eDonkey servers:

1.If a server is temporarily offline, closed or even shut down (purposely or forcibly), users can still search, find and download files from other KAD-connected peers (nodes). Not only does this increase search results from nodes spanning across all of the servers, but it also significantly heightens the number of sources for files. Residual benefits include higher download speeds and access to otherwise unfindable “rare” material.

2.“Bad” eDonkey / eD2k servers have no ill-effect to the KAD network (directly), thus there are fewer decoy and spoof files. It’s safe to say that anti-P2P agencies have a much more difficult time polluting the network as a whole.

However, this does not take away from viruses and malware that are relatively common throughout eDonkey releases. Take extreme caution when searching for applications and software (and never search for ‘crack’ files or keygens).

eMule & KAD

Concurrent Usage of KAD and eDonkey Servers - the Significance:

Technically, eMule v0.48a users can connect to KAD without the need to connect to eDonkey “servers” - although we recommend using servers and the Kademlia network for added connectivity. Both are recommended due to the fact that some spinoffs of the original eDonkey client don’t support KAD (such as eMulePlus and certain “mods”, and other offshoots), thus these users won’t appear in eMule ‘KAD-only’ connections (or search queries). Plus, some people simply can’t connect to KAD - hence the persistent popularity of using eDonkey servers / serverlists.

It’s recommended to connect to a good ‘viable’ server, in addition to using KAD. We’ve found that after a fresh installation of eMule (v0.48a), it won’t connect to KAD nodes when previously not connected to any servers. This is because eMule attempts to connect to KAD (by default) by bootstrapping to known clients (typically, ‘nodes’ that it imported through the initial connection of a server). It should be noted that there are workarounds for connecting to KAD without initially connecting to servers (such exceptions include using eMule “mods” with built-in KAD-nodes (either lists or updating URLs), or manually adding in nodes from a pre-ordained database or URL).

Using KAD through eMule

By default, eMule automatically attempts to make a KAD network connection between peers. During the installation of eMule v0.48a, it will prompt you whether or not you wish to connect to KAD (when starting eMule). Put a checkmark in this box. These settings can be changed in eMule > OPTIONS > Connection. Here’s a few other things to check, as well:

1.Select “Autoconnect on startup”, and select the desired “Networks” (KAD, eD2k).

2.Change your Download/Upload speeds.

3.Use “good” port numbers (The Dynamic and/or Private Ports are those from 49152 through 65535). These normally work best.

4.You can test your ports by clicking the “Test ports” button.

5.Save your new settings - click “Apply” and “OK” to close.

Back in eMule, select the KAD menu icon, click “Connect” - the ‘Contacts’ number should begin to update. If not, try connecting to an eD2k server and then re-attempt the KAD connection.

Another option to connect to KAD: Connect to an eD2k server with a high user-count - i.e. Razorback 3.1. Conduct a search, and download a file (any file will do - preferably something with many sources). Wait for the sources to update and the download to commence. Now, go back to the Kad window, and click the “Bootstrap” button. This should launch a connection to the KAD network.

Manually adding ‘KAD Nodes’

If the KAD connection fails, or doesn’t appear “connected” (and Bootstrapping didn’t work), you have the option to manually input a viable list of KAD-nodes into eMule. One reliable source for working nodes is www.nodes-dat.com. Here you’ll find a constantly-updated online nodes.dat (database) file for use in eMule. Here’s how to import it:

1.Visit www.nodes-dat.com and click on “download live nodes.dat“, save it to your hard drive.

2.First, make certain that eMule is completely shut down. Copy “nodes.dat” into your C:\Program Files\Emule\config directory (assuming that’s where you’ve installed eMule). If asked, replace the older nodes.dat file with this newer one.

3.Start eMule. Click on the “KAD” menu icon, and click on the “Connect” button to the right. Be sure that “From known clients” radio-button is selected:

NOTE: KAD connectivity will engage regardless of whether or not you’ve ever connected to any servers through eMule (although it sometimes works best when connected to a server in conjunction to KAD). The KAD-only connectivity is validated in the bottom right corner, noting that eD2k is not connected:

Next to that line, verify the number of connected users. You should notice the statistics are for ONLY KAD-connected peers, while not connected to any eD2k servers. Stats below show a connection to 2.9 million other KAD users, sharing a total of 348 million files.

NOTE: Another ‘nodes.dat’ file can be found here - www.emule-inside.net/nodes.dat. Download, save and add to eMule the same way as above.

‘Searching’ the KAD Network

To conduct a search from within the KAD network, click on the SEARCH menu icon, and from the “Method” dropdown box, select ‘Kad Network‘. All queries will now be sent through only KAD.