LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-18-2019, 02:12 AM   #1
am1x
LQ Newbie
 
Registered: Mar 2019
Posts: 3

Rep: Reputation: Disabled
Running torrent tracker on a local host


Hi everyone,
I want to share big files via bitTorrent.
I've set up a tracker opentracker listening to port 6969, and a client kTorrent listening to port 6881. My network uses NAT. I create a torrent file, set the tracker as http://<external_ip>:6969/announce, the client tries to connect to it and shows "Could not connect to host localhost" message. If I use local ip (192.168.1.2) I can connect to the tracker, but other peers see my ip as 192.168.1.2.
If all clients are inside the same LAN they manage to share files this way. Port forwarding works fine, the tracker is reachable from outside.
I don't have a router that supports NAT loopback, but I'm looking for some workaround to do the same thing with software.
 
Old 03-20-2019, 02:46 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
You can use iptable to open some port.
 
Old 03-20-2019, 11:16 PM   #3
am1x
LQ Newbie
 
Registered: Mar 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
How to do it? I'm new to it so could you explain me step by step, which commands should I use?
I tried using these iptables rules but it doesn't work, other peers still see my ip as 192.168.1.2.
Code:
iptables -t nat -I OUTPUT -p tcp -m tcp --dport 6969 -d <external_ip>/32 -j DNAT --to-destination 192.168.1.2
iptables -t nat -I OUTPUT -p tcp -m tcp --dport 6881 -d <external_ip>/32 -j DNAT --to-destination 192.168.1.2
iptables -t nat -I POSTROUTING -p tcp -m tcp --sport 6881 -s 192.168.1.2/24 -d 192.168.1.2 -j SNAT --to-source <external_ip>
iptables -t nat -I POSTROUTING -p tcp -m tcp --sport 6969 -s 192.168.1.2/24 -d 192.168.1.2 -j SNAT --to-source <external_ip>
 
Old 03-21-2019, 03:02 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
7.4.1. DMZs and iptables
iptables rules can be set to route traffic to certain machines, such as a dedicated HTTP or FTP server, in a demilitarized zone (DMZ) — a special local subnetwork dedicated to providing services on a public carrier such as the Internet. For example, to set a rule for routing incoming HTTP requests to a dedicated HTTP server at 10.0.4.2 (outside of the 192.168.1.0/24 range of the LAN), NAT calls a PREROUTING table to forward the packets to their proper destination:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT \ --to-destination 10.0.4.2:80

With this command, all HTTP connections to port 80 from the outside of the LAN are routed to the HTTP server on a separate network from the rest of the internal network. This form of network segmentation can prove safer than allowing HTTP connections to a machine on the network. If the HTTP server is configured to accept secure connections, then port 443 must be forwarded as well.
 
Old 04-06-2019, 08:15 AM   #5
am1x
LQ Newbie
 
Registered: Mar 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
I don't have a router with iptables. Port forwarding works fine, the tracker is reachable from outside. I can't connect to it from the client running on the same PC.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source torrent tracker onel0ve Linux - Software 2 03-07-2013 02:37 PM
[Help] torrent tracker server in CentOS ubungu Linux - Server 1 11-13-2012 03:11 AM
Torrent tracker for linux dlugasx Linux - Software 2 11-26-2010 11:29 AM
youceff torrent tracker down? tripmix General 0 12-13-2004 05:45 PM
10.1 Torrent Download, tracker down har02052 Linux - Networking 1 11-02-2004 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration