I run a mynode full node on a raspi for quite some time now and was playing around with Python scripts to connect and send txs. This worked fine until lately. Turns out the connection establish process fails because my full node refuses the connection request I send from my PC. Apparently, he's not fine with me connecting via port 8333 which I always did in the past. Why would the request be rejected? Both, full node and PC are in the same VLAN. Below a photo link from wireshark to a connection request with port 8333 (fails) and a request with port 8332 (no issues).
https://postimg.cc/gallery/7ZwCxDH (server responds to TCP handshake with a TCP reset (RST))
The relevant code block comes down to:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = "192.168.30.87"
PORT = 8333
s.connect((HOST, PORT))
The full node is fully synced with plenty of connections (Tor and Non-Tor).
Below the result from netstat -tulp
(updated with admin rights to show the program using the socket):
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:amanda 0.0.0.0:* LISTEN 25329/lnd
tcp 0 0 localhost:xtell 0.0.0.0:* LISTEN 5398/electrs
tcp 0 0 0.0.0.0:20000 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:9824 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:3011 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:5031 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:7656 0.0.0.0:* LISTEN 785/i2pd
tcp 0 0 0.0.0.0:5001 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:62602 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:6379 0.0.0.0:* LISTEN 3559/redis-server 1
tcp 0 0 0.0.0.0:8011 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:28332 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 0.0.0.0:8332 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 localhost:6668 0.0.0.0:* LISTEN 785/i2pd
tcp 0 0 172.17.0.1:8333 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 localhost:8333 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 0.0.0.0:28333 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 0.0.0.0:8013 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:8334 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 5037/docker-proxy
tcp 0 0 0.0.0.0:28334 0.0.0.0:* LISTEN 3846/bitcoind
tcp 0 0 0.0.0.0:8335 0.0.0.0:* LISTEN 7928/node
tcp 0 0 0.0.0.0:2223 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:8015 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:4080 0.0.0.0:* LISTEN 7295/docker-proxy
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN 729/python3
tcp 0 0 0.0.0.0:9136 0.0.0.0:* LISTEN 785/i2pd
tcp 0 0 0.0.0.0:50001 0.0.0.0:* LISTEN 5398/electrs
tcp 0 0 0.0.0.0:2225 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:8017 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:4081 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:49393 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:50002 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:5011 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:8019 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 759/sshd
tcp 0 0 0.0.0.0:3031 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:61208 0.0.0.0:* LISTEN 733/python3.8
tcp 0 0 0.0.0.0:10009 0.0.0.0:* LISTEN 25329/lnd
tcp 0 0 0.0.0.0:8089 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:3001 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:61209 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:3002 0.0.0.0:* LISTEN 8432/node
tcp 0 0 0.0.0.0:8890 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:9050 0.0.0.0:* LISTEN 3178/tor
tcp 0 0 0.0.0.0:https 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 0.0.0.0:3003 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:9051 0.0.0.0:* LISTEN 3178/tor
tcp 0 0 localhost:4444 0.0.0.0:* LISTEN 785/i2pd
tcp 0 0 0.0.0.0:5021 0.0.0.0:* LISTEN 3341/nginx: master
tcp 0 0 localhost:7070 0.0.0.0:* LISTEN 785/i2pd
tcp 0 0 localhost:4447 0.0.0.0:* LISTEN 785/i2pd
tcp6 0 0 [::]:ssh [::]:* LISTEN 759/sshd
udp 0 0 0.0.0.0:51194 0.0.0.0:* 1920/openvpn
udp 0 0 0.0.0.0:bootpc 0.0.0.0:* 1516/dhclient
udp 0 0 0.0.0.0:9136 0.0.0.0:* 785/i2pd
udp 0 0 0.0.0.0:mdns 0.0.0.0:* 595/avahi-daemon: r
udp 0 0 localhost:7655 0.0.0.0:* 785/i2pd
udp 0 0 0.0.0.0:42496 0.0.0.0:* 595/avahi-daemon: r
udp6 0 0 [::]:44900 [::]:* 595/avahi-daemon: r
udp6 0 0 [::]:mdns [::]:* 595/avahi-daemon: r
I only see localhost
and 172.17.0.1
with port 8333, so thats odd.
In the bitcoin.conf
I explicitly added the IP of my client PC to the whitelist (192.168.30.156)
# bitcoin configuration
# /home/bitcoin/.bitcoin/bitcoin.conf
# Bitcoin options
server=1
daemon=1
# Bind to localhost and docker
bind=127.0.0.1
bind=172.17.0.1
# Needed for BTC-RPC-Explorer
txindex=1
# CPU count
par=-1
# Debug log settings
shrinkdebugfile=1
# Connection settings
rpcauth=mynode:ac633d1117f36eb0d44651f76e2f4b13$ccb595afbb45b19718ae3870715f39f8dc7dbcaa137c5ffd969f47e47fbade13
rpcport=8332
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
rpcallowip=10.0.0.0/8
rpcallowip=172.16.0.0/12
rpcallowip=192.168.0.0/16
# Set default wallet so some wallet APIs work
main.wallet=wallet.dat
main.wallet=joinmarket_wallet.dat
test.wallet=wallet.dat
test.wallet=joinmarket_wallet.dat
# Enable Deprecated RPCs
deprecatedrpc=addresses
# Whitelist local connections (and docker)
whitelist=127.0.0.1
whitelist=192.168.30.156
whitelist=172.16.0.0/12
# Dont limit data to electrum server or local network
[email protected]/8
w[email protected]/16
# Enable Bloom filters (local network)
[email protected]/8
[email protected]/16
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashblock=tcp://0.0.0.0:28334
# myNode Optimizations
dbcache=1000
maxorphantx=10
maxmempool=250
maxconnections=40
maxuploadtarget=1000
rpcworkqueue=32
# IPv4 Disabled
dnsseed=0
dns=0
# Tor config
proxy=127.0.0.1:9050
listen=1
#onlynet=onion
Update:
So I checked with nmap
and the port is closed:
admin@myNode:~ $ nmap 192.168.30.87 -p 8333
Starting Nmap 7.70 ( https://nmap.org ) at 2022-11-24 01:42 CST
Nmap scan report for 192.168.30.87
Host is up (0.0090s latency).
PORT STATE SERVICE
8333/tcp closed bitcoin
However using the ufw
command it returns the port is already open. Any hints?
Update: below the ifconfig
result:
admin@myNode:~ $ ifconfig -a
br-0b53e988a5ad: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.28.0.1 netmask 255.255.0.0 broadcast 172.28.255.255
ether 02:42:a4:07:0d:c1 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br-64d06c0adaf9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.26.0.1 netmask 255.255.255.0 broadcast 172.26.0.255
ether 02:42:f3:41:f8:72 txqueuelen 0 (Ethernet)
RX packets 8998434 bytes 819555438 (781.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9009649 bytes 36218286954 (33.7 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br-68444510781f: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.30.0.1 netmask 255.255.0.0 broadcast 172.30.255.255
ether 02:42:6e:7b:52:df txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br-85aa3cb4cfcd: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.29.0.1 netmask 255.255.0.0 broadcast 172.29.255.255
ether 02:42:22:1b:53:1a txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br-f1547965b042: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
ether 02:42:77:f6:03:a1 txqueuelen 0 (Ethernet)
RX packets 1334303 bytes 101434833 (96.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2113575 bytes 1022268903 (974.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:f9:d8:80:7b txqueuelen 0 (Ethernet)
RX packets 5154 bytes 732024 (714.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6071 bytes 2700322 (2.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.30.87 netmask 255.255.255.0 broadcast 192.168.30.255
inet6 fe80::4690:abb5:3d80:5b6b prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:77:11:60 txqueuelen 1000 (Ethernet)
RX packets 7749728 bytes 3536205167 (3.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9660173 bytes 8853888597 (8.2 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 68625988 bytes 17225478612 (16.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68625988 bytes 17225478612 (16.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.0.1 netmask 255.255.255.0 destination 10.8.0.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth1693a12: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 76:3b:3f:ab:62:62 txqueuelen 0 (Ethernet)
RX packets 1024704 bytes 109773777 (104.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1103554 bytes 1164128434 (1.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth2066f12: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 66:21:35:37:84:83 txqueuelen 0 (Ethernet)
RX packets 13803 bytes 11002093 (10.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14065 bytes 5219579 (4.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth7961b83: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 8a:c8:c4:b0:d3:85 txqueuelen 0 (Ethernet)
RX packets 2437851 bytes 1284242989 (1.1 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3138277 bytes 1132042455 (1.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth930bbd0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 72:86:21:2b:cb:75 txqueuelen 0 (Ethernet)
RX packets 9004689 bytes 950162045 (906.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9015339 bytes 36228912911 (33.7 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethc1bb991: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 5e:a3:21:cc:f6:a8 txqueuelen 0 (Ethernet)
RX packets 36284 bytes 3813244 (3.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 36602 bytes 3599357 (3.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethdff0d05: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 4e:1e:fe:e0:93:e2 txqueuelen 0 (Ethernet)
RX packets 5154 bytes 804180 (785.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6071 bytes 2700322 (2.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:77:11:63 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Update: I checked the firewall rules:
admin@myNode:~ $ sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 8889 ALLOW IN Anywhere # allow lndg HTTP
[ 2] 25441 ALLOW IN Anywhere # allow Specter Desktop
[ 3] 8890 ALLOW IN Anywhere # allow lndg HTTPS
[ 4] 49392 ALLOW IN Anywhere # allow BTCPay Server-direct
[ 5] 2224 ALLOW IN Anywhere # allow wetty HTTP
[ 6] 49393 ALLOW IN Anywhere # allow BTCPay Server-direct HTTPS
[ 7] 2225 ALLOW IN Anywhere # allow wetty HTTPS
[ 8] 51194 ALLOW IN Anywhere # allow VPN
[ 9] 61208 ALLOW IN Anywhere # allow Glances
[10] 61209 ALLOW IN Anywhere # allow Glances HTTPS
[11] Anywhere ALLOW IN 127.0.0.1 # allow from localhost
[12] 19999 ALLOW IN Anywhere # allow netdata HTTP
[13] 20000 ALLOW IN Anywhere # allow netdata HTTPS
[14] 22 ALLOW IN Anywhere # allow SSH
[15] 80 ALLOW IN Anywhere # allow WWW
[16] 443 ALLOW IN Anywhere # allow Secure WWW
[17] 1900 ALLOW IN Anywhere # allow SSDP for UPnP discovery
[18] Anywhere ALLOW IN 10.0.0.0/8 1900 # allow UPnP from router
[19] Anywhere ALLOW IN 192.168.0.0/16 1900 # allow UPnP from router
[20] Anywhere ALLOW IN 172.16.0.0/12 1900 # allow UPnP from router
[21] 9911 ALLOW IN Anywhere # allow Lightning Watchtower
[22] 10009 ALLOW IN Anywhere # allow Lightning gRPC
[23] 10080 ALLOW IN Anywhere # allow Lightning REST RPC
[24] 9735 ALLOW IN Anywhere # allow Lightning
[25] 8332 ALLOW IN Anywhere # allow Bitcoin RPC - filtered by rpcallowip
[26] 8333 ALLOW IN Anywhere
[27] 18333 ALLOW IN Anywhere # allow Bitcoin testnet
[28] 28332 ALLOW IN 172.17.0.0/16 # allow Dojo zmqrawblock
[29] 28332 ALLOW IN 172.28.0.0/16 # allow Dojo zmqrawblock
[30] 28333 ALLOW IN 172.17.0.0/16 # allow Dojo zmqrawtx
[31] 28333 ALLOW IN 172.28.0.0/16 # allow Dojo zmqrawtx
[32] 28334 ALLOW IN 172.17.0.0/16 # allow Dojo zmqhashblock
[33] 28334 ALLOW IN 172.28.0.0/16 # allow Dojo zmqhashblock
[34] 8335 ALLOW IN Anywhere # allow corsproxy for btc rpc
[35] 8443 ALLOW IN Anywhere # allow Lightning Terminal
[36] 2222 ALLOW IN Anywhere # allow WebSSH2
[37] 2223 ALLOW IN Anywhere # allow WebSSH2 HTTPS
[38] 3000 ALLOW IN Anywhere # allow LndHub
[39] 3001 ALLOW IN Anywhere # allow LndHub HTTPS
[40] 3002 ALLOW IN Anywhere # allow BTC RPC Explorer
[41] 3003 ALLOW IN Anywhere # allow BTC RPC Explorer HTTPS
[42] 3010 ALLOW IN Anywhere # allow RTL
[43] 3011 ALLOW IN Anywhere # allow RTL HTTPS
[44] 3020 ALLOW IN Anywhere # allow Caravan
[45] 3030 ALLOW IN Anywhere # allow Thunderhub
[46] 3031 ALLOW IN Anywhere # allow Thunderhub HTTPS
[47] 3493 ALLOW IN Anywhere # allow Network UPS Tools
[48] 4080 ALLOW IN Anywhere # allow Mempool
[49] 4081 ALLOW IN Anywhere # allow Mempool HTTPS
[50] 5000 ALLOW IN Anywhere # allow LNBits
[51] 5001 ALLOW IN Anywhere # allow LNBits HTTPS
[52] 5010 ALLOW IN Anywhere # allow Warden Terminal
[53] 5011 ALLOW IN Anywhere # allow Warden Terminal HTTPS
[54] 5353 ALLOW IN Anywhere # allow Avahi
[55] 8010:8019/tcp ALLOW IN Anywhere # allow USB Extras HTTP/HTTPS
[56] 8899 ALLOW IN Anywhere # allow Whirlpool
[57] 9823 ALLOW IN Anywhere # allow CKBunker
[58] 9824 ALLOW IN Anywhere # allow CKBunker HTTPS
[59] 50001 ALLOW IN Anywhere # allow Electrum Server
[60] 50002 ALLOW IN Anywhere # allow Electrum Server
[61] 53001 ALLOW IN Anywhere # allow Sphinx Relay
[62] 56881 ALLOW IN Anywhere # allow myNode QuickSync
[63] 51413 ALLOW IN Anywhere # allow myNode QuickSync
[64] 6771 ALLOW IN Anywhere # allow myNode QuickSync (LPD)
[65] 2189 ALLOW IN Anywhere # allow UPnP
[66] 5351 ALLOW IN Anywhere # allow NAT-PMP
[67] 5020 ALLOW IN Anywhere # allow jam HTTP
[68] 5021 ALLOW IN Anywhere # allow jam HTTPS
[69] 5030 ALLOW IN Anywhere # allow lilywallet HTTP
[70] 5031 ALLOW IN Anywhere # allow lilywallet HTTPS
[71] 8088 ALLOW IN Anywhere # allow tailscale HTTP
[72] 8089 ALLOW IN Anywhere # allow tailscale HTTPS
[73] 62601 ALLOW IN Anywhere # allow JoinMarket Orderbook
[74] 62602 ALLOW IN Anywhere # allow JoinMarket Orderbook HTTPS
[75] 27183 ALLOW IN Anywhere # allow JoinMarket API
[76] 28183 ALLOW IN Anywhere # allow JoinMarket API
There's the port 8333 but it doesn't seem to be associated with Bitcoin. I assume it's listed because I opend it manually. So is the full node not using port 8333 at all?
bitcoin.conf
or equivalent? What shows up innetstat -tulp
on the Pi?0.0.0.0:8333
?nmap
and the port is closed:admin@myNode:~ $ nmap 192.168.30.87 -p 8333 Starting Nmap 7.70 ( https://nmap.org ) at 2022-11-24 01:42 CST Nmap scan report for 192.168.30.87 Host is up (0.0090s latency). PORT STATE SERVICE 8333/tcp closed bitcoin
Using theufw
command it returns the port is already open. Any hints?