How to display IP of mirror site and exclude it

Wayne Davison wayne at
Wed Apr 22 22:43:04 UTC 2020

On Wed, Apr 8, 2020 at 8:15 AM Gerard E. Seibert wrote:

> Since this does not happen on all of the mirror sites, I would like a way
> to get a list or have rsync display the IP of the site it received an error
> message from and a way to block the use of that IP in the future. Is that
> possible?

You can get rsync to ouptut the IP it connected to by using this option:

As for avoiding a bad IP, rsync doesn't choose the IP itself, so there are
a couple things you could do instead of hacking on the rsync source code to
add some DNS-lookup and IP-exclusion code:

The simplest is to put a single IP & domain-name combo into your /etc/hosts
file, at which point that will be the only mirror that rsync uses for that
domain name.

If you instead want it to cycle between multiple IPs, you could use a
simple caching DNS setup via dnsmasq. This software has a very simple
override method where you specify a "addn-hosts=/file/name" line in its
config file and then put multiple /etc/hosts style lines into it (since
dnsmasq will add all the "IP DOMAIN" lines into a multi-IP result for that
DOMAIN, unlike the normal local resolver which just picks the first IP).
You'd just need to be sure to configure your localhost DNS lookups to use
dnsmasq, which can be as simple as adding a "nameserver" line at
the start of your /etc/resolve.conf file in front of your other nameserver
line(s) (since dnsmasq skips a leading localhost nameserver line for its
forwarded requests while local lookups use the first line in preference to
the others). An alternative config option would be to add "alias"
directives into the dnsmasq config where you tell it to replace a bad IP
with a known-good IP.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list