Comments (10)
I think it was because I updated my raspibolt script to bash instead of /bin/sh
#!/bin/bash
In bash you check equality of STRINGS with ==.
And I converted $public_check to a string as follows: "$public_check" (added quotes)
But by all means do what works. I am not an expert on shell scripting at all.
:-)
from raspibolt.
Good catch, might be the cause for some of the issues raised here. Do you know of a different method to check the public availability of the Bitcoin node?
from raspibolt.
Sorry no.
Tried without success to fine an alternative service.
from raspibolt.
Found a solution. The Raspibolt itself can check if a port is open. While I do like the idea for a completely external check e.g. from https://bitnodes.earn.com, as we see - that can cause problem.
in the raspibolt script, change
public_check=$(curl -s https://bitnodes.earn.com/api/v1/nodes/me-${public_port}/ | jq .success)
if [ $public_check = "true" ]; then
to
public_check=$(timeout 2s nc -z ${public_ip} ${public_port}; echo $?)
if [ "$public_check" == "0" ]; then
from raspibolt.
Hi @robclark56, I tried to figure out how this should work. As long as I use my own ip address, netcat always return no value. Which means 'you are public', I guess?
Am I missing something?
from raspibolt.
nc -z IP PORT returns:
- 0 if success (ie PORT on IP is open)
- Non-Zero if failure (ie Port is not open)
Here are my examples (8333 is open, 12345 is not)
admin ~ ฿ nc -z 106.68.62.191 8333
admin ~ ฿ echo $?
0
admin ~ ฿ nc -z 106.68.62.191 12345
[..... long wait ....]
admin ~ ฿ echo $?
1
And here it is verbose
admin ~ ฿ nc -vz 106.68.62.191 8333
Connection to 106.68.62.191 8333 port [tcp/*] succeeded!
admin ~ ฿ nc -vz 106.68.62.191 12345
nc: connect to 106.68.62.191 port 12345 (tcp) failed: Connection timed out
But you indicate you get 'success' for all ports. That should not happen.
Try the verbose (-zv) option on a closed port.
from raspibolt.
Ok, works great! Was not aware that the return value needs to be printed...
from raspibolt.
Any special reason you went with the ==
operator? I get the following error message:
./20-raspibolt-welcome: 117: [: 0: unexpected operator
When using the normal =
operator, it works fine.
from raspibolt.
Updated the welcome script, thanks @robclark56!
PR #121
from raspibolt.
Hello @Stadicus @robclark56 !
I have some issues checking the public availability of my node (on testnet) with nc -vz IP PORT
. As my node try to access my public IP address from behind a NAT, he got confused. This is a classic networking problem.
Reading this blog post System: Accessing Public IP address from behind NAT I found what I first thought was a solution, which is adding a rule in iptables to convert my public IP to my local IP.
$ sudo iptables -A INPUT -p tcp --src 85.220.240.110 --dport 22 -j ACCEPT
$ sudo iptables -L -t nat
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DNAT all -- thundroid 85.220.240.110 to:192.168.1.104
It seems to work but in fact it is not checking anything because the request never really leave my local network. So not a proper solution.
It seems that this nc
call works seamlessly for some people but I can't figure out why it doesn't work for me. Any ideas? Thank you.
from raspibolt.
Related Issues (20)
- [BUG] Disabling zram after configuration - clarification HOT 2
- Missing font/symbol HOT 4
- [FEATURE REQ] Netdata HOT 6
- [BUG] error: externally-managed-environment HOT 8
- [BUG] Multiple typo's
- [BUG] Shorten steps in Guide HOT 3
- [BUG] Unable to find “GUI-NetLinks” in Guide
- [BUG] Update Bonus guide: BitBoxApp HOT 2
- SYNCRONISATION DE LA BASE BITCOIN HOT 2
- [BUG] Modify command HOT 2
- [BUG] Wrong port used HOT 2
- Can't connect my sparrow wallet to Electrum HOT 1
- [BUG] Cython update breaks specter install
- Adjust directory HOT 2
- [BUG] Tor warning HOT 6
- How does the backup work? HOT 5
- Permission denied after setting up SCB backup HOT 2
- Electrs fails almost weekly HOT 2
- Add lightning support to mempool block explorer [FEATURE REQ] HOT 2
- btcrpcexplorer - "No RPC connection" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raspibolt.