Skip to content

[BUG] Sync issues with changing external IP from ISP + workaround solutionΒ #5448

@Daniel-1276

Description

@Daniel-1276

Describe the bug
In germany we get disconnected with our IPv4 addresses every 24h. After disconnect and reconnect we do get a new external IP. As soon as this happens at a certain time in the night, sync of chia full client gets lost.

To Reproduce

  • reboot router
  • change external IP

Expected behavior
Chia client should be able to reconnect by itself after external IP change

Screenshots
n/a

Desktop (please complete the following information):

  • OS: Windows 10
  • Port 8444 open from external

Additional context
Possible workaround below for FritzBox users developed. Windows Powershell-Script checks for external IP-change on FritzBox router via UPNP / SOAP request and will initiate a restart via "./chia.exe start farmer -r". Tested on FritzBox 7530, maybe this helps somebody until final fix.

function check-ip{
param (
	[String] $URL = "http://192.168.178.1:49000/igdupnp/control/WANIPConn1"
)

$soapWebRequest = [System.Net.WebRequest]::Create($URL) 
$soapWebRequest.Headers.Add("SOAPAction",'"urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress"')

$soapWebRequest.ContentType = 'text/xml;charset="utf-8"'
$soapWebRequest.Accept      = "text/xml" 
$soapWebRequest.Method      = "POST" 

$requestStream = $soapWebRequest.GetRequestStream() 
[string]$SOAPRequest='<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
  <u:GetExternalIPAddress xmlns:u=urn:schemas-upnp-org:service:WANIPConnection:1 />
</s:Body>
</s:Envelope>';

$SOAPRequestbytearray = ([system.Text.Encoding]::ASCII).GetBytes($SOAPRequest)
$requestStream.write($SOAPRequestbytearray,0,$SOAPRequestbytearray.count)
$requestStream.Close() 

$resp = $soapWebRequest.GetResponse() 
$responseStream = $resp.GetResponseStream() 
$soapReader = [System.IO.StreamReader]($responseStream) 
$ReturnXml = [Xml] $soapReader.ReadToEnd() 
$responseStream.Close()

$ip=$ReturnXml.Envelope.Body.GetExternalIPAddressResponse|foreach { $_.NewExternalIPAddress }
return $ip
}

# VARIABLES
$localappdata=$env:LOCALAPPDATA
$chiapath="chia-blockchain\app-1.1.5\resources\app.asar.unpacked\daemon"
$currentIP=check-ip
$lastIP=$currentIP

if (Test-Path -Path $localappdata\$chiapath\chia.exe){
write-host "Path to chia.exe checked and valid"
}else{
write-host "Path to chia.exe NOT valid, please check script"
pause
exit
}
write-host ""
write-host "Your current FritzBox external IP: $currentIP"
write-host "Start monitoring " -NoNewline

while($true){
	if(test-connection 8.8.8.8 -quiet){
		$currentIP = check-ip
	}
	if ($currentIP -ne $lastIP){
		cls
		write-host "IP change detected !"
		write-host "Old IP: $lastIP New IP: $currentIP"
		$lastIP = $currentIP

        	write-host "Restarting chia client now ..."
		start-process $localappdata\$chiapath\chia.exe -argumentlist "start farmer -r"

		write-host ""
		write-host "Start monitoring " -NoNewLine
	}
    Start-Sleep -Seconds 360
    write-host "." -NoNewline
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportThis is not the place for technical support but...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions