BitTorrent-NAT-HOWTO ------------------------------------------------------------------------ This HOWTO explains howto configure a BitTorrent tracker and seeder on a private LAN behind a iptables masquerading firewall. Prerequisites : Make sure your have the python based BitTorrent package installed. See the official BitTorrent web site at http://bittorrent.com/ or get your favorate rpm for your distro : search for bittorrent at rpm.pbone.net or www.rpmfind.net. next make sure your iptables masquerading firewall has the following tcp port redirected to the machine you will run the BitTorrent programs on: BTTR_IP=10.0.18.71 TCP_ALLOW : 6881 6882 6883 6884 6885 6886 6887 6888 6889 6969 TCP_FW : 6881:6881>$BTTR_IP \ 6882:6882>$BTTR_IP \ 6883:6883>$BTTR_IP \ 6884:6884>$BTTR_IP \ 6885:6885>$BTTR_IP \ 6886:6886>$BTTR_IP \ 6887:6887>$BTTR_IP \ 6888:6888>$BTTR_IP \ 6889:6889>$BTTR_IP \ 6969:6969>$BTTR_IP Next if you have a ADSL connection tweak you internal DNS so that a DNS-lookup of e.g. bttr.my-domain.net points to 10.0.18.71 (your bittorrent machine) . At the same time make sure that a DNS lookup of the same name bttr.my-domain.net somewhere on the Internet points to the ip-number of your ADSL connection. For more into howto do this see http://crashrecovery.org/named/. In this example the following lines should be added : inside http://crashrecovery.org/named/primary/my-domain.net.hosts.inside : bttr IN A 10.0.18.71 inside http://crashrecovery.org/named/primary/my-domain.net.hosts.outside : bttr.my-domain.net. IN A 61.9.252.148 For more details on the steps below see also the README.txt from the official BitTorrent source package. 1. fire up your tracker : # nohup bttrack.py --port 6969 --dfile dstate > tracker.log 2>&1 & 2. create your torrent file : # btmakemetafile.py linux-distro.iso http://bttr.my-domain.net:6969/announce 3. fireup your 1st downloader (start a downloader as a resume on the complete file) : # btdownloadcurses.py --ip bttr.my-domain.net linux-distro.iso.torrent The trick is inside the --ip option. Because you point to a DNS name instead of a ip-number, it works like expected : On your local private LAN bttr.my-domain.net points to 10.0.18.71 which your tracker understands. If however someone on the Internet starts a bittorrent download with your linux-distro.iso.torrent it not only find bttr.my-domain.net (61.9.252.148), it also will immediately will find your 1st seeder without problems as your tracker announces it as bttr.my-domain.net and not 10.0.18.71 as ip-number. Using the DNS trick bttr.my-domain.net will translate to 61.9.252.148 and not 10.0.18.71 outside on the Internet. Robert M. Stockmann stock@stokkie.net Sun Jan 30 01:54:59 CET 2005