SChernykh / p2pool

Decentralized pool for Monero mining
GNU General Public License v3.0
1.07k stars 127 forks source link

My remote miner won't connect to my miner at my home #75

Closed Thorgrlm closed 2 years ago

Thorgrlm commented 2 years ago

hi i have a problem with p2pool. in my house 2 one miners with monero + p2pool + xmrig and another only with xmrig and it works perfectly, I have a third computer that is in a remote location in another home and I cannot connect with xmrig to my home computer. the port 3333 is open, what could be wrong? this is the test in my miner of the open ports

user@niner-01:~$ sudo netstat -putona | grep 3333
tcp        0      0 0.0.0.0:3333            0.0.0.0:*               LISTEN      32514/./p2pool       off (0.00/0/0)
tcp        0      0 192.168.1.21:3333       192.168.1.5:38514       ESTABLISHED 32514/./p2pool       off (0.00/0/0)
tcp        0      0 127.0.0.1:3333          127.0.0.1:35190         ESTABLISHED 32514/./p2pool       off (0.00/0/0)
tcp        0      0 127.0.0.1:35190         127.0.0.1:3333          ESTABLISHED 2782/./xmrig         keepalive (59.04/0/0)
tcp6       0      0 :::3333                 :::*                    LISTEN      32514/./p2pool       off (0.00/0/0)

In my remote miner the test of port:

user2@rig:~$ sudo netstat -putona | grep 3333
tcp        0      0 0.0.0.0:3333            0.0.0.0:*               ESCUCHAR    12290/./PhoenixMine  apagado (0.00/0/0)
tcp        0      1 192.168.1.6:33468       95.188.201.134:3333     SYN_SENT    386/./xmrig          encendido (1,52/2/0)

Thanks you

SChernykh commented 2 years ago

Did you setup port forwarding on your router? Do other open ports work in your setup?

Thorgrlm commented 2 years ago

Did you setup port forwarding on your router? Do other open ports work in your setup?

yes i setup the ports 18080, 18083 and 37889 all work fine and all is open

trasherdk commented 2 years ago

So, you have a problem with your port-forwarding on your router/gateway. This is my config for monerod

public-node=1
prune-blockchain=1
enable-dns-blocklist=1
confirm-external-bind=1
out-peers=12
in-peers=12
limit-rate=2048
data-dir=/var/lib/monero/data/mainnet

# screen session, no forked daemon.
# pid-file=/var/lib/monero/data/mainnet/logs/monerod.pid
log-file=/var/lib/monero/data/mainnet/logs/monerod.log

# Internal, unrestricted IP address
rpc-bind-ip=192.168.1.70

# I don't want password on internal connections
#rpc-login=username:password

# External port forwarded IP address.
#rpc-restricted-bind-ip=192.168.1.71

# External, restricted listener. any:port
rpc-restricted-bind-ip=0.0.0.0
rpc-restricted-bind-port=18084
Thorgrlm commented 2 years ago

So, you have a problem with your port-forwarding on your router/gateway. This is my config for monerod

public-node=1
prune-blockchain=1
enable-dns-blocklist=1
confirm-external-bind=1
out-peers=12
in-peers=12
limit-rate=2048
data-dir=/var/lib/monero/data/mainnet

# screen session, no forked daemon.
# pid-file=/var/lib/monero/data/mainnet/logs/monerod.pid
log-file=/var/lib/monero/data/mainnet/logs/monerod.log

# Internal, unrestricted IP address
rpc-bind-ip=192.168.1.70

# I don't want password on internal connections
#rpc-login=username:password

# External port forwarded IP address.
#rpc-restricted-bind-ip=192.168.1.71

# External, restricted listener. any:port
rpc-restricted-bind-ip=0.0.0.0
rpc-restricted-bind-port=18084

where is that archive?

but no other port that I'm using for other services such as FTP, SSH, Netdata fails me. It seems strange to me that only that port fails

trasherdk commented 2 years ago

Here is a couple of things I would check, if I had problem connecting to a service.

My internet fiber access point is configured for DMZ to 192.168.1.71

Check what IP addresses are available on the host:

# ifconfig | grep -E '^eth' -A 1
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.70  netmask 255.255.255.0  broadcast 192.168.1.255
eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.71  netmask 255.255.255.0  broadcast 192.168.1.255
eth0:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.72  netmask 255.255.255.0  broadcast 192.168.1.255

Check what addresses and ports are being listened on:

# netstat -tulpn | grep monerod
tcp        0      0 0.0.0.0:18084           0.0.0.0:*               LISTEN      1115/monerod        
tcp        0      0 0.0.0.0:18080           0.0.0.0:*               LISTEN      1115/monerod        
tcp        0      0 192.168.1.70:18081      0.0.0.0:*               LISTEN      1115/monerod        
tcp        0      0 127.0.0.1:18082         0.0.0.0:*               LISTEN      1115/monerod        

Check that your host firewall allow access to the ports:

# iptables -L -n | grep '1808'
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpts:18080:18085 state NEW,RELATED,ESTABLISHED

Check that monerod responds to requests: internal unrestricted

# curl http://192.168.1.70:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "adjusted_time": 1637207628,
    "alt_blocks_count": 10,
  ...
  ...
}

Check that monerod responds to requests: external restricted

# curl http://192.168.1.71:18084/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "adjusted_time": 1637207628,
    "alt_blocks_count": 10,
  ...
  ...
}

Check that monerod responds to requests: external restricted from a remote, outside the router, location:

$ curl http://host.example.com:18084/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "adjusted_time": 1637211189,
    "alt_blocks_count": 0,
  ...
  ...
}

If any of the above tests fail, it should give you an idea where to look.

Thorgrlm commented 2 years ago

Hi @trasherdk it dosen't work and i don't know why

netstat -tulpn | grep monerod
tcp        0      0 0.0.0.0:18080           0.0.0.0:*               LISTEN      36778/./monerod
tcp        0      0 127.0.0.1:18081         0.0.0.0:*               LISTEN      36778/./monerod
tcp        0      0 127.0.0.1:18082         0.0.0.0:*               LISTEN      36778/./monerod
tcp        0      0 192.168.1.30:18083      0.0.0.0:*               LISTEN      36778/./monerod
curl http://192.168.1.30:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
curl: (7) Failed to connect to 192.168.1.30 port 18081: Connection refused
curl http://192.168.1.30:18084/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
curl: (7) Failed to connect to 192.168.1.30 port 18084: Connection refused

In the DMZ area i setup the ip of device and no work

I'm use the files download for here: https://github.com/SChernykh/p2pool/releases/tag/v1.3.1

trasherdk commented 2 years ago

Your second curl is targeting http://192.168.1.30:18084 and your daemon is listening on 192.168.1.30:18083 :smile: which is probably a ZMQ listener. Hitting the ZMQ port with curl should yield something like curl: (1) Received HTTP/0.9 when not allowed

How about the firewall thing iptables -L -n | grep '1808' ?

Thorgrlm commented 2 years ago

Your second curl is targeting http://192.168.1.30:18084 and your daemon is listening on 192.168.1.30:18083 smile which is probably a ZMQ listener. Hitting the ZMQ port with curl should yield something like curl: (1) Received HTTP/0.9 when not allowed

do you know how to fix the problem?

How about the firewall thing iptables -L -n | grep '1808' ?

the firewall in my miner is not enabled

trasherdk commented 2 years ago

The Connection refused response you get, indicates that either a firewall is blocking the request, or nothing is listening on the ports you are targeting, or could be, you have enabled password login on the daemon.

The how to fix the problem part, besides the troubleshooting mentioned before, I have no knowledge of your setup, and would be guessing.

Thorgrlm commented 2 years ago

It is the only service with which I have problems, no other service that I have in my line has problems, I have masternodes, stakes, miners, web server and only this fails me, I give up, what I am going to do is install the full node in my other device

thanks you for you help