Is there anyway to set (white-list?) your Ethereum node's peers by public key and ip address? I'm specifically playing around with a private network right now, but this should be relevant to the public network as well.
[Ethereum] ny way to white list ethereum node peers by public key and ip
go-ethereumNetworknodesprivate-blockchain
Related Solutions
You can tell parity to avoid scanning private IPs by simply running:
parity --allow-ips public
You can even fine-tune parity to do less aggressive peering:
parity --allow-ips public --no-discovery --max-pending-peers 4 --min-peers 4 --max-peers 8
Or just block reserved IPs via iptables:
iptables -A OUTPUT -p tcp -s 0/0 -d 0.0.0.0/8 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 100.64.0.0/10 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 169.254.0.0/16 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 192.0.0.0/24 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 192.0.2.0/24 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 192.88.99.0/24 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 198.18.0.0/15 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 198.51.100.0/24 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 203.0.113.0/24 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 224.0.0.0/4 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 240.0.0.0/4 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 0.0.0.0/8 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 100.64.0.0/10 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 169.254.0.0/16 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 192.0.0.0/24 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 192.0.2.0/24 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 192.88.99.0/24 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 198.18.0.0/15 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 198.51.100.0/24 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 203.0.113.0/24 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 224.0.0.0/4 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 240.0.0.0/4 -j DROP
By another computer, I'm assuming you mean a separate machine within your the same LAN? Did you assign it a unique IP or is just on a subnet?
Either way, try admin.addPeer("enode://address@ip:port")
in console.
Another option is to set up a static-peers.json
file. I answered a similar question a couple days ago you can refer to for more details.
I didn't read the guide you posted, but you definitely don't need to download the Ethereum main net in order to launch your own private network. You just need to init a customgenesis.json that specifies the networkid and then get to work. Be sure to indicate --networkid
when launching your geth instance.
Best Answer
Yes, you can make a file called static-nodes.json, containing the enode address (basically IP + public key).
See the example on the Geth wiki.
Alternatively I haven't tried this but according to this answer you can make a file called trusted-nodes.json with the same content, then set max peers to a low number (zero?) so your node doesn't connect to anyone else.
To be on the safe side you may well want to firewall your nodes off as well, either by specifying their IPs or by connecting them via SSH tunnels or a VPN or whatever.