Updated on May 17, 2020

Configuring NAT

Use the --nat-method option to specify the NAT method. Options are: UPNP, MANUAL, KUBERNETES, DOCKER, AUTO, and NONE.

The enode advertised to other nodes during discovery is the external IP address and port. The admin_nodeInfo JSON-RPC API method returns the external address and port for the enode and listenAddr properties.

While Hyperledger Besu is running, the following are not supported:

  • IP address changes
  • Changing NAT methods. To change the NAT method, restart the node with the --nat-method option set.

UPnP

Specify UPNP to quickly allow inbound peer connections without manual router configuration. Use UPnP in home or small office environments where a wireless router or modem provides NAT isolation.

UPnP automatically detects if a node is running in a UPnP environment and provides port forwarding. UPnP might introduce delays during node startup, especially on networks without a UPnP gateway device.

Tip

UPnP support is often disabled by default in networking firmware. If disabled by default, you must explicitly enable UPnP support.

Manual

Specify MANUAL to explicitly configure the external IP address and ports advertised.

By specifying MANUAL:

Kubernetes

Specify KUBERNETES to explicitly specify Hyperledger Besu is running inside a Kubernetes cluster. Besu automatically detects if it’s running inside of a Kubernetes cluster and interacts with Kubernetes APIs as required to determine external IP addresses and exposed ports. Besue stores the configuration in /opt/besu/shared/kube-config.

Docker

Specify DOCKER to explicitly specify Hyperledger Besu is running inside a Docker container. If you specify DOCKER, you advertise the host IP address not the container IP address.

The host IP address is the advertised host specified in the docker run command. If not specified in the docker run command, the advertised host defaults to the values for --p2p-host and --p2p-port.

Auto

AUTO is the default NAT method. AUTO detects if Besu is running inside a Kubernetes cluster or a Docker container. If running inside:

  • A Kubernetes cluster, AUTO acts as if you specified KUBERNETES.
  • A Docker container, AUTO acts as if you specified DOCKER.
  • Neither a Kubernetes cluster nor a Docker container, AUTO acts as if you specified NONE.

None

Specify NONE to explicitly specify Besu does not use NAT. If the NAT method is NONE, Besu ignores any values specified in the --p2p-host, --p2p-port, --rpc-http-host, and --rpc-http-port options. Besu advertises the default values instead.