ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.66k stars 3.3k forks source link

op-node "--p2p.advertise.ip" config seems not working #9987

Open windycrypto opened 8 months ago

windycrypto commented 8 months ago

Bug Description

My node is running behind a NAT, so I have configured the --p2p.advertise.ip option to the my external IP address, but the opp2p_self call to op-node doesn't report the external IP I configured, but only the internal IP address:

Steps to Reproduce

  1. Configure --p2p.advertise.ip=172.22.155.175

curl request my op-node:

curl --request POST \
  --url http://172.22.155.175:8547/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "opp2p_self",
  "params": [
  ],
  "id": 1
}'
  1. get response, the addresses field doesn't contain the ip address I configured
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "peerID": "16Uiu2HAmD1spbuKNfjimLSEay5Jew8BraGEoM6TfwHEGx8E1qSh6",
        "nodeID": "9e0f54790426784122f27215789319e399d24d6d70937108392f2923b619235b",
        "userAgent": "",
        "protocolVersion": "",
        "ENR": "enr:-J-4QFBU1YSd5IjpTNT1gFST5QRaboFjO4lCUQyhkIcjYlTIOTQqPJ7PbHfPbcWw0B9SYwXBXzRnE9cS5miFtVjS9aGGAY5-6-6vgmlkgnY0gmlwhKwWm6-Hb3BzdGFja4XEr9MJAIlzZWNwMjU2azGhAwVZ0ISbDnDpQZYykxOV514-IXQn2dpUCVohWUKR59B5g3RjcIIkBoN1ZHCCvF0",
        "addresses": [
            "/ip4/10.0.11.2/tcp/9222/p2p/16Uiu2HAmD1spbuKNfjimLSEay5Jew8BraGEoM6TfwHEGx8E1qSh6",
            "/ip4/127.0.0.1/tcp/9222/p2p/16Uiu2HAmD1spbuKNfjimLSEay5Jew8BraGEoM6TfwHEGx8E1qSh6"
        ],
        "protocols": null,
        "connectedness": 0,
        "direction": 0,
        "protected": false,
        "chainID": 0,
        "latency": 0,
        "gossipBlocks": true,
        "scores": {
            "gossip": {
                "total": 0,
                "blocks": {
                    "timeInMesh": 0,
                    "firstMessageDeliveries": 0,
                    "meshMessageDeliveries": 0,
                    "invalidMessageDeliveries": 0
                },
                "IPColocationFactor": 0,
                "behavioralPenalty": 0
            },
            "reqResp": {
                "validResponses": 0,
                "errorResponses": 0,
                "rejectedPayloads": 0
            }
        }
    }
    }
goldsquid commented 7 months ago

I have the same observation and the node has connectivity issues therefore. also I don't see udp supported in the output list of opp2p_self like in the output of the thread creator.

I actually explicitly allowed UDP on the firefall and the container and it looks to me that it shoudl be enabled by the default config.

sbvegan commented 5 months ago

This issue on the surface looks like its either the networking setup or the p2p node discovery. Some things to check:

If all of that looks good, then we'd suggest you look at the op-node logs and see if its reporting about p2p connection attempts and why they fail, if peers get banned, etc. If you find any of those, it'll be helpful for debugging.