SChernykh / p2pool

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

can i connect a remote miner to my node? #246

Closed Thorgrlm closed 1 year ago

Thorgrlm commented 1 year ago

Hi, in my local network I have installed a miner with p2pool + monero + xmr and I have a miner outside the local network, how can I connect my remote miner? thansk you

SChernykh commented 1 year ago

You need to port forward stratum port (P2Pool uses port 3333 by default) on your router, and then run xmrig with -o YOUR_EXTERNAL_IP:3333 in command line, or set "url":"YOUR_EXTERNAL_IP:3333" in config.json (if you use config.json instead of command line).

Thorgrlm commented 1 year ago

Hi, sorry by delayed to answer... this fix no work... I opened the port 3333 in my router, my machine is un ubuntu server 20.04

SChernykh commented 1 year ago

This fix does work. Something else is blocking the connection. Are you sure your ISP doesn't have another NAT after your router? Did you enter the correct local IP in router settings for port 3333? Is your P2Pool instance actually using port 3333? No firewall blocking incoming connections on your server? No special command line there to change the port number? Are you using the correct external IP in XMRig when testing it? Check all this.

Thorgrlm commented 1 year ago

Are you sure your ISP doesn't have another NAT after your router? no, my machine direct connect I'm used other services, the device is used other port and work fine

Did you enter the correct local IP in router settings for port 3333? Yes, is correct

Is your P2Pool instance actually using port 3333? I thinks so yes

minner1@farm:~$ netstat -putona | grep 3333 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:3333 0.0.0.0: LISTEN 2090045/./p2pool off (0.00/0/0) tcp 0 0 127.0.0.1:60410 127.0.0.1:3333 ESTABLISHED - keepalive (45.60/0/0) tcp 0 0 127.0.0.1:3333 127.0.0.1:60410 ESTABLISHED 2090045/./p2pool off (0.00/0/0) tcp6 0 0 :::3333 ::: LISTEN 2090045/./p2pool off (0.00/0/0)

No firewall blocking incoming connections on your server? No, the firewall is perfect

No special command line there to change the port number? I don't undertand this question

Are you using the correct external IP in XMRig when testing it? Yes, i'm sure

SChernykh commented 1 year ago

tcp 0 0 0.0.0.0:3333 0.0.0.0:* LISTEN 2090045/./p2pool off (0.00/0/0)

This means p2pool is listening on port 3333, the issue is somewhere else in your setup. Can you connect to it from within your LAN?

Thorgrlm commented 1 year ago

yes, i have a miner in other machine and work fine within my LAN everything works fine

jameswillhoite commented 1 year ago

Do you have iptables blocking anything? I have 2 p2pools running (one on a computer with a ssd and one in a Hyper-V incase the first goes down). I have a few computers outside my network mining on the p2pool instance at home here.

You are using your Public IP on the device outside your network? You've forwarded the external port 3333 to the internal port 3333 to the static ip address of your p2pool instance?

Thorgrlm commented 1 year ago

Do you have iptables blocking anything? I think not, I have more services, such as mail server with access outside my network, miners, NAS, FTP and everything works fine

You are using your Public IP on the device outside your network? I have a domain pointing to my network and it works with the rest of the services

You've forwarded the external port 3333 to the internal port 3333 to the static ip address of your p2pool instance? Yes

DeeDeeRanged commented 1 year ago

Do you have iptables blocking anything? I think not, I have more services, such as mail server with access outside my network, miners, NAS, FTP and everything works fine

You are using your Public IP on the device outside your network? I have a domain pointing to my network and it works with the rest of the services

You've forwarded the external port 3333 to the internal port 3333 to the static ip address of your p2pool instance? Yes

I am running Debian bookworm (testing) and have my setup as follows:

Port Forwarding: For Monero: 18080, 18081, 18083, 18089 all TCP For P2Pool: 3333, 37889 or 37888 (for p2pool-mini) all TCP

===== /etc/monero/monerod.conf

"# Data directory (blockchain db and indices)" data-dir=/home/monero/.bitmonero

"# Log file and pruning blockchain" log-file=/var/log/monero/monerod.log log-level=0 prune-blockchain=1

"# Set max cpu threads"

max-concurrency=2

"# RPC open node" public-node=1 rpc-restricted-bind-ip=0.0.0.0 rpc-restricted-bind-port=18089 no-igd=1

"# Slow but reliable db writes" db-sync-mode=safe

"# Block/Set ZMQ configuration" zmq-pub=tcp://0.0.0.0:18083

"# Bandwidth" out-peers=64 in-peers=32

limit-rate-up=62500

limit-rate-down=125000

add-priority-node=node.supportxmr.com:18080 add-priority-node=nodes.hashvault.pro:18080

"# DNS checkpoints" disable-dns-checkpoints=1 enable-dns-blocklist=1 check-updates=disabled "#non-interactive=1"

====== /etc/systemd/system/monerod.service

[Unit] Description=Monero Full Node After=network.target

[Service] User=monero Group=monero

Type=simple PIDFile=/home/monero/monerod.pid ExecStart=/usr/bin/monerod --config-file /etc/monero/monerod.conf --pidfile /home/monero/monerod.pid --detach Restart=always RestartSec=5

[Install] WantedBy=multi-user.target

===== /etc/systemd/system/p2pool.service

[Unit] Description=p2pool mining node Requires=monerod.service After=monerod.service

[Service] User=monero Group=monero WorkingDirectory=/home/monero/p2pool-v3.2 Type=simple ExecStart=/home/monero/p2pool-v3.2/p2pool --loglevel 1 --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet Your_Wallet --stratum 0.0.0.0:3333 --mini Restart=always

[Install] WantedBy = multi-user.target

===== /etc/systemd/system/xmrig.service

[Unit] Description = XMRig Miner After = p2pool.service Wants = p2pool.service

[Service] User = root Group = root Type = simple ExecStart = /home/monero/xmrig-latest/xmrig --http-host=0.0.0.0 --http-port=10050 --http-access-token="WhateverYouSetItFor" --http-no-restricted -o Your_Outside-IPaddress:3333 -u x+50000 Restart = always

[Install] WantedBy = multi-user.target

===== Had to put Quotation marks around the hashes otherwise it would show up very large here.

Take it you know your outside IPaddress otherwise you can find out with http://ipv4.icanhazip.com/ in your browser.

With this setup I can mine with my notebook when I am on the road and access my wallet to if needed.

@SChernykh If have any improvements I am open for it.

SChernykh commented 1 year ago

Closing as this is not a p2pool issue, but system configuration issue.