Skip to content

Internal IP address is used on EC2 hosts instead of Elastic IP Address #230

Closed
@threejeez

Description

@threejeez

Type: Question/Enhancement

Severity: High

Description:

I'm running a bootstrap node (B) and a node that connects to it that provides some content (C). Both nodes are running on an EC2 host and each instance has a NIC with a private IP address as well as an associated public elastic IP address. I then launch a node on my local PC (P) using the Bootstrap node and call findProviders to find the content on node C. While the content can be found through node B, my local node cannot connect to C because the IP address in the PeerInfo object for C is the internal one instead of the public Elastic IP.

To track this down I turned on debug logging and saw the following lines:

libp2p:dht:query:� ������كO�X��_��Ь`���O��geIK�G:Qmf4BRdg queue:work +0ms
libp2p:dht:net:Qmf4BRdg sending to: QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN +206ms
libp2p:switch:dial dialing QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN +205ms
libp2p:switch:dial dialing transport TCP +0ms
libp2p:switch:transport dialing TCP [ '/ip4/10.0.0.246/tcp/3000/ipfs/QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN' ] +18s
libp2p:swarm:dialer dialMany:start +18s
libp2p:swarm:dialer dialSingle: QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN:/ip4/10.0.0.246/tcp/3000/ipfs/QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN +1ms```

While the content does reside on node `QmYqacKLM4ST232aSRuTCVzvYxz1rA1mMhN3fAuRBBzzAN`, it will obviously fail to dial the node because `10.0.0.246` is the private IP Address for the machine.

We obviously can't bind libp2p to the public Elastic IP since it's not an IP that's associated with an actual NIC. I've looked into `multiaddress`'s `encapsulate` but haven't success with that.

So, the question is: what can be done to get the IP address that's broadcast to the network to be the public Elastic IP address instead for the private one? Does libp2p support this functionality or does it need to be enhanced?

#### Steps to reproduce the error:

1. Run a bootstrap node on an EC2 host
2. Run a node that provides content on another EC2 host and use the bootrap node from step 1
3. Start another node outside of AWS (local PC, for example) and connect to the network via the bootstrap node from step 1
4. Try to `findProviders` from the node in step 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportA question or request for supportstatus/deferredConscious decision to pause or backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions