0

I have a question regarding restriction access to private etehreum network.

I created my Private Etehreum network using Geth(for now just only with one node) on the Ubuntu 16.04 virtual machine.

And I have the App which is communicated with private network by Web3, this app is hosted on the different virtual machine.

I ran my node from the console with this command:

geth --datadir=/ethereum-private/chaindata/ --rpcapi admin,personal,web3,eth,miner --networkid 11 --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpccorsdomain "*"

And after that I'm able to connect by geth attach http://56.120.4.46:8545 or throug web3 web3.setProvider(new web3.providers.HttpProvider(host)); from any server or computer.

So what I want to do it's to allow access to my ethereum network only for that server where my App is located and restrict it for any other servers/ips

Can you please tell me how can I do it?

1

This is not specifically an Ethereum question, more like something related to Linux. You essentially want to block all other IPs other than your designated one to access your server at port 8545.

Terminal one liner, shamelessly taken from this thread:

iptables -I INPUT \! --src 1.2.3.4 -m tcp -p tcp --dport 8545 -j DROP

It will drop access to all IPs on port 8545 other than 1.2.3.4. Replace that with whatever you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.