1

Currently geth listens on all interfaces (0.0.0.0:30303). I need to bind the main port 30303 to only a specific network interface in the device, which would normally be accomplished by specifying a local source IP address to bind to. Can this be accomplished?

2

You need to use the flags --rpc and --rpcaddr to bind the IP address upon execution of geth.

For example, if you wanted to bind 30303 which is the default port to 10.0.2.18, use --rpcaddr 10.0.2.18

When you run geth this is verified in the console with a message saying something like "Http connection established: http://your.ip."

If you need to change the port you can use both flags --rpcaddr 10.0.2.18 and --rpcport 30304.

  • That seems like it would expose the RPC (control) interface, which is by default only bound to localhost, and change the RPC port, which is 8545 by default, right? I wish to keep RPC bound to localhost and in addition also bind the node P2P listen port (--port) to a specific network interface. – Protected Apr 25 '18 at 19:21
  • Oh yes, you can definitely customize that. I've used 8081 in the past using both localhost and custom IP. Just specify http: // localhost instead of 0.0.0.0. github.com/ethereum/wiki/wiki/JSON-RPC – blockstreetboi89 Apr 25 '18 at 23:29
  • Is --rpcaddr also changing the ip on which geth listens for p2p connections ? – Nicolas Massart Aug 22 '18 at 21:55
  • @NicolasMassart geth will be exposed to that ip for connections. it is recommended to do this for trusted ip's and nodes – blockstreetboi89 Aug 24 '18 at 22:14
  • @blockstreetboi89 yes but --rpcaddr is only for JSON RPC service or is it also setting P2P discovery service? – Nicolas Massart Aug 25 '18 at 7:17

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.