From a12f3e69595eba220b150d43e7edb6ba08dd523a Mon Sep 17 00:00:00 2001 From: chros73 Date: Sat, 19 Aug 2017 22:17:45 +0100 Subject: [PATCH] Update local_address and add bind_address section onto Common Tasks page --- Common-Tasks-in-rTorrent.rest | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Common-Tasks-in-rTorrent.rest b/Common-Tasks-in-rTorrent.rest index 56a6acf..dd01427 100644 --- a/Common-Tasks-in-rTorrent.rest +++ b/Common-Tasks-in-rTorrent.rest @@ -230,10 +230,36 @@ Switch to a custom view with ui.current_view.set = viewname -Manually setting the local IP +Setting bind address -------------------- -Using the ``-i `` flag or ``ip = `` option, you may change your IP address that is reported to the tracker. If you have a dynamic IP address then ``schedule = ip_tick,0,1800,ip=my_address`` may be used to update the IP address every 30 minutes. +Using the ``-b `` flag or ``bind = `` option, you may change the IP address the listening socket and outgoing connections is bound to. + +The following can be used to set an interface with IPv4 address (e.g. ``eth0``) to bind to. (Requires ``ip`` command that is part of ``iproute2`` package.) + +```ini +# Set an interface with IPv4 address to bind to: [eth0|tun0] +method.insert = cfg.interface.bind, string|const|private, (cat,"eth0") +# Get IPv4 address of a given interface +method.insert = get_interface_ipv4_address, simple|private, "execute.capture=bash,-c,\"$cat=\\\"echo -n \$(ip -o -4 addr show \\\",$argument.0=,\\\" | grep -Po 'inet \\\\\\\\\\K[\\\\\\\\\\d.]+')\\\"\"" +# The IP address the listening socket and outgoing connections is bound to. (bind) +schedule2 = set_bind_address, 0, 0, "branch=((cfg.interface.bind)),((network.bind_address.set,(get_interface_ipv4_address,(cfg.interface.bind))))" +``` + + +Setting the local IP +-------------------- + +Using the ``-i `` flag or ``ip = `` option, you may change your IP address that is reported to the tracker. + +If you have a dynamic IP address then the following can be used to update the IP address every 30 minutes without the need of having dynamic DNS service. (Requires ``dig`` command that is part of ``dnsutils`` package.) + +```ini +# Get public IP address without the need of having dynamic DNS service, also works from behind NAT, through tunnel +method.insert = get_public_ip_address, simple|private, "execute.capture=bash,-c,\"eval echo -n \$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com)\"" +# The IP address reported to the tracker. (ip) This handles dynamic IP's as well. +schedule2 = ip_tick, 0, 1800, "network.local_address.set=(get_public_ip_address)" +``` The client may spend as much as 60 seconds trying to contact a UDP tracker, so if you are behind a firewall that blocks the reply packets you should tell the client to skip the UDP tracker. Set ``use_udp_trackers = no`` in your configuration file or in the command line option.