Currently geth listens on all interfaces ( 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 Answers 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, use --rpcaddr

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 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, 2018 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 github.com/ethereum/wiki/wiki/JSON-RPC Apr 25, 2018 at 23:29
  • Is --rpcaddr also changing the ip on which geth listens for p2p connections ? Aug 22, 2018 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 Aug 24, 2018 at 22:14
  • @blockstreetboi89 yes but --rpcaddr is only for JSON RPC service or is it also setting P2P discovery service? Aug 25, 2018 at 7:17

I've used this to connect my desktop to my server's geth instance.

HTTP Server:

geth --http --http.port 8545 --http.addr --http.api personal,eth,net --http.corsdomain '*'


geth attach

WS Server:

geth --ws --ws.port 8546 --ws.addr --ws.api eth,net,web3 --ws.origins '*'


geth attach ws://


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.