Peter demonstrates how to take advantage of the World Wide Web alternative, Freenet.
Freenet, quite possibly the most exciting file-sharing technology out there, is unfortunately a little difficult to install and administer. Your intrepid author spent a weekend with literally no sleep (strong tea and death metal can do wonders) figuring it out when he first got his hands on it back in September 2000. Fortunately, Freenet's ease of use has come a long way since then. With an hour or two of work, anyone competent in Linux system administration should be able to get their own Freenet node up and running.
The installation of a Java runtime is out of the scope of this article. However, a list of recommended JDKs (Java Development Kit) and some warnings about them can be found in the Resources section.
If you want to run a full-time, contributing node you'll need 100MHz 486 or greater with at least 32MB of RAM. There are no minimum requirements (other than about 1MB for the actual software) for hard drive space, but in this age of 20GB drives, it'd be nice if you set aside a few GBs for Freenet data. For your internet connection, a static IP address or dynamic DNS is required. Anything faster than a dial-up is fine. As for uptime, if your node is on 24/7 you can contribute (downtimes of up to an hour or so are okay, but try to avoid anything more than that). Anything less and your node will still work just fine for you, but you won't be contributing anything to the network.
For a part-time, noncontributing node, similar system and memory requirements apply, but you can use whatever internet connection you like.
First of all, you need to actually download Freenet. Here you have two main options. You can download a binary or choose the source package. If you run Debian, Mr. Bad has created a Debian package (see Resources). Because Freenet is written in Java, you don't have to worry about binary compatibility, so it's easiest simply to download a binary package. After that the question is which version do you want. A release (current is 0.3.5) or CVS copy? You'll probably want to go with a release at first. Do make sure you download the Linux tarball, not the Windows executable.
The Linux version of Freenet doesn't have any installation scripts. Instead you simply untar the tarball into a directory of your choice. Personally I'd suggest creating a special Freenet user and putting the Freenet software and data store in the Freenet user's home directory.
Next you'll want to make your node automatically start at boot up. Unfortunately, not all distributions handle the startup scripts quite the same way. If you want to use dæmontools, follow the instructions at freenet.netunify.com/25. Otherwise, use something like:
su - -c "cd ~/freenet ; rm freenet.log nohup.out ; nohup ./freenet_server & >/dev/null" freenet
This changes the user to the Freenet user. The “-” sets the environment to that of a login shell so the environment is set up as though running from a normal shell. Finally, the command -c changes the directory to the Freenet directory, removes old log files and runs the Freenet server in nohup mode directing any non-errors to /dev/null. You'll need to insure the Java program itself is in your path. Try running Java from a room shell to test this.
The Freenet node software uses two configuration files: .freenetrc, the configuration for the node; and .fproxyrc, the configuration for the fproxy module. Of the two, .freenetrc contains all but one of the options; .fproxyrc just tells fproxy which Freenet node it should connect to.
The first thing you'll want to set is the transient option up at the top of the .freenetrc file. The default, “no”, means that your node will tell other nodes about its existence. This is probably what you want if you plan on running a 24/7 node with a good internet connection and a static IP address or dynamic DNS service. If you set transient to “yes”, your node won't tell other nodes about its existence. If you have spotty uptime, a slow internet connection or a dynamic IP address without dynamic DNS, set transient to “yes”.
You'll want to change the port used by Freenet to a random port between 5,000 and 65,535. If everyone ran their node on the same port it would be far easier for Freenet to be filtered out, which is not a good thing. To do this, change the listenPort value in .freenetrc and the serverAddress in .fproxyrc to reflect the new port. Also, remember to use the -serverAddress option when running the command-line clients or set the FREENET environment variable to the address of your node.
If you have a dynamic IP address but use dynamic DNS you can still contribute to Freenet by setting nodeAddress to your dynamic DNS name. Instead of telling other Freenet nodes the IP address of your machine, it will tell them the address in the nodeAddress setting.
By default, Freenet will store a maximum of 1,000 items in the data store and use a maximum of 500MB of hard drive space. The diskCache and dataStoreSize options control this. Note that, due to bugs, the actual amount of space used can easily go over this. Often files in the data store simply get lost and don't get deleted when they should be. Restarting the node periodically, every day or week, will clean out those lost files. Secondly, while transferring large files the node will store the whole file while it's in transit even if doing so makes the node go over the size limit. Hopefully by the time you read this article, these bugs will have been fixed, though the second problem is difficult to fix for various reasons.
After that we have the dataPath and dataPropertiesPath that control where the data store is (the default is the .freenet directory where you installed Freenet). The difference between the two is that dataPath is where the actual data gets put, and dataPropertiesPath controls is where the .inf files describing the data stored get put. In all but unusual cases the two will be the same value. You may want to set this path to another partition with more space available than the default. Any filesystem that supports long filenames is fine. Note that you can't use multiple partitions simultaneously, you'll have to run multiple nodes on different ports for that.
There is also an option to limit bandwidth used, bandwidthLimit. This limit applies to outgoing data only. Incoming data is not limited (see maximumConnectionThreads). For most people the 50K/sec limit is probably fine, but if you can, please increase it or disable the bandwidthLimit to about a third to a half of your outgoing bandwidth, about 50K/sec to 300K/sec for your average cable or DSL line. Note that the bandwidth limit does not apply to requests originating from the same machine.
Incoming bandwidth can be limited, to a degree, with the maximumConnectionThreads option. This option limits the maximum number of incoming connections from other nodes. Changing this changes the amount of bandwidth and memory used. Most people can probably leave it at its default of 50K/sec, but if you have memory restrictions (or excesses) you can reduce or increase it.
Note that there is currently no way to limit the amount of total data transfer in a given time period. So as of yet, there is no way to only allow, for example, 1GB of data transfer per month.
At the end of the configuration file are the options that control logging. A single log file is used, freenet.log, by default (controlled by logFile). The logging option controls the threshold of events logged. The default, “normal”, doesn't log any of the mundane details of your node sending and receiving data. The “minor” setting can often provide useful debugging information, however debugging is overkill. Setting logging to minor is probably your best bet.
Finally, there is one last option that's not in the default configuration file, informDelay. Before writing the node's address to informURL, the node will wait a default of 24 hours to make sure your node is stable. Your node must be running for 24 continuous hours before the informURL is notified. Initially, one of the big problems with the informURL system was that people would try Freenet for a few minutes, decide it wasn't worth it and remove the Freenet software. Meanwhile, the address of their nonfunctioning node was sent to informURL. When nodes tried to get a working address, almost every single address in informURL would be nonfunctioning. It got to the point where one of the big problems in getting a node up and running was finding another node!
If you plan on restarting your node once a day you'll have to change the informDelay to something different. Setting it to 0 by adding the line informDelay = 0 to the configuration file will disable the feature and is what you want. Otherwise don't touch informDelay, please!
Now that you've got your node up and running you want to see if it works, right? First try running:
freenet_request test-key
If that works you'll see the message: Congratulations! You've fetched a Freenet key on the console after some debugging information. If it doesn't do anything for more then two minutes or so it's not working.
Next try the URL http://localhost:8081/KSK@Aardvark in your favorite web browser to see if fproxy is working. If it is, you'll see the page of Aardvark's Freenet Index come up.
Actually getting your node established in the network can be a little tricky. It should, and usually will, do so automatically, but it often helps to push the process along a little to speed it up. This is an optional procedure. There are two main parts to this: finding other nodes and getting known by other nodes. Note that if you're running a transient node the second part isn't important.
The first part is simple, use Freenet. Just take a look at some of the content, such as the above-mentioned Aardvark's Freenet Index (KSK@Aardvark) and gj's web page (KSK@webpages/gj_jump0).
The second part is a little bit harder. You can insert a random chunk of data (1K) into Freenet with:
dd if=/dev/urandom bs=1024 count=1 | freenet_insert -length 1024 CHK@
When your node inserts that data, other nodes will find out about your node from the SourceAddress on the packets of data.
In any case, remember that it will take a few days before your node becomes known and other nodes start to request data from you. So if nothing much seems to be happening—don't panic!
Properly set up, a Freenet node shouldn't need any ongoing administration. However, there are a few automatable tasks that need to be done. First of all, the log files need to be rotated. Secondly, you'll want to restart the Freenet software periodically. Currently the disk (and I believe memory) usage of Freenet tends to balloon unless you restart your node periodically. Both rotating the log files, which requires restarting the node anyway, and restarting the node can be easily done with the script restart_script (shown in Listing 1). For your average node, restarting once a week should be fine.
IBM's JDK is probably the easiest JDK to install. It's precompiled and works, plus it's one of the faster JDKs out there. On the downside it's proprietary and requires registration to download. Both tarball and Red Hat RPMs are available at: www.ibm.com/java/jdk/linux130/index.html.
Kaffe, the OpenSource JDK, is another, more difficult option. You will have to compile in gmp support, something most distributions don't do in their Kaffe packages. A Debian package for Kaffe with gmp support is available from Mr. Bad's site, above. Otherwise, compile from anonymous CVS or a source package to which you apply the patch found in the Freenet README. Make sure you enable gmp support with the --enable-gmp option when you run ./configure.