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

We ignore port when identifying peers - what happens if a peer changes its port? #2618

Closed
antiochp opened this issue Feb 22, 2019 · 9 comments

Comments

@antiochp
Copy link
Member

antiochp commented Feb 22, 2019

Related #2540.
Possibly related #2616?

Scenario -

  • We run a node on 10.0.0.1:3414
  • Other nodes store our peer address in their db (keyed by ip, ignoring the port - 10.0.0.1)
  • We restart our node, changing the port to 4414
  • What happens to inbound/outbound connections?
    • We should be able to initiate outbound connections to peers (regardless of our port)
    • But nobody knows we are now running on an updated port (existing nodes cannot connect to us?)

There is no mechanism to let peers and other nodes know about our updated port.

Do new nodes see our updated port? Only if they get our ip:port from us. If they get it from an existing node do they still see the old port?

This is kind of an edge-case but we should think through the implications here.

@nikito7
Copy link

nikito7 commented Feb 22, 2019

It will be an eternal defunct in case of static ip

Since change there are less 100 healthy peers

The another issue is #2616

@nikito7
Copy link

nikito7 commented Feb 22, 2019

Another perspective

If peer is behind NAT port will change alot

If peers are behind a CarrierNAT its worse

Not everybody have a public ip

@antiochp
Copy link
Member Author

@nikito7 I still don't fully understand what you are saying. Can you explain the problem a bit more, specifically around #2616?

@antiochp
Copy link
Member Author

antiochp commented Feb 22, 2019

If peer is behind NAT port will change alot.

That's what the NAT is for though, by definition - to provide a stable port forwarding setup, with a "static" port.

To allow "inbound" connections you need to be listening on a known port (by default 3414 but you can advertise a non-standard port).
Even behind a NAT with no port forwarding you can initiate outbound connections fine, its just that nobody will be able to initiate inbound connections to your node.

@nikito7
Copy link

nikito7 commented Feb 22, 2019

But peer identity will change

1.2.3.4:56788
1.2.3.4:45638

If you use only 1.2.3.4 how do you know?
20190222 12:10:14.609 DEBUG grin_servers::grin::seed - monitor_peers: on 0.0.0.0:3414, 28 connected (20 most_work). all 7904 = 107 healthy + 3 banned + 7794 defunct

the other issue #2616
I will test again

@antiochp
Copy link
Member Author

antiochp commented Feb 22, 2019

But peer identity will change

1.2.3.4:56788
1.2.3.4:45638

If you use only 1.2.3.4 how do you know?

You don't and you don't need to.

If the peer on 1.2.3.4 allows inbound connections then its listening on 3414 (or whatever it is configured to listen on).
The ports you are displaying there are the ports on the outbound end of an outbound connection. you will never connect to those directly.

Those ports do not (and should not) have any bearing on the identity of a peer.

@nikito7
Copy link

nikito7 commented Feb 22, 2019

My theory:

When I change the port. I am a new node for old nodes x.x.x.x:xxxx

And get "attacked" by them

The problem may be fixed when all nodes update in next release

Sorry for wasted time :) @antiochp

@quentinlesceller
Copy link
Member

Is this issue still relevant? @antiochp

@yeastplume
Copy link
Member

Have inadvertently tested this on testnet during the course of other testing. With a two nodes running on the same machine on different ports:
-Node on port 1: 6 peers
-Start node on port 2: 0 peers, no peers connect.
-Stop node on port 1
-Wait a bit
-Start node on port 2: 6 peers
-Start node on port 1: no peers connect

Seems to be working as intended,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants