User Tools

Site Tools


cl-tutorial:first_e

Preparing and Running the Experiment

At this point we have the whole LXC and network configuration needed to start configuring and running the bit-torrent experiment.

 Running the experiment

As you can see in the figure, we are using opentracker software as a tracker and transmission command-line application to share a small file among the slivers.

Installing Opentracker

We are going to install the Opentracker on the bit-experiment@Virtual node 1 sliver. So, first of all start it (if you did not do yet) and log in using VCT default key and the management interface. You could use the public IPv4 interface if you knew its address, but the controller doesn't provide this information.

Remember that addresses are available at the interface list in sliver page.

An convenient step before starting to work with a new Debian distribution is to update the package list. Run this command using the IPv6 corresponding to your sliver bit-experiment@Virtual Node 1.

vct@vct:~$ ssh -i /var/lib/vct/keys/id_rsa root@fd65:fc41:c50f:7:1002::5
root@000000000005_0007:~#

The next step is, of course, installing the necessary dependencies to compile libowfat and the Opentracker software. Now we will follow the opentracker website tutorial to install the software inside our sliver.

root@000000000005_0007:~# apt-get install build-essential
root@000000000005_0007:~# apt-get update
root@000000000005_0007:~# apt-get install make cvs zlib1g-dev
 
root@000000000005_0007:~# cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co libowfat
 
root@000000000005_0007:~# cd libowfat
root@000000000005_0007:~/libowfat# make
 
root@000000000005_0007:~/libowfat# cd ..
root@000000000005_0007:~# cvs -d:pserver:anoncvs@cvs.erdgeist.org:/home/cvsroot co opentracker
 
root@000000000005_0007:~# cd opentracker
root@000000000005_0007:~/opentracker# make

Notice that we did not modify the Makefile file, so the Opentracker has been compiled only with IPv4 support. To start testing it, just execute it on TCP/UDP port 80 of the TRACKER_ADDR address, corresponding to the sliver's IPv4 public interface pub0 (in our case this IPv4 is 10.241.0.16, please check yours with the command ip -4 addr show dev pub0). For an explanation on sliver interfaces and addresses, see the node architecture.

root@000000000005_0007:~/opentracker# ./opentracker.debug -i TRACKER_ADDR -p 80 -P 80

The default Opentracker web interface is enabled on http://TRACKER_ADDR:80/stats and will show 0 torrent files, 0 connected peers and 0 files shared.

As we are inside a VCT-C we need to do extra steps to check it. First, open a new terminal in your host machine and connect to the VCT container executing next command with root privileges:

~$ ssh -L 80:10.241.0.16:80 vct@172.24.42.141

Previous command opens a new SSH connection to the VCT-C with a SSH tunnelling. The format is the following:

ssh -L <HOST_LOCAL_PORT:TRACKER_ADDR:SLIVER_PUBLIC_PORT vct@VCT_CONTAINER_IP

In our case, we want to check the Opentracker status web page on port 80. After executing this command you will have to introduce the VCT password. Remember that it is confine.

From the same SSH session, connect to the sliver.

vct@vct:~$ ssh -i /var/lib/vct/keys/id_rsa root@fd65:fc41:c50f:7:1002::5

 Opentracker started

You can logout from the SSH-tunneled session, but keep running the tracker.

Installing Transmission

We are going to install the Transmission software on slivers from bit-experiment@Virtual node 2 to bit-experiment@Virtual node 4. So, open a new terminal window, start the slivers – if you didn't before – and log inside them to replicate the next part of the tutorial on all nodes. As an example, we will execute next commands on the sliver running on node node 2.

vct@vct:~$ ssh -i /var/lib/vct/keys/id_rsa root@fd65:fc41:c50f:8:1002::5

As we did on our first sliver, we have to update the packages list first, and install all the necessary software. Luckily, all we need can be provided by the APT package manager.

root@000000000005_0009:~# apt-get update
root@000000000005_0009:~# apt-get install vim transmission-cli transmission-common transmission-daemon

The *NIX editor is necessary in order to modify the transmission configuration file. We chose Vim because we are more familiar with it, but you are free to use your preferred text editor.

Each time the Transmission daemon is started, it loads its configuration file. So, we need to stop it first.

root@000000000005_0009:~# service transmission-daemon stop
Stopping bittorrent daemon: transmission-daemon.
 
 
root@000000000005_0009:~# vim /var/lib/transmission-daemon/info/settings.json

The settings.json file controls the whole daemon configuration. There are a lot of available options – most of them self-explanatory – but we will focus on RPC options that control the web interface access.

Note that we do not modify the bind interfaces options. As we are going to use the sliver as our base template later, the network interface will change.

