Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve geth and lighthouse advertised public address configuration #163

Open
corverroos opened this issue Feb 27, 2023 · 0 comments
Open
Labels
protocol protocol team tickets

Comments

@corverroos
Copy link
Contributor

corverroos commented Feb 27, 2023

🎯 Problem to be solved

The current configuration is not optimal for users behind a NAT that want to advertise a public address instead of relying on automatic peer discovery. See feedback from 0xFury on discord on how to configure externally advertised public addresses for geth and lighthouse.

https://discord.com/channels/849256203614945310/946519880910385172/1078776267194777810.

Proposed Solution:

  1. Geth supports external advertised address --nat=extip:<IP> for IP and --port=<PORT> for port:
  --nat value                         NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any")
  --port value                        Network listening port (default: 30303)

This can be configured in the docker-compose as (see .emv sample below):

command:
      --nat=${GETH_NAT:-any}
      --port=${GETH_PORT_P2P:-30303}

ports:
      - ${GETH_PORT_P2P:-30303}:${GETH_PORT_P2P:-30303}/tcp # P2P TCP
      - ${GETH_PORT_P2P:-30303}:${GETH_PORT_P2P:-30303}/udp # P2P UDP
  1. Lighthouse also supports advertised IPs and ports via the following command line args:
      --enr-address=${PUBLIC_IP:-}
      --enr-tcp-port=${LIGHTHOUSE_PORT_P2P:-}
      --enr-udp-port=${LIGHTHOUSE_PORT_P2P:-}

Example .env.sample:

######### Advanced Networking #########

# These are some parameters you can use to help with (incoming) peering issues on clients.
# One prerequisite to these tweaks is to ensure you open up the correct ports in your firewall/router.
# Another prerequisite is to declare your external public IP here:
#PUBLIC_IP=<external public IP>

# Enable NAT for Geth
# For additional NAT settings, see Geth docs: https://geth.ethereum.org/docs/fundamentals/command-line-options
#GETH_NAT=extip:${PUBLIC_IP}

Note we should alignPUBLIC_IP with CHARON_P2P_EXTERNAL_HOSTNAME and NIMBUS_EXTERNAL_IP, preferably use the same variable for all. Need to double check if all flags support IPs and DNSs or not...

@github-actions github-actions bot added the protocol protocol team tickets label Feb 27, 2023
@corverroos corverroos changed the title Improve geth and lighthouse NAT configuration Improve geth and lighthouse advertised public address configuration Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol protocol team tickets
Projects
None yet
Development

No branches or pull requests

1 participant