n2n icon indicating copy to clipboard operation
n2n copied to clipboard

support multiple port on one suppernode.

Open tlsalex opened this issue 4 years ago • 10 comments

Just like sshd, Nomally I will make it listen on port 4444 and 5555 at the same time. Then I can ssh to my VPS on port 4444 or 5555.

Now my supernode listen on port 53, After company change ISP. I found edge can not get response from supernode. and restarting edge did not work. If I make supernode listen on port 49152, then everything is fine. So seems it's a good idea to make supernode to have the capacity to listen on multiple port.

tlsalex avatar Sep 11 '20 09:09 tlsalex

This is a very good idea. It is very useful in an environment with network restrictions. I support it.

ghost avatar Sep 12 '20 00:09 ghost

so easy, Just start the respective process on each port.

skyformat99 avatar Sep 14 '20 00:09 skyformat99

so easy, Just start the respective process on each port.

How to do it? thx

ghost avatar Sep 14 '20 03:09 ghost

@svenmax So it's multiple instance of supernode , but can they are communicate each other? I need clients to stay at the same LAN.

tlsalex avatar Sep 15 '20 11:09 tlsalex

As of now, multiple supernodes cannot actively work in parallel. The network will fall apart (some nodes connected to one, some to the other). It would only work in a backup-style (one fails, the other needs to start up, both provided beforehand to the edges via additional -l command line parameter).

@tlsalex Not sure about it but maybe iptables' port mapping might be of help.

Logan007 avatar Sep 15 '20 12:09 Logan007

Actually, I successfully tried the port mapping (linked to in the post above) at the supernode which will seemingly add a new port which just gets redirected to the regular supernode port:

sudo iptables -t nat -A PREROUTING -i <interface name> -d <supernode's ip address> -p udp --dport <new port> -j REDIRECT --to-ports <regular supernode port>

Edges then can connect to both, the regular supernode port as well as the additional new port. It could be added as additional ExecStartPost= line to your supernode's .service file which can hold several such lines.

Does it work for you?

Logan007 avatar Sep 15 '20 14:09 Logan007

Actually, I successfully tried the port mapping (linked to in the post above) at the supernode which will seemingly add a new port which just gets redirected to the regular supernode port:

sudo iptables -t nat -A PREROUTING -i <interface name> -d <supernode's ip address> -p udp --dport <new port> -j REDIRECT --to-ports <regular supernode port>

Edges then can connect to both, the regular supernode port as well as the additional new port. It could be added as additional ExecStartPost= line to your supernode's .service file which can hold several such lines.

Does it work for you?

This is very, very good, and I suggest adding it to the FAQ. thx

skyformat99 avatar Sep 16 '20 00:09 skyformat99

@skyformat99 Thank you, that is a good idea! --> #424

Logan007 avatar Sep 16 '20 09:09 Logan007

we can use sokit for port forwarding in windows.

ghost avatar Sep 16 '20 09:09 ghost

Thanks all, port forward it does work well , but native support multiple ports will be a more beautiful thing.

tlsalex avatar Sep 17 '20 01:09 tlsalex