n2n icon indicating copy to clipboard operation
n2n copied to clipboard

Add a --force-p2p option for edge nodes

Open RuofengX opened this issue 3 years ago • 11 comments

My question is, I have a supernode running on a vps with only 5Mbps bandwidth. I want my user could only use the p2p feature of n2n, supernode shouldn't forward any data stream in order to saving my cost of vps. Is it possible adding a option named --force-p2p for edge? This could help a lot.

RuofengX avatar Sep 14 '21 01:09 RuofengX

Also is it possible adding a option named --force-p2p for edge?

This idea has been discussed from time to time; no final solution yet as far as I rememeber.

#344 #515 #614

Logan007 avatar Sep 14 '21 05:09 Logan007

Also is it possible adding a option named --force-p2p for edge?

This idea has been discussed from time to time; no final solution yet as far as I rememeber.

#344 #515 #614

may be,we can limit the speed

introspection3 avatar Sep 14 '21 08:09 introspection3

Support. actually, my issue could merge with this one.

I use zerotier now and then, just for comparison, and I think zerotier does better on p2p. that's why I said n2n didn't try hard enough.

lucktu avatar Sep 14 '21 09:09 lucktu

that's why I said n2n didn't try hard enough.

There probably are more methods to punch holes into NATs and firewalls. We only have the current ones implemented. But it does not mean that we are limited to those in the future. UPnP would already help some.

Support. actually, my issue could merge with this one.

Are you sure? I took your issue as plead for more and "stronger" hole-punching whereas this issue is more about "do not use the supernode even if available" for packet forwarding.

Also is it possible adding a option named --force-p2p for edge?

:thinking: However, I have an idea how we might achieve something like "only use p2p for data packets, and not the supernode" without breaking the whole protocol... but I will need to test. I will let you know.

Logan007 avatar Sep 14 '21 12:09 Logan007

I agreed to the merger.

"only use p2p for data packets, and not the supernode", ok. supernode is just for shaking hands.

lucktu avatar Sep 14 '21 15:09 lucktu

I have just looked into it. It is not as easy to realize as I thought in the first place.

It would require way more changes than expected which I do not dare to make shortly before a possible release.

Main part still is PACKETs' role in hole punching process. We could rely on REGISTERs only – changing the whole protocol, not the packets themselves – but that would require to first build up (how?) and then keep connections alive between all peers all time, causing a lot of REGISTER traffic turning down scalability.

Also, please note that we will not completely get away from the supernode; broadcasts such as the essential ARP protocol always need to pass through the supernode.

Logan007 avatar Sep 14 '21 19:09 Logan007

@Logan007 you can limit the speed

introspection3 avatar Sep 15 '21 00:09 introspection3

you can limit the speed

I am not too confident with this and would recommend to use well-approved tools such as tc to this extent. At the egde side, it could help to limit the bandwidth on the edge-supernode line without affecting any other connection.

Logan007 avatar Sep 15 '21 18:09 Logan007

Considered answered, please re-open if required.

Logan007 avatar Oct 31 '21 09:10 Logan007

In my humble opinion, a ForceP2P option could be added to Supernode, where Supernode only offers handshakes and all packets that need to be forwarded by Supernode will be dropped in order to reduce Supernode's traffic and broadband consumption, especially on some pay-per-traffic servers

ywnsya avatar Jul 07 '22 09:07 ywnsya

The current n2n protocol actually uses also the forwarded data packets for hole punching, just dropping them unfortunately is no solution.

Logan007 avatar Jul 07 '22 12:07 Logan007