n2n
n2n copied to clipboard
support multiple port on one suppernode.
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.
This is a very good idea. It is very useful in an environment with network restrictions. I support it.
so easy, Just start the respective process on each port.
so easy, Just start the respective process on each port.
How to do it? thx
@svenmax So it's multiple instance of supernode , but can they are communicate each other? I need clients to stay at the same LAN.
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.
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?
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 Thank you, that is a good idea! --> #424
we can use sokit for port forwarding in windows.
Thanks all, port forward it does work well , but native support multiple ports will be a more beautiful thing.