Skip to content

Commit

Permalink
V6 manual ENRs
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Sep 30, 2024
1 parent 75fb3d7 commit 068144d
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 9 deletions.
4 changes: 3 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ CL_P2P_PORT=9000
PRYSM_PORT=9000
PRYSM_UDP_PORT=9000
CL_QUIC_PORT=9001
# Some clients need a separate port for IPv6
CL_IPV6_P2P_PORT=9090
# Local grafana dashboard port. Do not expose to Internet, it is insecure http
GRAFANA_PORT=3000
# Local Siren UI port
Expand Down Expand Up @@ -331,4 +333,4 @@ DDNS_TAG=v2
NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/lib/docker/.+)($|/)'

# Used by ethd update - please do not adjust
ENV_VERSION=16
ENV_VERSION=17
8 changes: 8 additions & 0 deletions grandine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ if [ "${IPV6}" = "true" ]; then
echo "Configuring Grandine to listen on IPv6 ports"
__ipv6="--listen-address-ipv6 :: --libp2p-port-ipv6 ${CL_P2P_PORT:-9000} --discovery-port-ipv6 ${CL_P2P_PORT:-9000} \
--quic-port-ipv6 ${CL_QUIC_PORT:-9001}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(curl -s -6 ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr-address-ipv6 ${__public_v6} --enr-tcp-port-ipv6 ${CL_P2P_PORT:-9000} --enr-udp-port-ipv6 ${CL_P2P_PORT:-9000}"
fi
else
__ipv6=""
fi
Expand Down
8 changes: 8 additions & 0 deletions lighthouse/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ fi
if [ "${IPV6}" = "true" ]; then
echo "Configuring Lighthouse to listen on IPv6 ports"
__ipv6="--listen-address :: --port6 ${CL_P2P_PORT:-9000} --quic-port6 ${CL_QUIC_PORT:-9001}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(wget -6 -q -O- ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr-address ${__public_v6}"
fi
else
__ipv6=""
fi
Expand Down
4 changes: 3 additions & 1 deletion lodestar-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ services:
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
- NODE_OPTIONS=${LODESTAR_HEAP:---max-old-space-size=8192}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion lodestar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ services:
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
- NODE_OPTIONS=${LODESTAR_HEAP:---max-old-space-size=8192}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
3 changes: 2 additions & 1 deletion lodestar/Dockerfile.binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FROM ${DOCKER_REPO}:${DOCKER_TAG}
ARG BUILD_TARGET
ARG SRC_REPO

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ARG USER=lsconsensus
ARG UID=10002
Expand Down
3 changes: 2 additions & 1 deletion lodestar/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RUN bash -c "cd .. && rm -rf app && git clone ${SRC_REPO} app && cd app && git c

FROM node:22.4-slim

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ARG USER=lsconsensus
ARG UID=10002
Expand Down
10 changes: 9 additions & 1 deletion lodestar/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ fi

if [ "${IPV6}" = "true" ]; then
echo "Configuring Lodestar to listen on IPv6 ports"
__ipv6="--listenAddress6 :: --port6 ${CL_P2P_PORT:-9000}"
__ipv6="--listenAddress 0.0.0.0 --listenAddress6 :: --port6 ${CL_IPV6_P2P_PORT:-9090}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(wget -6 -q -O- ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr.ip6 ${__public_v6}"
fi
else
__ipv6=""
fi
Expand Down
4 changes: 4 additions & 0 deletions teku-allin1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ services:
- EMBEDDED_VC=true
- NETWORK=${NETWORK}
- ENABLE_DIST_ATTESTATION_AGGR=${ENABLE_DIST_ATTESTATION_AGGR:-false}
- IPV6=${IPV6:-false}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion teku-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ services:
- WEB3SIGNER=false
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion teku.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ services:
- EMBEDDED_VC=false
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
20 changes: 19 additions & 1 deletion teku/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,25 @@ fi

if [ "${IPV6}" = "true" ]; then
echo "Configuring Teku to listen on IPv6 ports"
__ipv6="--p2p-interface 0.0.0.0,:: --p2p-port-ipv6 ${CL_P2P_PORT:-9000}"
__ipv6="--p2p-interface 0.0.0.0,:: --p2p-port-ipv6 ${CL_IPV6_P2P_PORT:-9090}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv4_pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v4=$(curl -s -4 ifconfig.me)
__public_v6=$(curl -s -6 ifconfig.me)
set -e
__valid_v4=0
if [[ "$__public_v4" =~ $__ipv4_pattern ]]; then
__valid_v4=1
fi
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
if [ "${__valid_v4}" -eq 1 ]; then
__ipv6+=" --p2p-advertised-ips ${__public_v4},${__public_v6}"
else
__ipv6+=" --p2p-advertised-ip ${__public_v6}"
fi
fi
else
__ipv6=""
fi
Expand Down

0 comments on commit 068144d

Please sign in to comment.