{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "dht-enabled": true,
    "download-dir": "/var/lib/transmission-daemon/downloads",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "encryption": 1,
    "incomplete-dir": "/root/Downloads",
    "incomplete-dir-enabled": false,
    "lazy-bitfield-enabled": true,
    "lpd-enabled": false,
    "max-peers-global": 200,
    "message-level": 2,
    "open-file-limit": 32,
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": 0,
    "pex-enabled": true,
    "port-forwarding-enabled": false,
    "preallocation": 1,
    "proxy": "",
    "proxy-auth-enabled": false,
    "proxy-auth-password": "",
    "proxy-auth-username": "",
    "proxy-enabled": false,
    "proxy-port": 80,
    "proxy-type": 0,
    "ratio-limit": 2.0000,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{d5d639bf9662b82f7d4810b50cb4c129c60d552bhERHBes4",
    "rpc-port": 9091,
    "rpc-username": "transmission",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 18,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 14
}

We have to set to “false” the rpc-whitelist-enabled parameter to allow users from anywhere to connect to the Transmission web interface.

    "rpc-whitelist-enabled": false,

Now we are ready to save the changes, start the service and log into the web interface.

root@000000000005_0009:~#  service transmission-daemon start
Starting bittorrent daemon: transmission-daemon.

The web interface will be accessible then through the URL http://SLIVER_PUBLIC_IP:9091/, where SLIVER_PUBLIC_IP is the address of the sliver's IPv4 public interface pub0 (in our case, is 10.241.0.93 for the sliver at Virtual node 2, 10.241.0.171 for that in Virtual node 3 and 10.241.0.93 for that in Virtual node 4, please check yours with ip -4 addr show dev pub0). If you did not change the rpc-username and rpc-password options you should be able to authenticate using transmission both as username and password.

 Transmission loging

Remember that now we will need another SSH tunnel to access the Transmission web page from our host. In such case, we executed the following command in a new terminal in your host machine: ~$ ssh -L 9091:10.241.0.93:9091 vct@172.24.42.141. After typing “confine” as password, we then execute the following command: vct@vct:~$ ssh -i /var/lib/vct/keys/id_rsa root@fd65:fc41:c50f:8:1002::5.

 Transmission running on a sliver

The queue is, of course, empty because we have no files to download.

Running the experiment

To test our experiment, we need a complete file seeded by one of the clients (in our case, the sliver at Virtual node 2) and another one downloading it (we are going to use only Virtual node 3). Let us prepare the seeder sliver first.

Seeder set up

Log inside the sliver at Virtual node 2 and install the extra packages needed to download our shared file. Here fd65:fc41:c50f:8:1002::5 is what we will call the SEEDER_ADDR.

vct@vct:~$ ssh -i /var/lib/vct/keys/id_rsa root@fd65:fc41:c50f:8:1002::5
root@000000000005_0009:~# apt-get install wget

Then we need a file to download. It should be large enough to take some time to download it, but not too much (because we will run out on free space). So, we choose the CONFINE compiled image from our public images repository. Download it and place it in the Transmission's download directory.

wget http://images.confine-project.eu/misc/CONFINE-owrt-master-atom-20130711-1309.img.gz
mv CONFINE-owrt-master-atom-20130711-1309.img.gz /var/lib/transmission-daemon/downloads/file.tar.gz

One advantage of Transmission over other BitTorrent clients is that, additionally to its web-based interface, it also provides useful command line tools. We will use some of them to create our torrent file and publish it.

First, make sure your Opentracker is still running, and execute the next command pointing to your tracker public IPv4 interface (TRACKER_ADDR defined above).

root@000000000005_0009:/#transmissioncli -n /var/lib/transmission-daemon/downloads/file.tar.gz -c "Example file" -a http://TRACKER_ADDR:80/announce file.torrent

You will see the following information in your terminal:

Transmission 2.03 (11030) - http://www.transmissionbt.com/
[14:43:37.538] Transmission 2.03 (11030) started
[14:43:37.543] RPC Server: Adding address to whitelist: 127.0.0.1
[14:43:37.545] DHT: Generating new id
creating torrent "file.torrent"
[14:43:37.927] Saved "file.torrent"
[14:43:37.931] Port Forwarding (NAT-PMP): initnatpmp succeeded (0)
[14:43:37.935] Port Forwarding (NAT-PMP): send public address request succeeded (2)

A new file.torrent file should have been created containing the necessary information to contact the Opentracker and download this file from the peers. It is time to publish it by executing the following command:

root@000000000005_0009:~# transmission-remote -n transmission:transmission -a file.torrent -t daemon

If you check your Opentracker or Transmission interfaces, you will see your file available.

 The tracker sharing one torrent

There is, of course, one torrent file announced in the tracker, with 1 peer connected (the client in sliver at Virtual node 2, which has the whole file).

 Transmission seeding a file

Starting the experiment

Our experiment consists in downloading a file from multiple clients inside a BitTorrent network. For now, we have configured a tracker and a torrent client on different CONFINE virtual slivers at Virtual node 1 and Virtual node 2. We also configured two more slivers at Virtual node 3 and Virtual node 4 respectively. From them we will download the announced file, but before that, we need to get the torrent file descriptor.

Now, from inside VCT-CONTAINER type:

vct@vct:~$ scp -i /var/lib/vct/keys/id_rsa root@\[fd65:fc41:c50f:8:1002::5\]:/root/file.torrent .
vct@vct:~$ scp -i /var/lib/vct/keys/id_rsa ./file.torrent root@\[fd65:fc41:c50f:8:1002::5\]:/root/

Where fd65:fc41:c50f:8:1002::5 is the corresponding SEEDER_ADDR of the sliver in Virtual node 2.

Finally, we can start our experiment, log-in inside the Virtual node 3 and subscribe to other peers and download the file:

root@000000000003_0007:~# transmission-remote -n transmission:transmission -a file.torrent

The Opentracker and Transmission web interfaces show now the new update.

 tracker sharing the file

 Transmission sharing the file

Click here to go to Part 3 of this tutorial. Or click the next link if you rather want to go back to the Tutorials Main Page.

cl-tutorial/first_e.txt · Last modified: 2014/09/17 12:07 by esunly