Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: loserkids on February 16, 2017, 01:07:58 AM



Title: Dynamic IP change - incoming connections drop
Post by: loserkids on February 16, 2017, 01:07:58 AM
I have a spare macbook pro which I dedicated to running full bitcoin node (along with other decentralized services).

I've opened 8333 on my router and got around 20 connections yesterday (I'm still syncing the chain) but after a dynamic IP change this morning, it dropped back to 8 with no incoming traffic whatsoever. The node also appeared offline on bitnodes.21.co.

I found a 2 yo thread describing the same issue so I'm wondering if it was fixed or there's nothing I can do about it (static IP is not a possibility in my case)?

// edit I run 0.13.2


Title: Re: Dynamic IP change - incoming connections drop
Post by: coinableS on February 16, 2017, 01:32:21 AM
Common issue for nodes or when running a web server from home. Take a look at NOIP dynamic DNS. http://www.noip.com/support/knowledgebase/getting-started-with-no-ip-com/

I have no affiliation with NOIP, but I have used them in the past which is why I'm recommending them as a solution. Good luck!


Title: Re: Dynamic IP change - incoming connections drop
Post by: loserkids on February 16, 2017, 02:07:29 AM
I already use noip for stats on bitnodes to be visible under a single host regardless of the IP. But how do you setup a node to get use of it?

Can you simply add bind=<my dyndns hostname> to bitcoin.conf?


Title: Re: Dynamic IP change - incoming connections drop
Post by: coinableS on February 16, 2017, 04:40:24 AM
Just run it on the same machine as your node. It will automatically update every time your router changes it's IP. Other peers will still just connect to the same static IP provided by noip. 


Title: Re: Dynamic IP change - incoming connections drop
Post by: loserkids on February 16, 2017, 11:17:42 AM
Just run it on the same machine as your node.
What do you mean by "it"? I run NOIP DUC (dynamic updater client) and it updates the IP for my hostname just fine. But I don't think my node is visible on the network as a hostname, but as an IP instead.


Title: Re: Dynamic IP change - incoming connections drop
Post by: piotr_n on February 16, 2017, 01:54:45 PM
I don't think setting up dynamic DNS records for his node is going to help him anyhow with this issue.

I don't know much about bitcoin core, but it might have something to do with it being unable to notice your IP changes.
Maybe it's better to ask on the support forum.


Title: Re: Dynamic IP change - incoming connections drop
Post by: loserkids on February 16, 2017, 01:58:32 PM
I don't think setting up dynamic DNS records for his node is going to help him anyhow with this issue.

I don't think so either.

I don't know much about bitcoin core, but it might have something to do with it being unable to notice your IP changes.
Maybe it's better to ask on the support forum.
Moved.


Title: Re: Dynamic IP change - incoming connections drop
Post by: 0xfff on February 16, 2017, 04:02:41 PM
You could try running the node through a proxy that gives you a static ip address. You could pay a cloud provider like AWS for a very cheap VPS and use that as a proxy.


Title: Re: Dynamic IP change - incoming connections drop
Post by: Real-Duke on February 17, 2017, 01:14:22 PM
Have had the same issue with 0.13.1 and opened a ticket: https://github.com/bitcoin/bitcoin/issues/9056
Seems I was al alone with this problem so I decided to go back to 0.12.1 what works flawlessy so far.

But this sounds like a solution
Quote
You could try running the node through a proxy that gives you a static ip address. You could pay a cloud provider like AWS for a very cheap VPS and use that as a proxy.

Maybe I try it again this way, thanks!


Title: Re: Dynamic IP change - incoming connections drop
Post by: 2112 on February 19, 2017, 07:47:55 PM
The reliable solution to your problem is to periodically restart your Bitcoin Core client.

I'm assuming that you have one of those PPPoE or PPPoA services that force PPP session renegotiation every 24 hours if you not renegotiate earlier on your own. In that case the best solution is to write a script that periodically:

1) shuts down bitcoin{d,-qt} using bitcoin-cli
2) forces PPP session disconnect and reconnect
3) restarts bitcoin{d,-qt}

This has been working reliably for many users for years now, they get decent bandwidth and transaction propagation.

Depending on the specifics of your ISP this script has to be either:

a) run at fixed time of day with a short (e.g. 1 minute) pause between disconnect and reconnect
b) run on a rolling schedule every 22 (or so) hours
c) run twice daily on a fixed schedule (or better twice nightly)

The other possibility is to see if your ISP may be supporting mixed IPv4/IPv6 deployment (oftentimes it just needs appending something in your PPPoE login e.g. "you@yourisp.eu" changes to "you@yourisp.eu/ipv6". In that case the PPP session can stay up for weeks or months at a time and oftentimes reconnecting your PPP session doesn't change the assigned IPv4 & IPv6 addresses. The usual consumer-level dual-stack deployments have limitations on IPv4 connectivity but will give you nearly permanent /64 (or /56) of IPv6 address space. Your incoming Bitcoin connection will be then over IPv6.


Title: Re: Dynamic IP change - incoming connections drop
Post by: loserkids on February 22, 2017, 03:09:47 AM
The reliable solution to your problem is to periodically restart your Bitcoin Core client.
That's what I do with OpenBazaar because they store IPs instead of hostnames in the DHT and I have the exact same problem when my IP changes.

I made this little script for it (in case someone wants to modify it for their bitcoin client):

Code:
#!/bin/sh

# Create log file
LOG="/tmp/ip-check.log"
touch $LOG

IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
LAST_IP="$(cat $LOG)"

if [ "$IP" != "$LAST_IP" ]; then
    # Save the new IP
    echo "test"
    echo $IP > $LOG

    # Restart OB
    sudo service openbazaar restart
fi

I check for the change every 5 minutes via crontab:

Code:
*/5 * * * * sh /home/user/bin/check.sh >/dev/null 2>&1

The other possibility is to see if your ISP may be supporting mixed IPv4/IPv6 deployment
I checked and my ISP doesn't support IPv6 AFAIK. I'll be restarting my client then.

Thanks!