Welcome to the PiMP Mining Community Forum.
Coin/crypto news, miner.farm and getpimp.org announcements, guides, and tips.
- Check out the help videos in getting started and our coin strategy guides, and post if you need some help.
- Post your rig pics to the rig showcase so we can all check out your awesome builds!
- Don't forget to subscribe and please like/follow us on social media!
Agent - 127.0.0.1 vs Internal IP
I expected as much but it was worth a try.
The problem is as follows: there is no way to specify any IP other than the localhost when adding a miner. The agent code can use a different IP if specified, but this is not well developed or tested yet, as it comes with a raft of other implementation issues. I can think of some near term solutions for your specific situation though, I will see what I can do but it will come as a code update, so it may be a while.
A little more testing...
Browser: 127.0.0.1:4028 does work.
Browser: 192.168.1.XXX:4028 does not work.
Seems as though linux does not treat the internal IP and loopback IP in the same way?
@lily Thanks for trying. I'll keep testing and researching. Knowing my luck, you'll get it fixed and in an update before I make any progress. LOL
That is correct: the loopback address is a different interface than your routeable IP.
You can see the details for them by doing: ip addr
The 'lo' interface is your loopback, aka 127.0.0.1
Your primary IP is on 'eth0'
While they refer to the same machine, they connect using a different path, which is why they do not work the same.
Okay... I somehow figured it out with redirection. I'm sure there isn't much desire to know, but I will provide the directions below.
First, I needed to know the name of my network device and the local ip assiged (DHCP or Static) to my machine.
*In my case it was "eth0" and "192.168.1.XXX" (It's set by DHCP but it's MAC assigned by my router)
Next, I needed to install iptables.
Command: apt-get install --reinstall iptables
*I thought this was a standard linux install, but I guess PimpOS doesn't include it. No big deal and an easy fix.
I then had to setup ipv4 to use the redirection with the correct network device..
Command: sysctl -w net.ipv4.conf.eth0.route_localnet=1
*Change "eth0" to whatever device your machine is using.
Now I needed to add the redirection to the iptable.
Command: iptables -t nat -I PREROUTING -p tcp -d 192.168.1.XXX --dport 4041 -j DNAT --to-destination 127.0.0.1:4028
*Need to change a few things here. First, I had to enter my local ip (192.168.1.XXX) and the loopback ip (127.0.0.1) of the machine.
*Also, in my case, I wanted to change to a different port for the incoming connection. I wanted incoming port 4041 to redirect to the machine's loopback port of 4028 (4028 being the port for the miner listed in the Agent console i.e. "localhost:4028". Each miner added in the Agent console will have a different port.)
Last, I needed to setup the port forwarding on my router so I forwarded incoming port 4041 to port 4041 on the Pimp machine (192.168.1.XXX)
*Each router will be different on how this is done. Search Google for your router and "Port Forward".
That's it! Agent console and the miner.farm both show my rig running AND Mining-Monitor.org can now see my rig! Sweetness!
*Note: Changing the incoming port is not required. If you don't need this, then just use the local port number assigned by the Agent console (i.e. 4028) for both incoming and the loopback port in the Port Forwarding on your router and in the iptables command above.
That is a great and creative solution :) Perfectly acceptable.
I have created a development tracker story to enable local IP usage in the agent, so at some point in the future you will not need to NAT your local address.
Thanks. It came to me while I was taking a break... "I'm look at this all wrong! K.I.S.S. should be applied to this..." A little searching on the net and I found what I needed. For once. LOL
I got it working now, but I still look forward to the updates down the road to make it easier.
I found out the hard way that iptables commands are not kept after a reboot and must be reapplied to take effect. A quick search on the net got me the fix.
In order to make your iptables rules persistent after a reboot, apply your iptables rules (command from the above post with the directions) and then install "iptables-persistent" package using apt-get.
Command: apt-get install iptables-persistent
*The install will ask if you wish to save the current iptables rules to the .v4 and .v6 files (IPv4 and IPv6). Answer "Yes" to both and your applied rules will be saved to the correct files.
*If you installed iptables-persistent without your nat rules already applied to your system or you answered "No" during the install, simply follow the below section for updating your rules files.
Updating iptables Rule Files:
To update persistent iptables with new rules simply use an iptables command to set the rules into your system, then run the iptables-save command.
Command: iptables-save > /etc/iptables/rules.v4
Command: ip6tables-save > /etc/iptables/rules.v6
Removing Persistent iptables Rules:
To remove persistent iptables rules simply open the relevant /etc/iptables/rules.v* file and delete lines containing all unwanted rules.
That's it. Now your rules will be automatically reapplied after each reboot.
Something else to add.
I found out the hard way again...
The command: "sysctl -w net.ipv4.conf.eth0.route_localnet=1" does not keep after reboots. Instead of working this out the hard way, I just added it to the startup.sh file in root. Problem solved.
Also, to note: If you don't want to install the iptables-persistent app, just add the redirection rule command to the startup.sh file after the sysctl command. PimpOS will run those two commands at startup and all will be good.
/etc/sysctl.confis where permanent sysctl settings go. Hope this helps you with your unique network setup.
We promise to keep your email safe and never spam you.
Copyright (c) 2012-2019 Portable Instant Mining Platform LLC. All rights Reserved.